A collection of SimObjects.
More...
List of all members.
Detailed Description
A collection of SimObjects.
It is often necessary to keep track of an arbitrary set of SimObjects. For instance, Torque's networking code needs to not only keep track of the set of objects which need to be ghosted, but also the set of objects which must always be ghosted. It does this by working with two sets. The first of these is the RootGroup (which is actually a SimGroup) and the second is the GhostAlwaysSet, which contains objects which must always be ghosted to the client.
Some general notes on SimSets:
- Membership is not exclusive. A SimObject may be a member of multiple SimSets.
- A SimSet does not destroy subobjects when it is destroyed.
- A SimSet may hold an arbitrary number of objects.
Member Function Documentation
bool SimSet::acceptsAsChild |
( |
SimObject |
obj |
) |
|
Test whether the given object may be added to the set.
- Parameters:
-
| obj | The object to test for potential membership. |
- Returns:
- True if the object may be added to the set, false otherwise.
Add the given objects to the set.
- Parameters:
-
| objects | The objects to add to the set. |
Make the given object the first object in the set.
- Parameters:
-
| obj | The object to bring to the frontmost position. Must be contained in the set. |
void SimSet::callOnChildren |
( |
string |
method, |
|
|
string |
args... | |
|
) |
| | |
Call a method on all objects contained in the set.
- Parameters:
-
| method | The name of the method to call. |
| args | The arguments to the method. |
- Note:
- This method recurses into all SimSets that are children to the set.
- See also:
- callOnChildrenNoRecurse
void SimSet::callOnChildrenNoRecurse |
( |
string |
method, |
|
|
string |
args... | |
|
) |
| | |
Call a method on all objects contained in the set.
- Parameters:
-
| method | The name of the method to call. |
| args | The arguments to the method. |
- Note:
- This method does not recurse into child SimSets.
- See also:
- callOnChildren
void SimSet::deleteAllObjects |
( |
|
) |
|
Delete all objects in the set.
SimObject SimSet::findObjectByInternalName |
( |
string |
internalName, |
|
|
bool |
searchChildren = false | |
|
) |
| | |
Find an object in the set by its internal name.
- Parameters:
-
| internalName | The internal name of the object to look for. |
| searchChildren | If true, SimSets contained in the set will be recursively searched for the object. |
- Returns:
- The object with the given internal name or 0 if no match was found.
Get the number of objects contained in the set.
- Returns:
- The number of objects contained in the set.
int SimSet::getFullCount |
( |
|
) |
|
Get the number of direct and indirect child objects contained in the set.
- Returns:
- The number of objects contained in the set as well as in other sets contained directly or indirectly in the set.
Get the object at the given index.
- Parameters:
-
- Returns:
- The object at the given index or -1 if index is out of range.
Return the index of the given object in this set.
- Parameters:
-
| obj | The object for which to return the index. Must be contained in the set. |
- Returns:
- The index of the object or -1 if the object is not contained in the set.
Return a random object from the set.
- Returns:
- A randomly selected object from the set or -1 if the set is empty.
Test whether the given object belongs to the set.
- Parameters:
-
- Returns:
- True if the object is contained in the set; false otherwise.
void SimSet::listObjects |
( |
|
) |
|
Dump a list of all objects contained in the set to the console.
void SimSet::onObjectAdded |
( |
SimObject |
object |
) |
|
Called when an object is added to the set.
- Parameters:
-
| object | The object that was added. |
void SimSet::onObjectRemoved |
( |
SimObject |
object |
) |
|
Called when an object is removed from the set.
- Parameters:
-
| object | The object that was removed. |
Make the given object the last object in the set.
- Parameters:
-
| obj | The object to bring to the last position. Must be contained in the set. |
Remove the given objects from the set.
- Parameters:
-
| objects | The objects to remove from the set. |
Make sure child1 is ordered right before child2 in the set.
- Parameters:
-
| child1 | The first child. The object must already be contained in the set. |
| child2 | The second child. The object must already be contained in the set. |
void SimSet::sort |
( |
string |
callbackFunction |
) |
|
Sort the objects in the set using the given comparison function.
- Parameters:
-
| callbackFunction | Name of a function that takes two object arguments A and B and returns -1 if A is less, 1 if B is less, and 0 if both are equal. |