Torque2D Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Attributes | List of all members
SimSet Class Reference

`#include <simSet.h>`

Inheritance diagram for SimSet:

## Public Member Functions
| SimSet ()
| ~SimSet ()
virtual void | onRemove ()
| Called when the object is removed from the sim. More...
virtual void | onDeleteNotify (SimObject *object)
virtual U32 | getTamlChildCount (void) const
| Called when Taml attempts to compile a list of children. More...
virtual SimObject * | getTamlChild (const U32 childIndex) const
| Called when Taml attempts to compile a list of children. More...
virtual void | addTamlChild (SimObject *pSimObject)
| Called when Taml attempts to populate an objects children during a read. More...
void | callOnChildren (const char *method, S32 argc, const char *argv[], bool executeOnChildGroups=true)
virtual void | write (Stream &stream, U32 tabStop, U32 flags=0)
virtual SimObject * | findObject (const char *name)
SimObject * | findObjectByInternalName (const char *internalName, bool searchChildren=false)
virtual bool | writeObject (Stream *stream)
virtual bool | readObject (Stream *stream)
void | lock ()
void | unlock ()
| DECLARE_CONOBJECT (SimSet)
void | _setVectorAssoc (const char *file, const U32 line)
Set Management
virtual void | addObject (SimObject *)
| Add an object to the set. More...
virtual void | removeObject (SimObject *)
| Remove an object from the set. More...
virtual void | pushObject (SimObject *)
virtual void | popObject ()
| Remove an object from the end of the list. More...
void | bringObjectToFront (SimObject *obj)
void | pushObjectToBack (SimObject *obj)
Public Member Functions inherited from SimObject
StringTableEntry | getClassNamespace () const
StringTableEntry | getSuperClassNamespace () const
void | setClassNamespace (const char *classNamespace)
void | setSuperClassNamespace (const char *superClassNamespace)
void | pushScriptCallbackGuard (void)
void | popScriptCallbackGuard (void)
S32 | getScriptCallbackGuard (void)
Namespace * | getNamespace ()
| Return the object's namespace. More...
const char * | tabComplete (const char *prevText, S32 baseLen, bool)
virtual void | dump ()
virtual void | dumpClassHierarchy ()
SimObject * | clone (const bool copyDynamicFields)
virtual void | copyTo (SimObject *object)
template<typename T >
bool | isType (void)
virtual bool | handlesConsoleMethod (const char *fname, S32 *routingId)
| DECLARE_CONOBJECT (SimObject)
Notify * | removeNotify (void *ptr, Notify::Type)
| Remove a notification from the list. More...
void | deleteNotify (SimObject *obj)
| Notify an object when we are deleted. More...
void | clearNotify (SimObject *obj)
| Notify an object when we are cleared. More...
void | clearAllNotifications ()
| Remove all notifications for this object. More...
void | processDeleteNotifies ()
| Send out deletion notifications. More...
void | registerReference (SimObject **obj)
void | unregisterReference (SimObject **obj)
const char * | getDataField (StringTableEntry slotName, const char *array)
void | setDataField (StringTableEntry slotName, const char *array, const char *value)
const char * | getPrefixedDataField (StringTableEntry fieldName, const char *array)
void | setPrefixedDataField (StringTableEntry fieldName, const char *array, const char *value)
const char * | getPrefixedDynamicDataField (StringTableEntry fieldName, const char *array, const S32 fieldType=-1)
void | setPrefixedDynamicDataField (StringTableEntry fieldName, const char *array, const char *value, const S32 fieldType=-1)
StringTableEntry | getDataFieldPrefix (StringTableEntry fieldName)
U32 | getDataFieldType (StringTableEntry slotName, const char *array)
SimFieldDictionary * | getFieldDictionary ()
void | clearDynamicFields (void)
| Clear all dynamic fields. More...
void | setCanSaveDynamicFields (bool bCanSave)
| Set whether fields created at runtime should be saved. Default is true. More...
bool | getCanSaveDynamicFields (void) const
| Get whether fields created at runtime should be saved. Default is true. More...
void | setInternalName (const char *newname)
StringTableEntry | getInternalName ()
| Get the internal of of this control. More...
virtual bool | save (const char *pcFilePath, bool bOnlySelected=false)
| Save object as a TorqueScript File. More...
virtual bool | isMethod (const char *methodName)
| Check if a method exists in the objects current namespace. More...
SimObjectId | getId (void) const
StringTableEntry | getIdString (void) const
U32 | getType () const
const StringTableEntry | getName (void) const
void | setId (SimObjectId id)
void | assignName (const char *name)
SimGroup * | getGroup () const
bool | isChildOfGroup (SimGroup *pGroup)
bool | isProperlyAdded () const
bool | isDeleted () const
bool | isRemoved () const
bool | isLocked ()
void | setLocked (bool b)
bool | isHidden ()
void | setHidden (bool b)
void | setProgenitorFile (const char *pFile)
StringTableEntry | getProgenitorFile (void) const
void | setPeriodicTimerID (const S32 timerID)
S32 | getPeriodicTimerID (void) const
bool | isPeriodicTimerActive (void) const
bool | isSelected () const
bool | isExpanded () const
void | setSelected (bool sel)
void | setExpanded (bool exp)
void | setModDynamicFields (bool dyn)
void | setModStaticFields (bool sta)
| SimObject ()
virtual | ~SimObject ()
virtual bool | processArguments (S32 argc, const char **argv)
| Process constructor options. (ie, new SimObject(1,2,3)) More...
virtual bool | onAdd ()
| Called when the object is added to the sim. More...
virtual void | onGroupAdd ()
| Called when the object is added to a SimGroup. More...
virtual void | onGroupRemove ()
| Called when the object is removed from a SimGroup. More...
virtual void | onNameChange (const char *name)
| Called when the object's name is changed. More...
virtual void | onStaticModified (const char *slotName, const char *newValue=NULL)
virtual void | inspectPreApply ()
virtual void | inspectPostApply ()
virtual void | onEditorEnable ()
| Called when the editor is activated. More...
virtual void | onEditorDisable ()
| Called when the editor is deactivated. More...
bool | registerObject ()
bool | registerObject (U32 id)
bool | registerObject (const char *name)
bool | registerObject (const char *name, U32 id)
void | unregisterObject ()
void | deleteObject ()
bool | addToSet (SimObjectId)
bool | addToSet (const char *)
bool | removeFromSet (SimObjectId)
bool | removeFromSet (const char *)
virtual bool | writeField (StringTableEntry fieldname, const char *value)
virtual void | writeFields (Stream &stream, U32 tabStop)
virtual void | buildFilterList ()
void | addFieldFilter (const char *fieldName)
void | removeFieldFilter (const char *fieldName)
void | clearFieldFilters ()
bool | isFiltered (const char *fieldName)
void | assignFieldsFrom (SimObject *obj)
void | assignDynamicFieldsFrom (SimObject *obj)
Public Member Functions inherited from ConsoleObject
const AbstractClassRep::Field * | findField (StringTableEntry fieldName) const
| Get a reference to a field by name. More...
virtual AbstractClassRep * | getClassRep () const
| Gets the ClassRep. More...
bool | setField (const char *fieldName, const char *value)
| Set the value of a field. More...
virtual | ~ConsoleObject ()
const AbstractClassRep::FieldList & | getFieldList () const
| Get a list of all the fields. This information cannot be modified. More...
AbstractClassRep::FieldList & | getModifiableFieldList ()
bool & | getDynamicGroupExpand ()
S32 | getClassId (U32 netClassGroup) const
const char * | getClassName () const

