PTLib
Version 2.14.3
|
This class is used when an ordinal index value is the key for PSet
and PDictionary
classes.
More...
#include <dict.h>
Public Types | |
typedef T | value_type |
typedef PKey< T > | my_type |
![]() | |
enum | Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 } |
Result of the comparison operation performed by the Compare() function. More... | |
Public Member Functions | |
Construction | |
PINLINE | PKey (value_type newKey=0) |
Create a new key for ordinal index values. More... | |
PINLINE PKey & | operator= (value_type newKey) |
Operator to assign the ordinal. More... | |
Overrides from class PObject | |
virtual PObject * | Clone () const |
Create a duplicate of the PKey. More... | |
virtual Comparison | Compare (const PObject &obj) const |
Compare the two objects and return their relative rank. More... | |
virtual PINDEX | HashFunction () const |
This function calculates a hash table index value for the implementation of PSet and PDictionary classes. More... | |
virtual void | PrintOn (ostream &strm) const |
Output the ordinal index to the specified stream. More... | |
New functions for class | |
PINLINE | operator value_type () const |
Operator so that a PKey can be used as a PINDEX value. More... | |
PINLINE value_type | operator++ () |
Operator to pre-increment the ordinal. More... | |
PINLINE value_type | operator++ (int) |
Operator to post-increment the ordinal. More... | |
PINLINE value_type | operator-- () |
Operator to pre-decrement the ordinal. More... | |
PINLINE value_type | operator-- (int) |
Operator to post-decrement the ordinal. More... | |
PINLINE PKey & | operator+= (value_type add) |
Operator to add the ordinal. More... | |
PINLINE PKey & | operator-= (value_type minus) |
Operator to subtract from the ordinal. More... | |
![]() | |
unsigned | GetTraceContextIdentifier () const |
Get PTRACE context identifier. More... | |
void | SetTraceContextIdentifier (unsigned id) |
void | GetTraceContextIdentifier (PObject &obj) |
void | GetTraceContextIdentifier (PObject *obj) |
void | SetTraceContextIdentifier (const PObject &obj) |
void | SetTraceContextIdentifier (const PObject *obj) |
virtual | ~PObject () |
template<class CLS > | |
CLS * | CloneAs () const |
As for Clone() but converts to specified type. More... | |
virtual Comparison | CompareObjectMemoryDirect (const PObject &obj) const |
Determine the byte wise comparison of two objects. More... | |
bool | operator== (const PObject &obj) const |
Compare the two objects. More... | |
bool | operator!= (const PObject &obj) const |
Compare the two objects. More... | |
bool | operator< (const PObject &obj) const |
Compare the two objects. More... | |
bool | operator> (const PObject &obj) const |
Compare the two objects. More... | |
bool | operator<= (const PObject &obj) const |
Compare the two objects. More... | |
bool | operator>= (const PObject &obj) const |
Compare the two objects. More... | |
virtual const char * | GetClass (unsigned ancestor=0) const |
Get the current dynamic type of the object instance. More... | |
PBoolean | IsClass (const char *cls) const |
virtual PBoolean | InternalIsDescendant (const char *clsName) const |
Determine if the dynamic type of the current instance is a descendent of the specified class. More... | |
__inline const PObject * | PTraceObjectInstance () const |
virtual void | PrintOn (ostream &strm) const |
Output the contents of the object to the stream. More... | |
virtual void | ReadFrom (istream &strm) |
Input the contents of the object from the stream. More... | |
Additional Inherited Members | |
![]() | |
static Comparison | InternalCompareObjectMemoryDirect (const PObject *obj1, const PObject *obj2, PINDEX size) |
Internal function caled from CompareObjectMemoryDirect() More... | |
static const char * | Class () |
Get the name of the class as a C string. More... | |
static __inline const PObject * | PTraceObjectInstance (const char *) |
static __inline const PObject * | PTraceObjectInstance (const PObject *obj) |
![]() | |
PObject () | |
Constructor for PObject, made protected so cannot ever create one on its own. More... | |
![]() | |
unsigned | m_traceContextIdentifier |
![]() |
This class is used when an ordinal index value is the key for PSet
and PDictionary
classes.
typedef T PKey< T >::value_type |
|
inline |
Create a new key for ordinal index values.
newKey | Ordinal index value to use as a key. |
Referenced by PKey< T >::Clone().
|
inlinevirtual |
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.
LessThan
, EqualTo
or GreaterThan
according to the relative rank of the objects. Reimplemented from PObject.
References PObject::EqualTo, PObject::GreaterThan, PObject::LessThan, PAssert, and PInvalidCast.
|
inlinevirtual |
This function calculates a hash table index value for the implementation of PSet
and PDictionary
classes.
Reimplemented from PObject.
|
inline |
Operator so that a PKey can be used as a PINDEX value.
|
inline |
Operator to pre-increment the ordinal.
|
inline |
Operator to post-increment the ordinal.
|
inline |
Operator to add the ordinal.
|
inline |
Operator to pre-decrement the ordinal.
|
inline |
Operator to post-decrement the ordinal.
|
inline |
Operator to subtract from the ordinal.
|
inline |
Operator to assign the ordinal.
|
inlinevirtual |
Output the ordinal index to the specified stream.
This is identical to outputting the PINDEX, i.e. integer, value.