Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

SG_IObject.h

Go to the documentation of this file.
00001 #ifndef __SG_IOBJECT
00002 #define __SG_IOBJECT
00003 
00006 #include <vector>
00007 class SG_Controller;
00008 
00009 typedef std::vector<SG_Controller*> SGControllerList;
00010 typedef void* (*SG_ReplicationNewCallback)(
00011         class SG_IObject* sgobject,
00012         void*   clientobj,
00013         void*   clientinfo
00014 );
00015 typedef void* (*SG_DestructionNewCallback)(
00016         class SG_IObject* sgobject,
00017         void*   clientobj,
00018         void*   clientinfo
00019 );
00020 
00021 struct  SG_Callbacks
00022 {
00023         SG_Callbacks(SG_ReplicationNewCallback repfunc=NULL,SG_DestructionNewCallback destructfunc=NULL) : m_replicafunc(repfunc),m_destructionfunc(destructfunc) {};
00024 
00025         SG_ReplicationNewCallback               m_replicafunc;
00026         SG_DestructionNewCallback       m_destructionfunc;
00027 };
00028 
00029 class SG_IObject {
00030 
00031         void*                                           m_SGclientObject;
00032         void*                                           m_SGclientInfo;
00033         //SG_ReplicationCallback                m_replicationfunc;
00034         SG_Callbacks                            m_callbacks;
00035 
00036 
00037 public:
00038         SG_IObject(void* clientobj,void* clientinfo,SG_Callbacks callbacks): m_SGclientObject(clientobj),m_SGclientInfo(clientinfo),m_callbacks(callbacks) {};
00039         virtual ~SG_IObject() {};
00040 
00041         void    SetSimulatedTime(double time);
00042         void    AddSGController(SG_Controller* cont);
00043         void    RemoveSGController(SG_Controller* cont);
00044         void    RemoveAllControllers() { m_SGcontrollers.clear(); }
00045         //const SGControllerList&       GetSGControllers();
00046         // needed for replication
00047         SGControllerList&       GetSGControllerList()

00048         { 
00049                 return m_SGcontrollers;
00050         }
00051         void*                   GetSGClientObject() {
00052                 return m_SGclientObject;
00053         }
00054         void    SetSGClientObject(void* clientObject)

00055         {
00056                 m_SGclientObject = clientObject;
00057         }
00058         virtual SG_IObject*     GetSGReplica();
00059         virtual void    ProcessSGReplica(SG_IObject* replica);
00060         virtual void    Destruct();
00061 
00062         static SG_Callbacks                     m_nocallbacks;
00063 protected:
00064         SGControllerList                m_SGcontrollers;
00065 };
00066 
00067 #endif //__SG_IOBJECT

Generated at Thu Feb 1 13:03:12 2001 for Ketsji Game Engine by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000