## Protected Attributes
SimObjectList | objectList
void * | mMutex
Protected Attributes inherited from SimObject
SimObjectId | mId
| Id number for this object. More...
StringTableEntry | mIdString
Namespace * | mNameSpace
U32 | mTypeMask
S32 | mScriptCallbackGuard
| Whether the object is executing a script callback. More...
bool | mCanSaveFieldDictionary
| true if dynamic fields (added at runtime) should be saved, defaults to true More...
StringTableEntry | mInternalName
| Stores object Internal Name. More...
StringTableEntry | mClassName
| Stores the class name to link script class namespaces. More...
StringTableEntry | mSuperClassName
| Stores super class name to link script class namespaces. More...

## STL Interface
typedef SimObjectList::iterator | iterator
typedef SimObjectList::value_type | value
SimObject * | front ()
SimObject * | first ()
SimObject * | last ()
bool | empty ()
S32 | size () const
iterator | begin ()
iterator | end ()
value | operator[] (S32 index)
iterator | find (iterator first, iterator last, SimObject *obj)
iterator | find (SimObject *obj)
template<typename T >
bool | containsType (void)
virtual bool | reOrder (SimObject *obj, SimObject *target=0)
SimObject * | at (S32 index) const
void | deleteObjects (void)
void | clear ()

## Additional Inherited Members
Public Types inherited from SimObject
enum | WriteFlags { SelectedOnly = BIT(0) }
Static Public Member Functions inherited from SimObject
static void | initPersistFields ()
Static Public Member Functions inherited from ConsoleObject
static const char * | lookupClassName (const U32 in_classTag)
| Get the classname from a class tag. More...
static void | initPersistFields ()
static void | consoleInit ()
static ConsoleObject * | create (const char *in_pClassName)
static ConsoleObject * | create (const U32 groupId, const U32 typeId, const U32 in_classId)
static AbstractClassRep * | getStaticClassRep ()
| Get the abstract class information for this class. More...
static AbstractClassRep * | getParentStaticClassRep ()
| Get the abstract class information for this class's superclass. More...
Protected Member Functions inherited from SimObject
virtual void | onTamlPreWrite (void)
| Taml callbacks. More...
virtual void | onTamlPostWrite (void)
| Called after Taml has finished writing the object. More...
virtual void | onTamlPreRead (void)
| Called prior to Taml reading the object. More...
virtual void | onTamlPostRead (const TamlCustomNodes &customNodes)
virtual void | onTamlAddParent (SimObject *pParentObject)
| Called after Taml has finished reading the object and has added the object to any parent. More...
virtual void | onTamlCustomWrite (TamlCustomNodes &customNodes)
| Called during the writing of the object to allow custom properties to be written. More...
virtual void | onTamlCustomRead (const TamlCustomNodes &customNodes)
| Called during the reading of the object to allow custom properties to be read. More...
void | linkNamespaces ()
void | unlinkNamespaces ()
Protected Member Functions inherited from ConsoleObject
| ConsoleObject ()
| ConsoleObject (const ConsoleObject &)
Static Protected Member Functions inherited from SimObject
static bool | setClass (void *obj, const char *data)
static bool | setSuperClass (void *obj, const char *data)
static bool | writeCanSaveDynamicFields (void *obj, StringTableEntry pFieldName)
static bool | writeInternalName (void *obj, StringTableEntry pFieldName)
static bool | setParentGroup (void *obj, const char *data)
static bool | writeParentGroup (void *obj, StringTableEntry pFieldName)
static bool | writeSuperclass (void *obj, StringTableEntry pFieldName)
static bool | writeClass (void *obj, StringTableEntry pFieldName)
static SimObject::Notify * | allocNotify ()
| Get a free Notify structure. More...
static void | freeNotify (SimObject::Notify *)
| Mark a Notify structure as free. More...
Static Protected Member Functions inherited from ConsoleObject
static void | addGroup (const char *in_pGroupname, const char *in_pGroupDocs=NULL)
static void | endGroup (const char *in_pGroupname)
static void | addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL)
static void | addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::WriteDataNotify in_writeDataFn, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL)
static void | addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, const char *in_pFieldDocs)
static void | addField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::WriteDataNotify in_writeDataFn, const char *in_pFieldDocs)
static void | addFieldV (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, ConsoleTypeValidator *v, const char *in_pFieldDocs=NULL)
static void | addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL)
static void | addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, AbstractClassRep::WriteDataNotify in_writeDataFn=&defaultProtectedWriteFn, const U32 in_elementCount=1, EnumTable *in_table=NULL, const char *in_pFieldDocs=NULL)
static void | addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, const char *in_pFieldDocs=NULL)
static void | addProtectedField (const char *in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, AbstractClassRep::SetDataNotify in_setDataFn, AbstractClassRep::GetDataNotify in_getDataFn=&defaultProtectedGetFn, AbstractClassRep::WriteDataNotify in_writeDataFn=&defaultProtectedWriteFn, const char *in_pFieldDocs=NULL)
static void | addDepricatedField (const char *fieldName)
static bool | removeField (const char *in_pFieldname)
Static Protected Attributes inherited from SimObject
static SimObject::Notify * | mNotifyFreeList = NULL

## Detailed Description

A set 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.

Using SimSets, the code to work with these two sets becomes relatively straightforward:

// (Example from netObject.cc)
// To iterate over all the objects in the Sim:
for (SimSetIterator obj(Sim::getRootGroup()); *obj; ++obj)
{
NetObject* nobj = dynamic_cast<NetObject*>(*obj);
if (nobj)
{
// ... do things ...
}
}
// (Example from netGhost.cc)
// To iterate over the ghostAlways set.
SimSet* ghostAlwaysSet = Sim::getGhostAlwaysSet();
SimSet::iterator i;
U32 sz = ghostAlwaysSet->size();
S32 j;
for(i = ghostAlwaysSet->begin(); i != ghostAlwaysSet->end(); i++)
{
NetObject *obj = (NetObject *)(*i);
}

## Member Typedef Documentation

typedef SimObjectList::iterator iterator

typedef SimObjectList::value_type value

## Constructor & Destructor Documentation

SimSet | ( |  | ) |
| inline

~SimSet | ( |  | ) |
| inline

## Member Function Documentation

void _setVectorAssoc | ( | const char * | file,
|  | const U32 | line
| ) |  |
| inline

