#include <oscl_exclusive_ptr.h>
Public Methods | |
OsclExclusiveArrayPtr (T *inPtr=0) | |
Default constructor Initializes the pointer and takes ownership. | |
OsclExclusiveArrayPtr (OsclExclusiveArrayPtr< T > &_Y) | |
Copy constructor. | |
OsclExclusiveArrayPtr< T > & | operator= (OsclExclusiveArrayPtr< T > &_Y) |
Assignment operator from an another OsclExclusiveArrayPtr. | |
virtual | ~OsclExclusiveArrayPtr () |
Destructor. | |
T & | operator * () const |
The indirection operator (*) accesses a value indirectly, through a pointer. | |
T * | operator-> () const |
The indirection operator (->) accesses a value indirectly, through a pointer. | |
T * | get () const |
get() method returns the pointer, currently owned by the class. | |
T * | release () |
release() method releases ownership of the pointer, currently owned by the class. It returns the pointer as well. | |
bool | set (T *ptr) |
set() method sets ownership to the pointer, passed. This method is needed when the class is created with a default constructor. Returns false in case the class is non-empty. | |
Protected Attributes | |
T * | _Ptr |
The purpose of this class is to provide a way to prevent accidental memory leaks in a class or a method, due to "not remembering to delete" variables allocated on the heap. Thus if you assign an address returned by new to an OsclExclusivePtr object, you don't have to remember to free the memory later, it will be freed automatically when the object goes out of scope. The OsclExclusivePtr is an example of a smart pointer, an object that acts like a pointer, but with additional features. The class is defined so that it acts like a regular pointer in most respects
|
Default constructor Initializes the pointer and takes ownership.
|
|
Copy constructor. Initializes the pointer and takes ownership from another OsclExclusiveArrayPtr. Note that the other class does NOT own the pointer any longer, and hence it is NOT its responsibility to free it. |
|
Destructor. The pointer is deleted in case this class still has ownership |
|
get() method returns the pointer, currently owned by the class.
|
|
The indirection operator (*) accesses a value indirectly, through a pointer. This operator ensures that the OsclExclusiveArrayPtr can be used like the regular pointer that it was initialized with. |
|
The indirection operator (->) accesses a value indirectly, through a pointer. This operator ensures that the OsclExclusiveArrayPtr can be used like the regular pointer that it was initialized with. |
|
Assignment operator from an another OsclExclusiveArrayPtr.
|
|
release() method releases ownership of the pointer, currently owned by the class. It returns the pointer as well.
|
|
set() method sets ownership to the pointer, passed. This method is needed when the class is created with a default constructor. Returns false in case the class is non-empty.
|
|
|