class PObject

Ultimate parent class for all objects in the class library.

Inheritance:


Public Methods

[more] Run Time Type functions
[more] I/O functions

Public Members

[more] Comparison functions

Protected Methods

[more] PObject ()
Constructor for PObject, make protected so cannot ever create one on its own


Documentation

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.
o PObject()
Constructor for PObject, make protected so cannot ever create one on its own

o Run Time Type functions

ostatic const char* Class()
Get the name of the class as a C string. This is a static function which returns the type of a specific class. It is primarily used as an argument to the IsClass() or IsDescendant() functions.

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.

Returns:
pointer to C string literal.

ovirtual const char* GetClass( unsigned ancestor = 0 ) const
Get the current dynamic type of the object instance.

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.

Parameters:
ancestor - Level of ancestor to get the class name for. A value of zero is the instances class name, one is its ancestor, two for the ancestors ancestor etc.
Returns:
pointer to C string literal.

ovirtual BOOL IsClass( const char* clsName ) const
Determine if the dynamic type of the current instance is of the specified class. The class name is usually provided by the Class() static function of the desired class.

The PCLASSINFO macro declares an override of this function for the particular class. The user need not implement it.

Returns:
TRUE if object is of the class.

ovirtual BOOL IsDescendant( const char* clsName ) const
Determine if the dynamic type of the current instance is a descendent of the specified class. The class name is usually provided by the Class() static function of the desired class.

The PCLASSINFO macro declares an override of this function for the particular class. The user need not implement it.

Returns:
TRUE if object is descended from the class.

o Comparison functions

oenum Comparison
Result of the comparison operation performed by the Compare() function

ovirtual Comparison Compare( const PObject & obj ) const
Compare the two objects and return their relative rank. This function is usually overridden by descendent classes to yield the ranking according to the semantics of the object.

The default function is to use the CompareObjectMemoryDirect() function to do a byte wise memory comparison of the two objects.

Returns:
LessThan, EqualTo or GreaterThan according to the relative rank of the objects.

ovirtual Comparison CompareObjectMemoryDirect( const PObject & obj ) const
Determine the byte wise comparison of two objects. This is the default comparison operation for objects that do not explicitly override the Compare() function.

The PCLASSINFO macro declares an override of this function for the particular class. The user need not implement it.

Returns:
LessThan, EqualTo or GreaterThan according to the result memcpy() function.

oBOOL operator==( const PObject & obj ) const
Compare the two objects.

Returns:
TRUE if objects are equal.

oBOOL operator!=( const PObject & obj ) const
Compare the two objects.

Returns:
TRUE if objects are not equal.

oBOOL operator<( const PObject & obj ) const
Compare the two objects.

Returns:
TRUE if objects are less than.

oBOOL operator>( const PObject & obj ) const
Compare the two objects.

Returns:
TRUE if objects are greater than.

oBOOL operator<=( const PObject & obj ) const
Compare the two objects.

Returns:
TRUE if objects are less than or equal.

oBOOL operator>=( const PObject & obj ) const
Compare the two objects.

Returns:
TRUE if objects are greater than or equal.

o I/O functions
Friends:
ostream & operator<<(
istream & operator>>(

ovirtual void PrintOn( ostream &strm ) const
Output the contents of the object to the stream. The exact output is dependent on the exact semantics of the descendent class. This is primarily used by the standard operator<< function.

The default behaviour is to print the class name.

ovirtual void ReadFrom( istream &strm )
Input the contents of the object from the stream. The exact input is dependent on the exact semantics of the descendent class. This is primarily used by the standard operator>> function.

The default behaviour is to do nothing.

oostream& strm

oistream& strm

o Miscellaneous functions

ovirtual PObject* Clone() const
Create a copy of the class on the heap. The exact semantics of the descendent class determine what is required to make a duplicate of the instance. Not all classes can even do a clone operation.

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.

Returns:
pointer to new copy of the class instance.

ovirtual PINDEX HashFunction() const
This function yields a hash value required by the PDictionary class. A descendent class that is required to be the key of a dictionary should override this function. The precise values returned is dependent on the semantics of the class. For example, the PString class overrides it to provide a hash function for distinguishing text strings.

The default behaviour is to return the value zero.

Returns:
hash function value for class instance.


Direct child classes:
PSSLPrivateKey
PSSLDiffieHellman
PSSLCertificate
PIpAccessControlEntry
PCypher
PBase64
PURL
PServiceMacro
PMultipartFormInfo
PHTTPResource
PHTTPRequest
PHTTPField
PHTTPConnectionInfo
PHTTPAuthority
PASN_Object
RouteEntry
InterfaceEntry
Address
PThread
PSystemLog
PSemaphore
PReadWriteMutex
PVideoDevice
PTimeInterval
PTime
PRemoteConnection
PMail
PDynaLink
PConfig
PArgList
PFileInfo
PColourConverter
PChannel
PRegularExpression
POrdinalKey
PContainer

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.