Group. More...
#include <rgroup.h>
Public Member Functions | |
RGroup (RGroup *grp) | |
RGroup (cGroups *owner, const size_t id) | |
virtual void | Verify (void) |
virtual void | Clear (void) |
void | Insert (cObj *obj) |
void | Delete (cObj *obj) |
virtual void | PostInsert (const cObj *obj) |
virtual bool | PreInsertAll (const cGroup *from) |
virtual void | PostDelete (const cObj *obj) |
virtual bool | PreDeleteAll (void) |
virtual bool | CanInsert (const cObj *obj) |
virtual bool | IsCompatible (const cObj *obj) |
virtual bool | CanDelete (const cObj *obj) |
size_t | GetId (void) const |
size_t | GetNbObjs (void) const |
size_t | GetObjsPos (void) const |
RCursor< cObj > | GetObjs (void) const |
bool | IsIn (const size_t id) const |
bool | CommonObjs (const cGroup *grp) const |
virtual bool | IsCompatible (const cGroup *grp) const |
bool | SameObjs (const cGroup *grp) const |
size_t * | GetObjectsId (void) const |
int | Compare (const cGroup &grp) const |
cObj * | GetObjPos (const size_t pos) |
virtual | ~RGroup (void) |
Protected Attributes | |
size_t | Id |
cGroups * | Owner |
size_t | SubObjects |
size_t | NbSubObjects |
bool | Reserved |
Detailed Description
template<class cGroup, class cObj, class cGroups>
class R::RGroup< cGroup, cObj, cGroups >
Group.
The RGroup class provides a representation for a group that will contain objects.
Constructor & Destructor Documentation
Construct the group.
- Parameters
-
grp Group used as source.
RGroup | ( | cGroups * | owner, |
const size_t | id | ||
) |
Construct the group.
- Parameters
-
owner Owner of the group. id Identifier of the group.
|
virtual |
Destruct the group.
Member Function Documentation
|
virtual |
Verify if the group is not violating the integrity of the system.
|
virtual |
Clear the information container in a group.
Reimplemented in RGroupSG< cGroup, cObj, cGroups >, and RGroupNN< cGroup, cObj, cGroups >.
void Insert | ( | cObj * | obj | ) |
Put an object in the group.
- Parameters
-
obj Pointer to the object to insert.
void Delete | ( | cObj * | obj | ) |
Delete an object in the group.
- Parameters
-
obj Pointer to the object to delete.
|
virtual |
Method call after an object was inserted in the group.
- Parameters
-
obj Pointer to the object to insert.
Reimplemented in RGroupSG< cGroup, cObj, cGroups >, and RGroupNN< cGroup, cObj, cGroups >.
|
virtual |
Method call before all the objects of a given group are inserted into the current one. This method can be used to copy internal information from one group to the other.
- Parameters
-
from The group used as source.
- Returns
- true if the PostInsert method should be called after each object is inserted from the group (true is the default value).
Reimplemented in RGroupNN< cGroup, cObj, cGroups >.
|
virtual |
Method call after one object was deleted from the group.
- Parameters
-
obj Pointer to the object to delete.
Reimplemented in RGroupSG< cGroup, cObj, cGroups >, and RGroupNN< cGroup, cObj, cGroups >.
|
virtual |
Method call each time all the objects are deleted from the group.
- Returns
- true if the PostDelete method should be called after each object was deleted from the group (true if the default value).
Reimplemented in RGroupNN< cGroup, cObj, cGroups >.
|
virtual |
Look if an object can be insert in the group. By default, the method returns always true.
- Parameters
-
obj Pointer to the object to insert.
Reimplemented in RGroupSG< cGroup, cObj, cGroups >, and RGroupNN< cGroup, cObj, cGroups >.
|
virtual |
Look if an object is "compatible" with a specific group. By default, the method returns always true.
- Parameters
-
obj Pointer to the object to verify.
|
virtual |
Look if an object can be delete from the group. By default, the method returns always true.
- Parameters
-
obj Pointer to the object to delete.
size_t GetId | ( | void | ) | const |
Return the identifier of the group.
size_t GetNbObjs | ( | void | ) | const |
Get the number of objects in the group.
- Returns
- size_t.
size_t GetObjsPos | ( | void | ) | const |
Get the position of the first object in the group.
- Returns
- size_t.
RCursor<cObj> GetObjs | ( | void | ) | const |
Return a cursor over the objects of a group.
bool IsIn | ( | const size_t | id | ) | const |
Return true if an object is in the group.
- Parameters
-
id Identifier of the object to test.
bool CommonObjs | ( | const cGroup * | grp | ) | const |
Look if the two groups have common objects.
- Parameters
-
grp Pointer to the group.
- Returns
- boolean.
|
virtual |
Look if two groups are "compatible".
- Parameters
-
grp Pointer to the group.
- Returns
- boolean.
bool SameObjs | ( | const cGroup * | grp | ) | const |
Return true if the two groups have the same objects.
- Parameters
-
grp Pointer to the group.
size_t* GetObjectsId | ( | void | ) | const |
Return the list of the objects. The list is created by RGroup, but must be deleted by the caller. The list is ended by a cNoRef value.
int Compare | ( | const cGroup & | grp | ) | const |
Compare two groups. Used for RContainer.
cObj* GetObjPos | ( | const size_t | pos | ) |
Get a pointer to an object at a given position in the group.
- Parameters
-
pos Position.
- Returns
- cObj*
Member Data Documentation
|
protected |
Identifier of the Group.
|
protected |
Owner of the group.
|
protected |
Index of the first object attached to the group.
|
protected |
Number of objects attached to the group.
|
protected |
Is the group reserved?