PWLib
1.10.10
|
#include <object.h>
Public Member Functions | |
virtual | ~PObject () |
Miscellaneous functions | |
virtual PObject * | Clone () const |
virtual PINDEX | HashFunction () const |
Protected Member Functions | |
PObject () | |
Run Time Type functions | |
virtual const char * | GetClass (unsigned=0) const |
BOOL | IsClass (const char *cls) const |
virtual BOOL | InternalIsDescendant (const char *clsName) const |
static const char * | Class () |
Comparison functions | |
enum | Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 } |
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) |
ostream & | operator<< (ostream &strm, const PObject &obj) |
istream & | operator>> (istream &strm, PObject &obj) |
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.
enum PObject::Comparison |
Result of the comparison operation performed by the Compare()# function.
PObject::PObject | ( | ) | [inline, protected] |
Constructor for PObject, make protected so cannot ever create one on its own.
virtual PObject::~PObject | ( | ) | [inline, virtual] |
static const char* PObject::Class | ( | ) | [inline, static] |
Get the name of the class as a C string. This is a static function which returns the type of a specific 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.
References PCLASSNAME.
Referenced by GetClass().
virtual PObject* PObject::Clone | ( | ) | const [virtual] |
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.
Reimplemented in PASN_Set, PASN_Sequence, PASN_BMPString, PASN_OctetString, PASN_BitString, PASNNull, PASN_ObjectId, PASNObjectID, PASN_Real, PASNGauge, PASNCounter, PASN_Enumeration, PASNTimeTicks, PASN_Integer, PASNIPAddress, PASN_Boolean, PASN_Null, PASNString, PSocksUDPSocket, PASNInteger, PSocks5Socket, PSocks4Socket, PTime, PASNObject, PTimeInterval, PTCPSocket, and POrdinalKey.
virtual Comparison PObject::Compare | ( | const PObject & | obj | ) | const [virtual] |
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.
Reimplemented in PASN_Array, PASN_Sequence, PASN_Choice, PAbstractSortedList, PASN_BMPString, PASN_ConstrainedString, PASN_OctetString, PASN_BitString, PSafePtrBase, PASN_ObjectId, PASN_Real, PServiceMacro, PASN_Enumeration, PProcess, PASN_Integer, PIPSocket::Address, PASN_Boolean, PASN_Null, PChannel, PFile, PHashTable, PAbstractArray, PTime, PPipeChannel, PAbstractList, PTimeInterval, POrdinalKey, PURL, PRemoteConnection, PHTTPField, PSmartPointer, PIpAccessControlEntry, PIndirectChannel, and PMemoryFile.
Referenced by operator!=(), operator<(), operator<=(), operator==(), operator>(), and operator>=().
virtual Comparison PObject::CompareObjectMemoryDirect | ( | const PObject & | obj | ) | const [virtual] |
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.
virtual const char* PObject::GetClass | ( | unsigned | = 0 | ) | const [inline, virtual] |
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.
References Class().
Referenced by IsClass().
virtual PINDEX PObject::HashFunction | ( | ) | const [virtual] |
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.
Reimplemented in PChannel, POrdinalKey, PURL, and PRemoteConnection.
virtual BOOL PObject::InternalIsDescendant | ( | const char * | clsName | ) | const [inline, virtual] |
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.
References IsClass().
BOOL PObject::IsClass | ( | const char * | cls | ) | const [inline] |
References GetClass().
Referenced by InternalIsDescendant().
bool PObject::operator!= | ( | const PObject & | obj | ) | const [inline] |
bool PObject::operator< | ( | const PObject & | obj | ) | const [inline] |
bool PObject::operator<= | ( | const PObject & | obj | ) | const [inline] |
Compare the two objects.
References Compare(), and GreaterThan.
bool PObject::operator== | ( | const PObject & | obj | ) | const [inline] |
bool PObject::operator> | ( | const PObject & | obj | ) | const [inline] |
Compare the two objects.
References Compare(), and GreaterThan.
bool PObject::operator>= | ( | const PObject & | obj | ) | const [inline] |
virtual void PObject::PrintOn | ( | ostream & | strm | ) | const [virtual] |
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.
Reimplemented in PASN_Array, PASN_Sequence, PASN_Choice, PIPSocket::InterfaceEntry, PAbstractDictionary, PASN_BMPString, PASN_ConstrainedString, PASN_OctetString, PCollection, PASNSequence, PASN_BitString, PASNNull, PASN_ObjectId, PASNObjectID, PASN_Real, PASN_Enumeration, PASNUnsignedInteger, PASN_Integer, PASN_Boolean, PASN_Null, PXMLRPCStructBase, PASNString, PXMLElement, PASNInteger, PXMLRPCArrayBase, PThread, PTime, PAbstractArray, PIntCondMutex, PXML, POrdinalKey, PTimeInterval, PURL, PArgList, PASNObject, PIpAccessControlEntry, and PSNMPVarBindingList.
virtual void PObject::ReadFrom | ( | istream & | strm | ) | [virtual] |
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.
Reimplemented in PTime, PAbstractArray, PTimeInterval, PURL, PArgList, and PIpAccessControlEntry.
ostream& operator<< | ( | ostream & | strm, |
const PObject & | obj | ||
) | [friend] |
istream& operator>> | ( | istream & | strm, |
PObject & | obj | ||
) | [friend] |
Global function for using the standard >> operator on objects descended from PObject. This simply calls the objects ReadFrom()# function.