PTLib  Version 2.18.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PKey< T > Class Template Reference

This class is used when an ordinal index value is the key for PSet and PDictionary classes. More...

#include <dict.h>

Inheritance diagram for PKey< T >:
Collaboration diagram for PKey< T >:

Public Types

typedef T value_type
 
typedef PKey< T > my_type
 
- Public Types inherited from PObject
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 PKeyoperator= (value_type newKey)
 Operator to assign the ordinal. More...
 
Overrides from class PObject
virtual PObjectClone () 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 PKeyoperator+= (value_type add)
 Operator to add the ordinal. More...
 
PINLINE PKeyoperator-= (value_type minus)
 Operator to subtract from the ordinal. More...
 
- Public Member Functions inherited from PObject
__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 PObjectPTraceObjectInstance () 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 Public Member Functions inherited from PObject
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 PObjectPTraceObjectInstance (const char *)
 
static __inline const PObjectPTraceObjectInstance (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...
 
- Protected Member Functions inherited from PObject
 PObject ()
 Constructor for PObject, made protected so cannot ever create one on its own. More...
 
- Protected Attributes inherited from PObject
unsigned m_traceContextIdentifier
 

Detailed Description

template<typename T>
class PKey< T >

This class is used when an ordinal index value is the key for PSet and PDictionary classes.

Member Typedef Documentation

template<typename T >
typedef PKey<T> PKey< T >::my_type
template<typename T >
typedef T PKey< T >::value_type

Constructor & Destructor Documentation

template<typename T >
PINLINE PKey< T >::PKey ( value_type  newKey = 0)
inline

Create a new key for ordinal index values.

Parameters
newKeyOrdinal index value to use as a key.

Member Function Documentation

template<typename T >
virtual PObject* PKey< T >::Clone ( ) const
inlinevirtual

Create a duplicate of the PKey.

Reimplemented from PObject.

template<typename T >
virtual Comparison PKey< T >::Compare ( const PObject obj) const
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.

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

Reimplemented from PObject.

References PObject::Compare2().

template<typename T >
virtual PINDEX PKey< T >::HashFunction ( ) const
inlinevirtual

This function calculates a hash table index value for the implementation of PSet and PDictionary classes.

Returns
hash table bucket number.

Reimplemented from PObject.

template<typename T >
PINLINE PKey< T >::operator value_type ( ) const
inline

Operator so that a PKey can be used as a PINDEX value.

template<typename T >
PINLINE value_type PKey< T >::operator++ ( )
inline

Operator to pre-increment the ordinal.

template<typename T >
PINLINE value_type PKey< T >::operator++ ( int  )
inline

Operator to post-increment the ordinal.

template<typename T >
PINLINE PKey& PKey< T >::operator+= ( value_type  add)
inline

Operator to add the ordinal.

template<typename T >
PINLINE value_type PKey< T >::operator-- ( )
inline

Operator to pre-decrement the ordinal.

template<typename T >
PINLINE value_type PKey< T >::operator-- ( int  )
inline

Operator to post-decrement the ordinal.

template<typename T >
PINLINE PKey& PKey< T >::operator-= ( value_type  minus)
inline

Operator to subtract from the ordinal.

template<typename T >
PINLINE PKey& PKey< T >::operator= ( value_type  newKey)
inline

Operator to assign the ordinal.

template<typename T >
virtual void PKey< T >::PrintOn ( ostream &  strm) const
inlinevirtual

Output the ordinal index to the specified stream.

This is identical to outputting the PINDEX, i.e. integer, value.

Returns
stream that the index was output to.

The documentation for this class was generated from the following file: