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
Classes | Public Types | List of all members
PSafeDictionary< K, D > Class Template Reference

This class defines a thread-safe array of objects. More...

`#include <safecoll.h>`

Inheritance diagram for PSafeDictionary< K, D >:
[legend]
Collaboration diagram for PSafeDictionary< K, D >:
[legend]

## Classes
class | const_iterator
class | iterator
class | iterator_base
class | iterator_pair

## Public Types
typedef K | key_type
typedef D | data_type
typedef PSafePtr< D > | value_type
typedef PSafeDictionary< K, D > | dict_type

## Public Member Functions
Iterators
iterator | begin ()
iterator | end ()
iterator | find (const K &key)
const_iterator | begin () const
const_iterator | end () const
const_iterator | find (const K &key) const
void | erase (const iterator &it)
void | erase (const const_iterator &it)
Public Member Functions inherited from PSafeDictionaryBase< PDictionary< K, D >, K, D >
| PSafeDictionaryBase ()
| Create a safe dictionary wrapper around the real collection. More...
| PSafeDictionaryBase (const PSafeDictionaryBase &other)
| Copy constructor for safe collection. More...
PSafeDictionaryBase & | operator= (const PSafeDictionaryBase &other)
| Assign one safe collection to another. More...
virtual void | SetAt (const K &key, D *obj)
| Add an object to the collection. More...
virtual PBoolean | RemoveAt (const K &key)
| Remove an object to the collection. More...
virtual PBoolean | Contains (const K &key)
| Determine of the dictionary contains an entry for the key. More...
virtual PSafePtr< D > | GetAt (PINDEX idx, PSafetyMode mode=PSafeReadWrite)
| Get the instance in the collection of the index. More...
virtual PSafePtr< D > | FindWithLock (const K &key, PSafetyMode mode=PSafeReadWrite) const
| Find the instance in the collection of an object with the same value. More...
PArray< K > | GetKeys () const
| Get an array containing all the keys for the dictionary. More...
Public Member Functions inherited from PSafeCollection
| PSafeCollection (PCollection *collection)
| Create a thread safe collection of objects. More...
| ~PSafeCollection ()
| Destroy the thread safe collection. More...
virtual void | PrintOn (ostream &strm) const
| Output the contents of the object to the stream. More...
virtual void | RemoveAll (PBoolean synchronous=false)
| Remove all objects in collection. More...
void | AllowDeleteObjects (PBoolean yes=true)
| Disallow the automatic delete any objects that have been removed. More...
void | DisallowDeleteObjects ()
| Disallow the automatic delete any objects that have been removed. More...
virtual PBoolean | DeleteObjectsToBeRemoved ()
| Delete any objects that have been removed. More...
virtual void | DeleteObject (PObject *object) const
| Delete an objects that has been removed. More...
virtual void | SetAutoDeleteObjects ()
| Start a timer to automatically call DeleteObjectsToBeRemoved(). More...
PINDEX | GetSize () const
| Get the current size of the collection. More...
PBoolean | IsEmpty () const
| Determine if the collection is empty. More...
const PMutex & | GetMutex () const
| Get the mutex for the collection. 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 ()
virtual PObject * | Clone () const
| Create a copy of the class on the heap. More...
template<class CLS >
CLS * | CloneAs () const
| As for Clone() but converts to specified type. More...
virtual PINDEX | HashFunction () const
| This function yields a hash value required by the `PDictionary` class. 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 Comparison | Compare (const PObject &obj) const
| Compare the two objects and return their relative rank. 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 | ReadFrom (istream &strm)
| Input the contents of the object from the stream. More...

## Additional Inherited Members
Static Public Member Functions inherited from PObject
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)
static Comparison | InternalCompareObjectMemoryDirect (const PObject *obj1, const PObject *obj2, PINDEX size)
| Internal function caled from CompareObjectMemoryDirect() More...
Protected Member Functions inherited from PSafeCollection
void | CopySafeCollection (PCollection *other)
void | CopySafeDictionary (PAbstractDictionary *other)
bool | SafeAddObject (PSafeObject *obj, PSafeObject *old)
void | SafeRemoveObject (PSafeObject *obj)
| PDECLARE_NOTIFIER (PTimer, PSafeCollection, DeleteObjectsTimeout)
virtual PBoolean | SafeRemove (PSafeObject *obj)
| Remove an object to the collection. More...
virtual PBoolean | SafeRemoveAt (PINDEX idx)
| Remove an object to the collection. More...
Protected Attributes inherited from PSafeCollection
PCollection * | collection
PMutex | collectionMutex
bool | deleteObjects
PList< PSafeObject > | toBeRemoved
PMutex | removalMutex
PTimer * | m_deleteObjectsTimer
Friends inherited from PObject

## Detailed Description

### template<class K, class D>
class PSafeDictionary< K, D >

This class defines a thread-safe array of objects.

See the PSafeObject class for more details. Especially in regard to enumeration of collections.

## Member Typedef Documentation

template<class K , class D >

typedef D PSafeDictionary< K, D >::data_type

template<class K , class D >

typedef PSafeDictionary<K, D> PSafeDictionary< K, D >::dict_type

template<class K , class D >

typedef K PSafeDictionary< K, D >::key_type

template<class K , class D >

typedef PSafePtr<D> PSafeDictionary< K, D >::value_type

## Member Function Documentation

template<class K , class D >

iterator PSafeDictionary< K, D >::begin | ( |  | ) |
| inline

template<class K , class D >

const_iterator PSafeDictionary< K, D >::begin | ( |  | ) | const
| inline

template<class K , class D >

iterator PSafeDictionary< K, D >::end | ( |  | ) |
| inline

template<class K , class D >

const_iterator PSafeDictionary< K, D >::end | ( |  | ) | const
| inline

template<class K , class D >

void PSafeDictionary< K, D >::erase | ( | const iterator & | it | ) |
| inline

References PSafeDictionary< K, D >::iterator_pair::first, and PSafeDictionaryBase< PDictionary< K, D >, K, D >::RemoveAt().

template<class K , class D >

void PSafeDictionary< K, D >::erase | ( | const const_iterator & | it | ) |
| inline

References PSafeDictionary< K, D >::iterator_pair::first, and PSafeDictionaryBase< PDictionary< K, D >, K, D >::RemoveAt().

template<class K , class D >

iterator PSafeDictionary< K, D >::find | ( | const K & | key | ) |
| inline

template<class K , class D >

const_iterator PSafeDictionary< K, D >::find | ( | const K & | key | ) | const
| inline

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

- safecoll.h