ARC SDK
Public Member Functions
Arc::ThreadedPointer< T > Class Template Reference

Wrapper for pointer with automatic destruction and multiple references. More...

#include <arc/Thread.h>

Public Member Functions

T & operator* (void) const
 For referring to wrapped object.
 
T * operator-> (void) const
 For referring to wrapped object.
 
 operator bool (void) const
 Returns false if pointer is NULL and true otherwise.
 
bool operator! (void) const
 Returns true if pointer is NULL and false otherwise.
 
bool operator== (const ThreadedPointer &p) const
 Returns true if pointers are equal.
 
bool operator!= (const ThreadedPointer &p) const
 Returns true if pointers are not equal.
 
bool operator< (const ThreadedPointer &p) const
 Comparison operator.
 
T * Ptr (void) const
 Cast to original pointer.
 
T * Release (void)
 Release referred object so that it can be passed to other container. More...
 
unsigned int Holders (void)
 Returns number of ThreadedPointer instances referring to underlying object.
 
unsigned int WaitOutRange (unsigned int minThr, unsigned int maxThr)
 Waits till number of ThreadedPointer instances <= minThr or >= maxThr.
 
unsigned int WaitOutRange (unsigned int minThr, unsigned int maxThr, int timeout)
 Waits till number of ThreadedPointer instances <= minThr or >= maxThr. More...
 
unsigned int WaitInRange (unsigned int minThr, unsigned int maxThr)
 Waits till number of ThreadedPointer instances >= minThr and <= maxThr.
 
unsigned int WaitInRange (unsigned int minThr, unsigned int maxThr, int timeout)
 Waits till number of ThreadedPointer instances >= minThr and <= maxThr. More...
 

Detailed Description

template<typename T>
class Arc::ThreadedPointer< T >

Wrapper for pointer with automatic destruction and multiple references.

See for CountedPointer for description. Differently from CountedPointer this class provides thread safe destruction of referred object. But the instance of ThreadedPointer itself is not thread safe. Hence it is advisable to use different instances in different threads.

Member Function Documentation

template<typename T>
T* Arc::ThreadedPointer< T >::Release ( void  )
inline

Release referred object so that it can be passed to other container.

After Release() is called referred object is will not be destroyed automatically anymore.

template<typename T>
unsigned int Arc::ThreadedPointer< T >::WaitInRange ( unsigned int  minThr,
unsigned int  maxThr,
int  timeout 
)
inline

Waits till number of ThreadedPointer instances >= minThr and <= maxThr.

Waits no longer than timeout milliseconds. If timeout is negative - wait forever. Returns current number of instances.

template<typename T>
unsigned int Arc::ThreadedPointer< T >::WaitOutRange ( unsigned int  minThr,
unsigned int  maxThr,
int  timeout 
)
inline

Waits till number of ThreadedPointer instances <= minThr or >= maxThr.

Waits no longer than timeout milliseconds. If timeout is negative - wait forever. Returns current number of instances.


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