Vault  4.1
Classes | Defines | Typedefs
vclassregistry.h File Reference
#include "vstring.h"

Go to the source code of this file.

Classes

class  VClassRegistry
 VClassRegistry provides a mechanism for instantiating objects dynamically at runtime based on class IDs. More...
class  VClassFactory
 VClassFactory is the abstract base class that you subclass to provide a method that instantiates a particular type of object. More...

Defines

#define DEFINE_CLASSFACTORY(classname, factoryname)
 DEFINE_CLASSFACTORY is a macro that you should use to define a VClassFactory subclass for a given class.
#define DECLARE_CLASSFACTORY(classname, factoryname)   factoryname factoryname::gFactory(#classname)
 DECLARE_CLASSFACTORY is a macro that lets you declare a VClassFactory subclass, typically in your implementation file.

Typedefs

typedef std::vector< const
VClassFactory * > 
VClassFactoryPtrVector
 A vector of pointers to VClassFactory objects.

Detailed Description

Definition in file vclassregistry.h.


Define Documentation

#define DEFINE_CLASSFACTORY (   classname,
  factoryname 
)
Value:
class factoryname : public VClassFactory { \
    public: \
 \
        static factoryname gFactory; \
 \
        factoryname(const VString& classID) \
            : VClassFactory(classID) \
            { \
            VClassRegistry::registry()->registerClass(this); \
        } \
 \
        virtual ~factoryname() {} \
 \
        virtual void* instantiateObject() const { return new classname(); } \
 \
}

DEFINE_CLASSFACTORY is a macro that you should use to define a VClassFactory subclass for a given class.

The definition of such a class is boilerplate, and this macro defines it correctly. Typically, you'll say something like:

Definition at line 212 of file vclassregistry.h.

#define DECLARE_CLASSFACTORY (   classname,
  factoryname 
)    factoryname factoryname::gFactory(#classname)

DECLARE_CLASSFACTORY is a macro that lets you declare a VClassFactory subclass, typically in your implementation file.

Typically, you'll say something like:

Definition at line 237 of file vclassregistry.h.


Copyright ©1997-2014 Trygve Isaacson. All rights reserved. This documentation was generated with Doxygen.