PTLib
Version 2.18.8
|
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... | |
![]() | |
__inline unsigned | GetTraceContextIdentifier () const |
Get PTRACE context identifier. More... | |
__inline void | SetTraceContextIdentifier (unsigned id) |
__inline void | SetTraceContextIdentifier (const PObject &obj) |
__inline void | SetTraceContextIdentifier (const PObject *obj) |
__inline void | CopyTraceContextIdentifier (PObject &obj) const |
__inline void | CopyTraceContextIdentifier (PObject *obj) const |
virtual | ~PObject () |
__inline const char * | GetClass () const |
__inline bool | IsClass (const char *name) const |
__inline const PObject * | PTraceObjectInstance () const |
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 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 __inline void | CopyTraceContextIdentifier (PObject &to, const PObject &from) |
static __inline void | CopyTraceContextIdentifier (PObject &to, const PObject *from) |
static __inline void | CopyTraceContextIdentifier (PObject *to, const PObject &from) |
static __inline void | CopyTraceContextIdentifier (PObject *to, const PObject *from) |
static __inline const char * | Class () |
static __inline const PObject * | PTraceObjectInstance (const char *) |
static __inline const PObject * | PTraceObjectInstance (const PObject *obj) |
template<typename T > | |
static Comparison | Compare2 (T v1, T v2) |
Compare two types, returning Comparison type. More... | |
static Comparison | InternalCompareObjectMemoryDirect (const PObject *obj1, const PObject *obj2, PINDEX size) |
Internal function caled from CompareObjectMemoryDirect() More... | |
![]() | |
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. |
|
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::Compare2().
|
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.