Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

TNL::Object Class Reference

Base class for all NetObject, NetEvent, NetConnection and NetInterface instances. More...

#include <tnlNetBase.h>

Inheritance diagram for TNL::Object:

TNL::Journal TNL::NetConnection TNL::NetEvent TNL::NetInterface TNL::NetObject TNL::SymmetricCipher TNL::Thread TNL::ThreadQueue List of all members.

Object Creation

These helper functions let you create an instance of a class by name or ID.

Note:
Call these instead of NetClassRep::create


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 NetClassRepgetClassRep () 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.


Detailed Description

Base class for all NetObject, NetEvent, NetConnection and NetInterface instances.

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.

See also:
NetClassRepInstance for gory implementation details.

Definition at line 387 of file tnlNetBase.h.


Member Function Documentation

virtual void TNL::Object::destroySelf   [inline, virtual]
 

Object destroy self call (from RefPtr).

Note:
Override if this class has specially allocated memory.

Definition at line 404 of file tnlNetBase.h.


The documentation for this class was generated from the following files:
Generated on Thu Aug 18 16:03:39 2005 for Robin Hood: Thieves & Knights by doxygen1.2.18