casa
5.7.0-16
|
simple 1-D array More...
#include <Block.h>
Static Public Member Functions | |
static void | setTraceSize (size_t sz) |
Set the trace size. More... | |
Static Protected Member Functions | |
static void | doTraceAlloc (const void *addr, size_t nelem, DataType type, size_t sz) |
Write alloc and free trace messages. More... | |
static void | doTraceFree (const void *addr, size_t nelem, DataType type, size_t sz) |
Static Protected Attributes | |
static size_t | itsTraceSize |
simple 1-D array
Public interface
This should be viewed as a block of memory without sophisticated manipulation functions. Thus it is called Block
.
Block<T>
is a simple templated 1-D array class. Indices are always 0-based. For efficiency reasons, no index checking is done unless the preprocessor symbol AIPS_ARRAY_INDEX_CHECK
is defined. Block<T>
's may be assigned to and constructed from other Block<T>
's. As no reference counting is done this can be an expensive operation, however.
The net effect of this class is meant to be unsurprising to users who think of arrays as first class objects. The name "Block" is intended to convey the concept of a solid "chunk" of things without any intervening "fancy" memory management, etc. This class was written to be used in the implementations of more functional Vector, Matrix, etc. classes, although it is expected Block<T>
will be useful on its own.
The Block class should be efficient. You should normally use Block
.
Warning: If you use the assignment operator on an element of this class, you may leave dangling references to pointers released from storage()
; Resizing the array will also have this effect if the underlying storage is actually affected;
If index checking is turned on, an out-of-bounds index will generate an indexError<uInt>
exception.
|
staticprotected |
Write alloc and free trace messages.
Referenced by casacore::Block< casacore::String >::traceAlloc().
|
staticprotected |
Referenced by casacore::Block< casacore::String >::traceFree().
|
static |
Set the trace size.
The (de)allocation of Blocks with >= sz elements will be traced using the MemoryTrace class. A value 0 means no tracing.
|
staticprotected |
Definition at line 121 of file Block.h.
Referenced by casacore::Block< casacore::String >::traceAlloc(), and casacore::Block< casacore::String >::traceFree().