#include <tnlNetBase.h>
Inheritance diagram for TNL::Object:

Object Creation | |
| These helper functions let you create an instance of a class by name or ID.
| |
| void | incRef () |
| void | decRef () |
| Object * | create (const char *className) |
| static function to create an instance of a named class | |
| Object * | create (const NetClassGroup groupId, const NetClassType typeId, const U32 classId) |
| static function to create an instance of a class identified by a class group, class type and class id | |
Public Methods | |
| virtual NetClassRep * | getClassRep () const |
| Returns the NetClassRep associated with this object. | |
| virtual void | destroySelf () |
| Object destroy self call (from RefPtr). | |
| U32 | getClassId (NetClassGroup classGroup) const |
| Get our class ID within the specified NetClassGroup. | |
| const char * | getClassName () const |
| Get our unmangled class name. | |
Ways of Referencing Object
Object supports both reference counting and safe pointers. Ref counted objects are accessed via the RefPtr template class. Once an object has been assigned using a RefPtr, it will be deleted when all the reference pointers to it are destructed. Object instances can also be safely referenced with the SafePtr template. The SafePtr template instances are automatically set NULL when the object they point to is deleted.
The Basics
Any object which you want to work with the networking system should derive from this, and access functionality through the static interface.
This class is always used with the TNL_DECLARE_CLASS and TNL_IMPLEMENT_CLASS macros.
// A very basic example object. It will do nothing! class TestObject : public NetObject { // Must provide a Parent typedef so the console system knows what we inherit from. typedef NetObject Parent; // This does a lot of menial declaration for you. TNL_DECLARE_CLASS(TestObject); }
// And the accordant implementation...
TNL_IMPLEMENT_CLASS(TestObject);
That's all you need to do to get a class registered with the TNL object system. At this point, you can instantiate it via TNL::Object::create, ghost it, and so forth.
Definition at line 387 of file tnlNetBase.h.
|
|
Object destroy self call (from RefPtr).
Definition at line 404 of file tnlNetBase.h. |
1.2.18