|
| Pointer () |
| Default Constructor.
|
|
| Pointer (const PointerType value) |
| Explicit Constructor, creates a Pointer that contains value with a single reference.
|
|
| Pointer (const Pointer &value) |
| Copy constructor.
|
|
template<typename T1, typename R1> |
| Pointer (const Pointer< T1, R1 > &value) |
| Copy constructor.
|
|
template<typename T1, typename R1> |
| Pointer (const Pointer< T1, R1 > &value, const STATIC_CAST_TOKEN &) |
| Static Cast constructor.
|
|
template<typename T1, typename R1> |
| Pointer (const Pointer< T1, R1 > &value, const DYNAMIC_CAST_TOKEN &) |
| Dynamic Cast constructor.
|
|
virtual | ~Pointer () |
|
void | reset (T *value=NULL) |
| Resets the Pointer to hold the new value.
|
|
T * | release () |
| Releases the Pointer held and resets the internal pointer value to Null.
|
|
PointerType | get () const |
| Gets the real pointer that is contained within this Pointer.
|
|
void | swap (Pointer &value) |
| Exception Safe Swap Function.
|
|
Pointer & | operator= (const Pointer &right) |
| Assigns the value of right to this Pointer and increments the reference Count.
|
|
template<typename T1, typename R1> |
Pointer & | operator= (const Pointer< T1, R1 > &right) |
|
ReferenceType | operator* () |
| Dereference Operator, returns a reference to the Contained value.
|
|
ReferenceType | operator* () const |
|
PointerType | operator-> () |
| Indirection Operator, returns a pointer to the Contained value.
|
|
PointerType | operator-> () const |
|
bool | operator! () const |
|
template<typename T1, typename R1> |
bool | operator== (const Pointer< T1, R1 > &right) const |
|
template<typename T1, typename R1> |
bool | operator!= (const Pointer< T1, R1 > &right) const |
|
template<typename T1> |
Pointer< T1, CounterType > | dynamicCast () const |
|
template<typename T1> |
Pointer< T1, CounterType > | staticCast () const |
|
| AtomicRefCounter () |
|
| AtomicRefCounter (const AtomicRefCounter &other) |
|
virtual | ~AtomicRefCounter () |
|
template<typename T, typename REFCOUNTER = decaf::util::concurrent::atomic::AtomicRefCounter>
class decaf::lang::Pointer< T, REFCOUNTER >
Decaf's implementation of a Smart Pointer that is a template on a Type and is Thread Safe if the default Reference Counter is used.
This Pointer type allows for the substitution of different Reference Counter implementations which provide a means of using invasive reference counting if desired using a custom implementation of ReferenceCounter
.
The Decaf smart pointer provide comparison operators for comparing Pointer instances in the same manner as normal pointer, except that it does not provide an overload of operators ( <, <=, >, >= ). To allow use of a Pointer in a STL container that requires it, Pointer provides an implementation of std::less.
- Since
- 1.0
template<typename T, typename REFCOUNTER = decaf::util::concurrent::atomic::AtomicRefCounter>
Default Constructor.
Initialized the contained pointer to NULL, using the -> operator results in an exception unless reset to contain a real value.
References NULL.
Referenced by dynamicCast(), operator!=, operator!=(), operator!=, operator=(), operator=(), operator==, operator==(), operator==, Pointer(), Pointer(), Pointer(), Pointer(), reset(), staticCast(), and swap().
template<typename T, typename REFCOUNTER = decaf::util::concurrent::atomic::AtomicRefCounter>
template<typename T1, typename R1>
Copy constructor.
Copies the value contained in the pointer to the new instance and increments the reference counter.
- Parameters
-
value | A different but compatible Pointer instance that this Pointer will copy. |
References get(), and Pointer().
template<typename T, typename REFCOUNTER = decaf::util::concurrent::atomic::AtomicRefCounter>
template<typename T1, typename R1>
Static Cast constructor.
Copies the value contained in the pointer to the new instance and increments the reference counter performing a static cast on the value contained in the source Pointer object.
- Parameters
-
value | Pointer instance to cast to this type using a static_cast. |
References get(), and Pointer().
template<typename T, typename REFCOUNTER = decaf::util::concurrent::atomic::AtomicRefCounter>
template<typename T1, typename R1>
Dynamic Cast constructor.
Copies the value contained in the pointer to the new instance and increments the reference counter performing a dynamic cast on the value contained in the source Pointer object. If the cast fails and return NULL then this method throws a ClassCastException.
- Parameters
-
value | Pointer instance to cast to this type using a dynamic_cast. |
- Exceptions
-
ClassCastException | if the dynamic cast returns NULL |
References get(), NULL, and Pointer().
template<typename T, typename REFCOUNTER = decaf::util::concurrent::atomic::AtomicRefCounter>
Resets the Pointer to hold the new value.
Before the new value is stored reset checks if the old value should be destroyed and if so calls delete. Call reset with a value of NULL is supported and acts to set this Pointer to a NULL pointer.
- Parameters
-
value | The new value to contain or NULL to empty the pointer (default NULL if not set). |
References NULL, and Pointer().
Referenced by decaf::util::concurrent::CopyOnWriteArrayList< E >::CopyOnWriteArrayList(), decaf::util::concurrent::CopyOnWriteArrayList< E >::CopyOnWriteArrayList(), decaf::util::concurrent::CopyOnWriteArrayList< E >::CopyOnWriteArrayList(), decaf::util::concurrent::CopyOnWriteArrayList< E >::CopyOnWriteArrayList(), decaf::util::concurrent::ConcurrentStlMap< K, V, COMPARATOR >::entrySet(), decaf::util::concurrent::ConcurrentStlMap< K, V, COMPARATOR >::entrySet(), decaf::util::HashMap< K, V, HASHCODE >::entrySet(), decaf::util::HashMap< K, V, HASHCODE >::entrySet(), decaf::util::StlMap< K, V, COMPARATOR >::entrySet(), decaf::util::StlMap< K, V, COMPARATOR >::entrySet(), decaf::util::concurrent::FutureTask< T >::FutureTask(), decaf::util::concurrent::FutureTask< T >::FutureTask(), decaf::util::concurrent::ConcurrentStlMap< K, V, COMPARATOR >::keySet(), decaf::util::concurrent::ConcurrentStlMap< K, V, COMPARATOR >::keySet(), decaf::util::HashMap< K, V, HASHCODE >::keySet(), decaf::util::HashMap< K, V, HASHCODE >::keySet(), decaf::util::StlMap< K, V, COMPARATOR >::keySet(), decaf::util::StlMap< K, V, COMPARATOR >::keySet(), decaf::util::concurrent::LinkedBlockingQueue< E >::LinkedBlockingQueue(), decaf::util::concurrent::LinkedBlockingQueue< E >::LinkedBlockingQueue(), decaf::util::concurrent::LinkedBlockingQueue< E >::LinkedBlockingQueue(), decaf::util::concurrent::CopyOnWriteArrayList< E >::removeAll(), decaf::util::concurrent::CopyOnWriteArrayList< E >::removeAt(), decaf::util::concurrent::CopyOnWriteArrayList< E >::retainAll(), decaf::util::concurrent::ConcurrentStlMap< K, V, COMPARATOR >::values(), decaf::util::concurrent::ConcurrentStlMap< K, V, COMPARATOR >::values(), decaf::util::HashMap< K, V, HASHCODE >::values(), decaf::util::HashMap< K, V, HASHCODE >::values(), decaf::util::StlMap< K, V, COMPARATOR >::values(), decaf::util::StlMap< K, V, COMPARATOR >::values(), decaf::util::concurrent::CopyOnWriteArrayList< E >::ArrayListIterator::~ArrayListIterator(), and decaf::util::concurrent::CopyOnWriteArrayList< E >::~CopyOnWriteArrayList().