#include <archon/util/memory.H>
Collaboration diagram for Archon::Utilities::Array< T >:
Public Member Functions | |
Array (T *p=0) | |
Create a Array from of a previously allocated array. | |
Array (size_t n) | |
Create a Array of a certain fixed number of elements. | |
Array (size_t n, T v) | |
Create a Array of a certain fixed number elements. | |
~Array () | |
const T * | get () const |
Return a pointer to the conventional array. | |
T * | get () |
T * | out () |
Dismount and return the conventional array. | |
void | reset (T *q=0) |
Dispose the previously managed conventional array and replace it with the passed conventional array. | |
void | reset (size_t n) |
Dispose the previously managed conventional array and replace it with a new one of the specified size. | |
void | reset (size_t n, T v) |
Dispose the previously managed conventional array and replace it with a new one of the specified size. | |
const T & | operator[] (int i) const |
Fetch a reference to the subscribed constant element. | |
T & | operator[] (int i) |
Fetch a reference to the subscribed mutable element. | |
operator bool () const | |
Test if any memory is currently owned by this object. |
Using this class instead of plain dynamically allocated arrays may greatly improve your applications resistance to memory leakage.
Definition at line 195 of file memory.H.
|
Create a Array from of a previously allocated array. This class assumes ownership of the passed memory. |
|
Create a Array of a certain fixed number of elements. If the element type is of class type the elements are default initialized, otherwise the elements are uninitialized.
|
|
Create a Array of a certain fixed number elements. Then initialize all entries with the specified initializer.
|
|
|
|
Return a pointer to the conventional array. The ownership of the returned memory remains with this class. The caller must not attempt to deallocate it unless "out" is also called.
Definition at line 236 of file memory.H. Referenced by Archon::Utilities::Image::Image(), Archon::Utilities::FormatLibpng::load(), Archon::Utilities::FormatLibjpeg::load(), Archon::Utilities::ImageData::queryPixelMap(), Archon::Utilities::FormatLibpng::save(), and Archon::Utilities::FormatLibjpeg::save(). |
|
Test if any memory is currently owned by this object.
|
|
Dismount and return the conventional array. It is the responsibility of the caller to deallocate the returned memory. This class no longer knows of it. Succeeding calls to get or out will return 0. Definition at line 251 of file memory.H. Referenced by Archon::Utilities::Image::Image(). |
|
Dispose the previously managed conventional array and replace it with a new one of the specified size. Then initialize all entries with the specified initializer. |
|
Dispose the previously managed conventional array and replace it with a new one of the specified size. If the element type is of class type the elements are default initialized, otherwise the elements are uninitialized. |
|
Dispose the previously managed conventional array and replace it with the passed conventional array. This object assumes control over the passed memory. Definition at line 258 of file memory.H. Referenced by Archon::Utilities::FormatLibpng::load(), Archon::Utilities::FormatLibjpeg::load(), Archon::Utilities::Array< C >::reset(), Archon::Utilities::FormatLibpng::save(), and Archon::Utilities::FormatLibjpeg::save(). |