The SimObjectType Class




#ifdef DEBUG
 SimObjectType(char *from, FalconEntity *owner, FalconEntity* baseObj);
 SimObjectType* Copy(char *from, FalconEntity *owner);
#else
 SimObjectType(FalconEntity* baseObj);
 SimObjectType* Copy(void);
#endif

#ifdef SIMOBJ_REF_COUNT_DEBUG
 #define SIM_OBJ_REF_ARGS __LINE__, __FILE__
 void Reference( int line, char *file );
 void Release( int line, char *file );

 struct DebugRecord {
  int     line;
  char    file[256];
  int     refInc;
  struct DebugRecord *prev;
 } *refOps;
#else
 #define SIM_OBJ_REF_ARGS
 void Reference(void);
 void Release(void);
#endif

 FalconEntity* BaseData(void) { return baseData; };
 BOOL IsReferenced(void);

  private:
 ~SimObjectType();
 FalconEntity  *baseData;

  private:
 int     refCount;

 #ifdef DEBUG
 int     dbgIndex;
 #endif

  public:
 SimObjectLocalData *localData;

 SimObjectType  *next;
 SimObjectType  *prev;
 

#ifdef USE_SH_POOLS
   public:
      // Overload new/delete to use a SmartHeap fixed size pool
      void *operator new(size_t size) { ShiAssert( size == sizeof(SimObjectType) ); return MemAllocFS(pool); };
      void operator delete(void *mem) { if (mem) MemFreeFS(mem); };
      static void InitializeStorage() { pool = MemPoolInitFS( sizeof(SimObjectType), 1000, 0 ); };
      static void ReleaseStorage() { MemPoolFree( pool ); };
      static MEM_POOL pool;
#endif