iNumReg Struct Reference
This interface is used for ID -> iCelEntity* registers in the physical layer. More...
#include <physicallayer/numreg.h>
Public Member Functions | |
virtual void | Clear ()=0 |
Removes all objects from the registry. | |
virtual void * | Get (uint id)=0 |
Returns the object with ID id from the list. | |
virtual size_t | Length ()=0 |
Returns the size of the buffer (This is NOT the count of objects in the registry). | |
virtual uint | Register (void *obj)=0 |
Registers an object in the registry and returns the new ID, in error case ID 0 is returned. | |
virtual void | RegisterWithID (void *obj, uint id)=0 |
Registers an object in the registry with the provided ID. | |
virtual bool | Remove (void *obj)=0 |
Removes a registered object from the registry (Note: this is slow, whatever the implementation you choose). | |
virtual bool | Remove (uint id)=0 |
Removes a registered object from the registry. |
Detailed Description
This interface is used for ID -> iCelEntity* registers in the physical layer.Currently, two implementations are available:
- cel.numreg.lists (using arrays) This version is more effective if you don't care of the IDs used and if all the ID will be contiguous. This is usually the case of a server or a single app.
- cel.numreg.hash (using hashs) This version is more effective if you want to allow any kind of ID used. This is usually the case of client apps.
You can choose between these two implementations with the iCelPlLayer::ChangeNumReg function.
Definition at line 41 of file numreg.h.
Member Function Documentation
virtual void iNumReg::Clear | ( | ) | [pure virtual] |
Removes all objects from the registry.
virtual void* iNumReg::Get | ( | uint | id | ) | [pure virtual] |
Returns the object with ID id from the list.
virtual size_t iNumReg::Length | ( | ) | [pure virtual] |
Returns the size of the buffer (This is NOT the count of objects in the registry).
It is the size of array if you use array implementation, the size of the hash otherwise.
virtual uint iNumReg::Register | ( | void * | obj | ) | [pure virtual] |
Registers an object in the registry and returns the new ID, in error case ID 0 is returned.
virtual void iNumReg::RegisterWithID | ( | void * | obj, | |
uint | id | |||
) | [pure virtual] |
Registers an object in the registry with the provided ID.
You should call this function only if you are sure the ID isn't allocated yet. It is also advised to use the hash implementation for memory reasons.
virtual bool iNumReg::Remove | ( | void * | obj | ) | [pure virtual] |
Removes a registered object from the registry (Note: this is slow, whatever the implementation you choose).
virtual bool iNumReg::Remove | ( | uint | id | ) | [pure virtual] |
Removes a registered object from the registry.
The documentation for this struct was generated from the following file:
- physicallayer/numreg.h
Generated for CEL: Crystal Entity Layer by doxygen 1.4.7