void addObject | ( | SimObject * | obj | ) |
| virtual

Add an object to the set.

Reimplemented in GuiControl, SimGroup, GuiScrollCtrl, GuiFrameSetCtrl, GuiFormCtrl, GuiRolloutCtrl, GuiStackControl, GuiDynamicCtrlArrayControl, and GuiGridControl.

virtual void addTamlChild | ( | SimObject * | pSimObject | ) |
| inline virtual

Called when Taml attempts to populate an objects children during a read.

Implements TamlChildren.

SimObject* at | ( | S32 | index | ) | const
| inline

iterator begin | ( |  | ) |
| inline

void bringObjectToFront | ( | SimObject * | obj | ) |
| inline

void callOnChildren | ( | const char * | method,
|  | S32 | argc,
|  | const char * | argv[],
|  | bool | executeOnChildGroups = `true`
| ) |  |

void clear | ( |  | ) |

bool containsType | ( | void |  | ) |
| inline

DECLARE_CONOBJECT | ( | SimSet |  | ) |

void deleteObjects | ( | void |  | ) |

bool empty | ( |  | ) |
| inline

iterator end | ( | void |  | ) |
| inline

iterator find | ( | iterator | first,
|  | iterator | last,
|  | SimObject * | obj
| ) |  |
| inline

iterator find | ( | SimObject * | obj | ) |
| inline

SimObject * findObject | ( | const char * | name | ) |
| virtual

Find a named sub-object of this object.

This is subclassed in the SimGroup and SimSet classes.

For a single object, it just returns NULL, as normal objects cannot have children.

Reimplemented from SimObject.

Reimplemented in SimGroup.

SimObject * findObjectByInternalName | ( | const char * | internalName,
|  | bool | searchChildren = `false`
| ) |  |

SimObject* first | ( |  | ) |
| inline

SimObject* front | ( |  | ) |
| inline

virtual SimObject* getTamlChild | ( | const U32 | childIndex | ) | const
| inline virtual

Called when Taml attempts to compile a list of children.

Implements TamlChildren.

virtual U32 getTamlChildCount | ( | void |  | ) | const
| inline virtual

Called when Taml attempts to compile a list of children.

Implements TamlChildren.

SimObject* last | ( |  | ) |
| inline

void lock | ( |  | ) |
| inline

void onDeleteNotify | ( | SimObject * | object | ) |
| virtual

Called when a SimObject is deleted.

When you are on the notification list for another object and it is deleted, this method is called.

Reimplemented from SimObject.

Reimplemented in UInputManager.

void onRemove | ( |  | ) |
| virtual

Called when the object is removed from the sim.

Reimplemented from SimObject.

Reimplemented in NetConnection, GuiControl, SimGroup, GameConnection, SceneWindow, GuiTabBookCtrl, UInputManager, GuiEditCtrl, GuiTextListCtrl, and GuiMessageVectorCtrl.

value operator[] | ( | S32 | index | ) |
| inline

void popObject | ( |  | ) |
| virtual

Remove an object from the end of the list.

It will force the object to the end of the list if it already exists in the list.

void pushObject | ( | SimObject * | pObj | ) |
| virtual

Add object to end of list.

void pushObjectToBack | ( | SimObject * | obj | ) |
| inline

bool readObject | ( | Stream * | stream | ) |
| virtual

Reimplemented from SimObject.

void removeObject | ( | SimObject * | obj | ) |
| virtual

Remove an object from the set.

Reimplemented in SimGroup, GuiControl, GuiFrameSetCtrl, GuiRolloutCtrl, GuiStackControl, and GuiGridControl.

bool reOrder | ( | SimObject * | obj,
|  | SimObject * | target = `0`
| ) |  |
| virtual

Reimplemented in GuiStackControl.

S32 size | ( |  | ) | const
| inline

void unlock | ( |  | ) |
| inline

void write | ( | Stream & | stream,
|  | U32 | tabStop,
|  | U32 | flags = `0`
| ) |  |
| virtual

Output the TorqueScript to recreate this object.

This calls writeFields internally.

Parameters

  stream | Stream to output to.
  tabStop | Indentation level for this object.
  flags | If SelectedOnly is passed here, then only objects marked as selected (using setSelected) will output themselves.

Reimplemented from SimObject.

Reimplemented in GuiControl, and NameTags.

bool writeObject | ( | Stream * | stream | ) |
| virtual

Reimplemented from SimObject.

## Member Data Documentation

void* mMutex
| protected

SimObjectList objectList
| protected

The documentation for this class was generated from the following files:

- sim/simSet.h
- sim/simSerialize.cpp
- sim/simSet.cc