Ultimate parent class for all objects in the class library.
![]() | Run Time Type functions |
![]() | Comparison functions |
![]() | I/O functions |
![]() | Miscellaneous functions |
![]() | PObject () Constructor for PObject, make protected so cannot ever create one on its own |
Ultimate parent class for all objects in the class library. This provides functionality provided to all classes, eg run-time types, default comparison operations, simple stream I/O and serialisation support.
When comparing class names, always use the strcmp()
function rather than comparing pointers. The pointers are not
necessarily the same over compilation units depending on the compiler,
platform etc. The PCLASSINFO macro declares a version of this function for the
particular class.
When comparing class names, always use the strcmp()
function rather than comparing pointers. The pointers are not
necessarily the same over compilation units depending on the compiler,
platform etc. The PCLASSINFO macro declares an override of this function for
the particular class. The user need not implement it.
The PCLASSINFO macro declares an override of this function for
the particular class. The user need not implement it.
The PCLASSINFO macro declares an override of this function for
the particular class. The user need not implement it.
The default function is to use the CompareObjectMemoryDirect()
function to do a byte wise memory comparison of the two objects.
The PCLASSINFO macro declares an override of this function for
the particular class. The user need not implement it.
The default behaviour is to print the class name.
The default behaviour is to do nothing.
This in only required by the PBinarySerialiser class which
serialises the objects into a binary file. The PTextSerialiser
class which serialises into a text stream does not use this function. Note serialisation requires the use of the PDECLARE_SERIAL and
PIMPLEMENT_SERIAL macros.
When the user implements this function they will usually be doing it for
one of either the text of binary output versions. In some circumstances,
eg libraries, both need be supported so the IsDscendent()
function should be used on the strm parameter to determine
whether it is a PBinarySerialiser class or a
PTextSerialiser class and do the appropriate output. To a large extent, if only the << operator is used on the
PSerialiser instance, the text and binary version can be made
identical.
When the user implements this function they will usually be doing it for
one of either the text of binary input versions. In some circumstances,
eg libraries, both need be supported so the IsDscendent()
function should be used on the strm parameter to determine
whether it is a PBinarySerialiser class or a
PTextSerialiser class and do the appropriate input. To a large extent, if only the >> operator is used on the
PUnSerialiser instance, the text and binary version can be made
identical.
The main user of the clone function is the PDictionary class as
it requires copies of the dictionary keys. The default behaviour is for this function to assert.
The default behaviour is to return the value zero.
Run Time Type functions
static const char* Class()
virtual const char* GetClass( unsigned ancestor = 0 ) const
virtual BOOL IsClass( const char * clsName ) const
virtual BOOL IsDescendant( const char * clsName ) const
Comparison functions
enum Comparison
virtual Comparison Compare( const PObject & obj ) const
virtual Comparison CompareObjectMemoryDirect( const PObject & obj ) const
BOOL operator==( const PObject & obj ) const
BOOL operator!=( const PObject & obj ) const
BOOL operator<( const PObject & obj ) const
BOOL operator>( const PObject & obj ) const
BOOL operator<=( const PObject & obj ) const
BOOL operator>=( const PObject & obj ) const
I/O functions
virtual void PrintOn( ostream &strm ) const
virtual void ReadFrom( istream &strm )
inline friend ostream& operator<<( ostream &strm, const PObject & obj )
inline friend istream& operator>>( istream &strm, PObject & obj )
virtual PINDEX PreSerialise( PSerialiser & strm )
virtual void Serialise( PSerialiser & strm )
virtual void UnSerialise( PUnSerialiser & strm )
Miscellaneous functions
virtual PObject* Clone() const
virtual PINDEX HashFunction() const
Alphabetic index HTML hierarchy of classes or Java