PTLib
Version 2.18.8
|
This class defines a thread-safe sorted array of objects. More...
#include <safecoll.h>
Public Types | |
typedef PSafePtr< Base > | value_type |
![]() | |
enum | Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 } |
Result of the comparison operation performed by the Compare() function. More... | |
Additional Inherited Members | |
![]() | |
PSafeColl () | |
Create a safe list collection wrapper around the real collection. More... | |
PSafeColl (const PSafeColl &other) | |
Copy constructor for safe collection. More... | |
PSafeColl & | operator= (const PSafeColl &other) |
Assign one safe collection to another. More... | |
virtual PSafePtr< Base > | Append (Base *obj, PSafetyMode mode=PSafeReference) |
Add an object to the collection. More... | |
virtual PBoolean | Remove (Base *obj) |
Remove an object to the collection. More... | |
virtual PBoolean | RemoveAt (PINDEX idx) |
Remove an object to the collection. More... | |
virtual PSafePtr< Base > | GetAt (PINDEX idx, PSafetyMode mode=PSafeReadWrite) |
Get the instance in the collection of the index. More... | |
virtual PSafePtr< Base > | FindWithLock (const Base &value, PSafetyMode mode=PSafeReadWrite) |
Find the instance in the collection of an object with the same value. More... | |
![]() | |
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... | |
PMutex & | GetMutex () |
![]() | |
__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 |
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 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... | |
![]() | |
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... | |
![]() | |
void | CopySafeCollection (PCollection *other) |
void | CopySafeDictionary (PAbstractDictionary *other) |
bool | SafeAddObject (PSafeObject *obj, PSafeObject *old) |
void | SafeRemoveObject (PSafeObject *obj) |
virtual PBoolean | SafeRemove (PSafeObject *obj) |
Remove an object to the collection. More... | |
virtual PBoolean | SafeRemoveAt (PINDEX idx) |
Remove an object to the collection. More... | |
![]() | |
PObject () | |
Constructor for PObject, made protected so cannot ever create one on its own. More... | |
![]() | |
PCollection * | m_collection |
PMutex | m_collectionMutex |
bool | m_deleteObjects |
PList< PSafeObject > | m_toBeRemoved |
PMutex | m_removalMutex |
![]() | |
unsigned | m_traceContextIdentifier |
This class defines a thread-safe sorted array of objects.
See the PSafeObject class for more details. Especially in regard to enumeration of collections.
typedef PSafePtr<Base> PSafeSortedList< Base >::value_type |