#include <mtx/datablock.h>

Public Member Functions | |
| void | incr_refcount () |
| Increment the reference count. | |
| void | decr_refcount () |
| Decrement the reference count. | |
| virtual bool | is_unique () const =0 |
| Query if the data block is unique. | |
| const double * | data () const |
| Get a pointer to const data. | |
| double * | data_nc () |
| Get a pointer to non-const data. | |
| unsigned int | length () const |
| Get the length of the data array. | |
Static Public Member Functions | |
| static data_block * | make_zeros (int length) |
| Return a new shared data_block whose contents are all set to zero. | |
| static data_block * | make_uninitialized (int length) |
| Return a new shared data_block whose contents are uninitialized. | |
| static data_block * | make_data_copy (const double *data, int data_length) |
| Make a copy of the given data array. | |
| static data_block * | make_borrowed (double *data, int data_length) |
| The 'data' are borrowed, but are never considered unique. | |
| static data_block * | make_referred (double *data, int data_length) |
| The 'data' are borrowed, as in make_borrowed(), but... | |
| static data_block * | make (double *data, int mrows, int ncols, mtx_policies::storage_policy s) |
| static data_block * | make (int mrows, int ncols, mtx_policies::init_policy p) |
| static void | make_unique (data_block *&rep) |
| Make the given data_block have a unique copy of its data, copying if needed. | |
Protected Member Functions | |
| data_block (double *data, unsigned int len) | |
| Construct with a given data array and length. | |
| virtual | ~data_block () |
| Virtual destructor. | |
| void * | operator new (size_t bytes) |
| Class-specific operator new. | |
| void | operator delete (void *space) |
| Class-specific operator delete. | |
| int | refcount () const |
| Get the current reference count. | |
Protected Attributes | |
| double *const | m_storage |
| Pointer to the actual storage. | |
| unsigned int const | m_length |
| Allocated length of the storage. | |
Serves as the implementation for higher-level matrix classes, etc.
Definition at line 54 of file datablock.h.
| data_block::data_block | ( | double * | data, | |
| unsigned int | len | |||
| ) | [protected] |
Construct with a given data array and length.
No copy is made of the data array here; the data_block object will point directly to the given array.
Definition at line 130 of file datablock.cc.
| data_block * data_block::make_uninitialized | ( | int | length | ) | [static] |
Return a new shared data_block whose contents are uninitialized.
I.e. contents not zero-set as in make_zeros().
Definition at line 181 of file datablock.cc.
| data_block * data_block::make_borrowed | ( | double * | data, | |
| int | data_length | |||
| ) | [static] |
The 'data' are borrowed, but are never considered unique.
Therefore, attempts to make_unique() will always duplicate the data.
Definition at line 190 of file datablock.cc.
| data_block * data_block::make_referred | ( | double * | data, | |
| int | data_length | |||
| ) | [static] |
The 'data' are borrowed, as in make_borrowed(), but...
Uniqueness is determined by the reference count, so it is possible to write to the data through the data_block.
Definition at line 196 of file datablock.cc.