#include <Storage.h>
Inheritance diagram for PLearn::Storage< T >:
Public Types | |
typedef T | value_type |
typedef int | size_type |
typedef T * | iterator |
typedef const T * | const_iterator |
Public Member Functions | |
Storage (const Storage &other) | |
Storage (int the_length, T *dataptr) | |
int | length () const |
int | size () const |
iterator | begin () const |
iterator | end () const |
void | mem_alloc (int len) |
Storage (int the_length=0) | |
data is initially filled with zeros | |
Storage (const char *filename, bool readonly) | |
void | pointTo (int the_length, T *dataptr) |
~Storage () | |
void | resize (int newlength) |
Storage< T > * | deepCopy (map< const void *, void * > &copies) const |
Deep copying. | |
T & | operator[] (int idx) const |
void | push_back (const T &x) |
Public Attributes | |
int | length_ |
T * | data |
bool | dont_delete_data |
if true, the destructor won't delete[] data, because it will assume it is somebody else's responsibility | |
tFileHandle | fd |
The descriptor for the memory-mapped file (-1 if there is no memory mapping). |
|
|
|
|
|
|
|
|
|
|
|
|
|
data is initially filled with zeros
|
|
Constructor for memory-mapped file The file is supposed to exist and have the correct size length() of the storage will be set to the size of the file divided by sizeof(T) < read-write |
|
|
|
|
|
Deep copying. < a copy already exists, so return it Otherwise call the copy constructor to obtain a copy Put the copy in the map return the completed deep_copy |
|
|
|
|
|
|
|
|
< allocated elsewhere |
|
|
|
Grow or shrink data memory If newlength==length() this call does nothing If newlength<=0 it outputs an PLERROR(i.e. cannot shrink memory to 0) Otherwise this call ALWAYS: -> allocates a new block of exactly the given size -> copies all the possible the data of the old block to the new one -> fills the remaining of the new block (if any) with 0.0 -> frees the old block It is the job of the CALLER (Mat and Vec) to have an appropriate policy to minimize the number of calls to Storage::resize < we are using a memory-mapped file < growing < newlength<length() (shrinking) |
|
Definition at line 103 of file Storage.h. Referenced by PLearn::Storage< pair< real, real > >::deepCopy(), and PLearn::Storage< pair< real, real > >::push_back(). |
|
Definition at line 73 of file Storage.h. Referenced by PLearn::Storage< pair< real, real > >::deepCopy(), and PLearn::Storage< pair< real, real > >::Storage(). |
|
if true, the destructor won't delete[] data, because it will assume it is somebody else's responsibility
|
|
The descriptor for the memory-mapped file (-1 if there is no memory mapping).
|
|
|