PTLib Version 2.12.9

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | List of all members
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 >:
[legend]
Collaboration diagram for PKey< T >:
[legend]

## 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 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...
Public Member Functions inherited from PObject
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 Public Member Functions inherited from PObject
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)
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
Friends inherited from PObject

## 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

  newKey | Ordinal index value to use as a key.

Referenced by PKey< T >::Clone().

## Member Function Documentation

template<typename T >

virtual PObject* PKey< T >::Clone | ( |  | ) | const
| inline virtual

Create a duplicate of the PKey.

Reimplemented from PObject.

References PKey< T >::PKey().

template<typename T >

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

Returns
  `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.

template<typename T >

virtual PINDEX PKey< T >::HashFunction | ( |  | ) | const
| inline virtual

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
| inline virtual

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:

- dict.h