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

Object.h File Reference

Object class and related boilerplate macros. More...

#include <cstdio>
#include <cassert>
#include <string>
#include <SimData/HashUtility.h>
#include <SimData/BaseType.h>
#include <SimData/Export.h>
#include <SimData/Ref.h>

Go to the source code of this file.

Compounds

class  Object
 Base class for all classes representing packable data objects. More...


Defines

#define __SIMDATA_LEAKCHECK(a)
#define __SIMDATA_GETCLASSNAME(a)
#define __SIMDATA_GETCLASSVERSION(major, minor)
#define __SIMDATA_GETCLASSHASH(a, major)
#define __SIMDATA_ISSTATIC(static_)
#define __SIMDATA_CLASSDEF(a, major, minor)
#define __SIMDATA_NEW(a)   virtual SIMDATA(Object)* _new() const { return new a(); }
#define SIMDATA_OBJECT(a, major, minor)
 Declare a SimData Object subclass.

#define SIMDATA_STATIC_OBJECT(a, major, minor)
 Declare a SimData Object static subclass.

#define SIMDATA_REGISTER(a)   SIMDATA(ObjectProxy)<a> proxy##a;


Detailed Description

Object class and related boilerplate macros.


Define Documentation

#define __SIMDATA_CLASSDEF a,
major,
minor   
 

Value:

#define __SIMDATA_GETCLASSHASH a,
major   
 

Value:

static SIMDATA(hasht) _getClassHash() { \
                static SIMDATA(hasht) hash = 0; \
                if (hash == 0) hash = _getHash(#a ":" #major); \
                return hash; \
        } \
        virtual SIMDATA(hasht) getClassHash() const { return _getClassHash(); }

#define __SIMDATA_GETCLASSNAME  
 

Value:

static const char* _getClassName() { return #a; } \
        virtual const char* getClassName() const { return _getClassName(); }

#define __SIMDATA_GETCLASSVERSION major,
minor   
 

Value:

static const char* _getClassVersion() { return #major "." #minor; } \
        virtual const char* getClassVersion() const { return _getClassVersion(); }

#define __SIMDATA_ISSTATIC static_   
 

Value:

static bool _isClassStatic() { return static_; } \
        static bool isClassStatic() { return _isClassStatic(); }

#define __SIMDATA_LEAKCHECK  
 

Value:

a() { printf(#a " %p\n", this); } \
        ~a() { printf("~" #a " %p\n", this); }

#define __SIMDATA_NEW      virtual SIMDATA(Object)* _new() const { return new a(); }
 

#define SIMDATA_OBJECT a,
major,
minor   
 

Value:

__SIMDATA_CLASSDEF(a, major, minor) \
        __SIMDATA_ISSTATIC(false) \
        __SIMDATA_NEW(a)
Declare a SimData Object subclass.

This macro adds standard boilerplate code to object classes. The first parameter is the object class, while the second and third are major and minor version numbers. The class name and version numbers are used to test binary compatibility during object deserialization. This version of the macro declares a non-static object, meaning that new instances will be created each time a particular object of this class is loaded from an archive. To share one instance, see SIMDATA_STATIC_OBJECT.

#define SIMDATA_REGISTER      SIMDATA(ObjectProxy)<a> proxy##a;
 

#define SIMDATA_STATIC_OBJECT a,
major,
minor   
 

Value:

Declare a SimData Object static subclass.

This macro is similar to SIMDATA_OBJECT, but declares this object class to be "static". Static object classes are cached by the archive loader, so that at most one instance of the object exists. Multiple attempts to load a static object from an archive will result in references pointing to a shared object instance. This is particularly useful for object classes that do not contain dynamic data.


SimData version pre-0.4.0. For more information on SimData, visit the SimData Homepage.

Generated on Tue Oct 14 12:06:40 2003, using Doxygen 1.2.18.

[SF.net]