GPL_Object
GPL_Object
gpl
1998 12-05
CLASS
GPL_Object - C++ base object
SYNOPSIS
GPL_Object provides the base type functionality for all objects.
MEMBER FUNCTIONS
virtual const GPL_ClassId GetClassId (void) const
Return the numeric identifier for this class. Derived classes should
provide their own version of this method.
virtual const char * GetClassName (void) const
Return the string identifier for this class. Derived classes should
provide their own version of this method.
virtual GPL_Object * NewInstance (void) const
Return a new instance of this class with the default values. Derived
class should provide their own version of this method.
virtual GPL_Object * Clone (void) const
Return a new instance of this class with the values of this instance.
Derived class should provide their own version of this method.
static const GPL_ClassId GetClassIdStatic (void)
Return the numeric identifier for this class.
static const char * GetClassNameStatic (void)
Return the string identifier for this class.
MACROS
GPL_OBJECT_ABSTRACT_INTERFACE(className)
Provide the declaration
part of an abstract derived class, className. This should be in the
class declaration for every abstract class derived, however remotely,
from GPL_Object.
GPL_OBJECT_INTERFACE(className)
Provide the declaration part of a derived class, className. This
should be in the class declaration for every class derived, however
remotely, from GPL_Object.
GPL_OBJECT_IMPLEMENTATION(className, id, name)
Provide the definition part of a derived class, className.
Specifically, this macro provides bodies for the four virtual member
functions of GPL_Object and manages the entry for this class in the
object factory, GPL_ObjectFactory. id is the numeric
identifier by which className will be known outside the source
code. Great care must be taken to ensure that two classes do not use
the same value for id. name is the name by which className
will be known outside the source code. While name can be an alias
(e.g., differ from className), it is not recommended. Coral
reserves some blocks of numeric class identifiers for internal use as
follows:
0x40000000 to 0x4000FFFFReserved for GPL
0x40010000 to 0x4001FFFFReserved for WBA
0x40020000 to 0x4002FFFFReserved for SPA
0x40030000 to 0x4003FFFFReserved for BLD
0x40040000 to 0x4004FFFFReserved for EW
0x40050000 to 0x4005FFFFReserved for WDS
0x40060000 to 0x4006FFFFReserved for SUI
0x40070000 to 0x4007FFFFReserved for DNA
0x40080000 to 0x4008FFFFReserved for LM
0x40090000 to 0x4009FFFFReserved for KM/KMD
0x400A0000 to 0x400AFFFFReserved for DSS
0x400B0000 to 0x400BFFFFReserved for DSSX
0x400C0000 to 0x400CFFFFReserved for SDB
0x400D0000 to 0xFFFFFFFFReserved for future use
WARNING
Some linkers are overly aggressive in their optimization and will not
include an object file in the executable if none of the functions in
that file are used directly in the executable. Since the
GPL_OBJECT_IMPLEMENTATION macro causes GPL_ObjectFactory to
indirectly use the methods of a GPL_Object-derived class, these
linkers may discard the entire object file as part of optimization if
there is not another, explicit instance of that class. The most obvious
symptom of this is when GPL_ObjectFactory has no knowledge of a
class derived from GPL_Object and GPL_ObjectFactory::Create()
returns a null pointer. Putting a static, possibly unused, instance of
the class into the translation unit should solve the problem.
SEE ALSO
GPL_ObjectFactory(3)