decaf::lang::ArrayPointer< T > Class Template Reference
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.
More...
#include <src/main/decaf/lang/ArrayPointer.h>
Detailed Description
template<typename T>
class decaf::lang::ArrayPointer< T >
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
Member Typedef Documentation
Constructor & Destructor Documentation
Create a new ArrayPointer instance and allocates an internal array that is sized using the passed in size value.
- Parameters:
-
| size | The size of the array to allocate for this ArrayPointer instance. |
Create a new ArrayPointer instance and allocates an internal array that is sized using the passed in size value.
The array elements are initialized with the given value.
- Parameters:
-
| size | The size of the array to allocate for this ArrayPointer instance. |
| fillWith | The value to initialize each element of the newly allocated array with. |
Explicit Constructor, creates an ArrayPointer that contains value with a single reference.
This object now has ownership until a call to release.
- Parameters:
-
| value | The pointer to the instance of the array we are taking ownership of. |
| size | The size of the array this object is taking ownership of. |
Copy constructor.
Copies the value contained in the ArrayPointer to the new instance and increments the reference counter.
Member Function Documentation
Returns the current size of the contained array or zero if the array is NULL.
- Returns:
- the size of the array or zero if the array is NULL
Referenced by decaf::util::HashMap< E, Set< E > *, HASHCODE >::clear(), decaf::util::HashMap< E, Set< E > *, HASHCODE >::containsValue(), decaf::util::HashMap< E, Set< E > *, HASHCODE >::copy(), decaf::util::HashMap< E, Set< E > *, HASHCODE >::getEntry(), decaf::util::HashMap< E, Set< E > *, HASHCODE >::putImpl(), decaf::util::HashMap< E, Set< E > *, HASHCODE >::rehash(), decaf::util::HashMap< E, Set< E > *, HASHCODE >::removeEntry(), and decaf::util::HashMap< E, Set< E > *, HASHCODE >::~HashMap().
template<typename T>
template<typename T1 >
template<typename T>
template<typename T1 >
Assigns the value of right to this Pointer and increments the reference Count.
- Parameters:
-
| right | - Pointer on the right hand side of an operator= call to this. |
template<typename T>
template<typename T1 >
Dereference Operator, returns a reference to the Contained value.
This method throws an NullPointerException if the contained value is NULL.
- Returns:
- reference to the contained pointer.
- Exceptions:
-
| NullPointerException | if the contained value is Null |
Releases the Pointer held and resets the internal pointer value to Null.
This method is not guaranteed to be safe if the Pointer is held by more than one object or this method is called from more than one thread.
- Parameters:
-
| value | - The new value to contain. |
- Returns:
- The pointer instance that was held by this Pointer object, the pointer is no longer owned by this Pointer and won't be freed when this Pointer goes out of scope.
Resets the ArrayPointer 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 array pointer value to contain. |
| size | The size of the new array value this object now contains. |
Friends And Related Function Documentation
template<typename T>
| bool operator!= |
( |
const T * |
left, |
|
|
const ArrayPointer< T > & |
right | |
|
) |
| | [friend] |
template<typename T>
| bool operator!= |
( |
const ArrayPointer< T > & |
left, |
|
|
const T * |
right | |
|
) |
| | [friend] |
template<typename T>
| bool operator== |
( |
const T * |
left, |
|
|
const ArrayPointer< T > & |
right | |
|
) |
| | [friend] |
template<typename T>
| bool operator== |
( |
const ArrayPointer< T > & |
left, |
|
|
const T * |
right | |
|
) |
| | [friend] |
The documentation for this class was generated from the following file: