areaDetector  3-5-0
EPICS areaDetector framework
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
NDArray Class Reference

N-dimensional array class; each array has a set of dimensions, a data type, pointer to data, and optional attributes. More...

#include <NDArray.h>

Public Member Functions

 NDArray ()
 NDArray constructor, no parameters. More...
 
 NDArray (int ndims, size_t *dims, NDDataType_t dataType, size_t dataSize, void *pData)
 
virtual ~NDArray ()
 NDArray destructor Frees the data array, deletes all attributes, frees the attribute list and destroys the mutex. More...
 
int initDimension (NDDimension_t *pDimension, size_t size)
 Initializes the dimension structure to size=size, binning=1, reverse=0, offset=0. More...
 
int getInfo (NDArrayInfo_t *pInfo)
 Convenience method returns information about an NDArray, including the total number of elements, the number of bytes per element, and the total number of bytes in the array. More...
 
int reserve ()
 Calls NDArrayPool::reserve() for this NDArray object; increases the reference count for this array. More...
 
int release ()
 Calls NDArrayPool::release() for this object; decreases the reference count for this array. More...
 
int getReferenceCount () const
 
int report (FILE *fp, int details)
 Reports on the properties of the array. More...
 

Static Public Member Functions

static int computeArrayInfo (int ndims, size_t *dims, NDDataType_t dataType, NDArrayInfo *pInfo)
 Convenience method computes the total the total number of bytes in the array. More...
 

Public Attributes

class NDArrayPoolpNDArrayPool
 The NDArrayPool object that created this array. More...
 
class asynNDArrayDriverpDriver
 The asynNDArrayDriver that created this array. More...
 
int uniqueId
 A number that must be unique for all NDArrays produced by a driver after is has started. More...
 
double timeStamp
 The time stamp in seconds for this array; seconds since EPICS epoch (00:00:00 UTC, January 1, 1990) is recommended, but some drivers may use a different start time. More...
 
epicsTimeStamp epicsTS
 The epicsTimeStamp; this is set with pasynManager->updateTimeStamp(), and can come from a user-defined timestamp source. More...
 
int ndims
 The number of dimensions in this array; minimum=1. More...
 
NDDimension_t dims [ND_ARRAY_MAX_DIMS]
 Array of dimension sizes for this array; first ndims values are meaningful. More...
 
NDDataType_t dataType
 Data type for this array. More...
 
size_t dataSize
 Data size for this array; actual amount of memory allocated for *pData, may be more than required to hold the array. More...
 
void * pData
 Pointer to the array data. More...
 
NDAttributeListpAttributeList
 Linked list of attributes. More...
 
Codec_t codec
 Definition of codec used to compress the data. More...
 
size_t compressedSize
 Size of the compressed data. More...
 

Friends

class NDArrayPool
 

Detailed Description

N-dimensional array class; each array has a set of dimensions, a data type, pointer to data, and optional attributes.

An NDArray also has a uniqueId and timeStamp that to identify it. NDArray objects can be allocated by an NDArrayPool object, which maintains a free list of NDArrays for efficient memory management.

Constructor & Destructor Documentation

◆ NDArray() [1/2]

NDArray::NDArray ( )

NDArray constructor, no parameters.

Initializes all fields to 0. Creates the attribute linked list and linked list mutex.

◆ NDArray() [2/2]

NDArray::NDArray ( int  ndims,
size_t *  dims,
NDDataType_t  dataType,
size_t  dataSize,
void *  pData 
)

◆ ~NDArray()

NDArray::~NDArray ( )
virtual

NDArray destructor Frees the data array, deletes all attributes, frees the attribute list and destroys the mutex.

Member Function Documentation

◆ computeArrayInfo()

int NDArray::computeArrayInfo ( int  ndims,
size_t *  dims,
NDDataType_t  dataType,
NDArrayInfo pInfo 
)
static

Convenience method computes the total the total number of bytes in the array.

◆ getInfo()

int NDArray::getInfo ( NDArrayInfo_t pInfo)

Convenience method returns information about an NDArray, including the total number of elements, the number of bytes per element, and the total number of bytes in the array.

Parameters
[out]pInfoPointer to an NDArrayInfo_t structure, must have been allocated by caller.

◆ getReferenceCount()

int NDArray::getReferenceCount ( ) const
inline

◆ initDimension()

int NDArray::initDimension ( NDDimension_t pDimension,
size_t  size 
)

Initializes the dimension structure to size=size, binning=1, reverse=0, offset=0.

Parameters
[in]pDimensionPointer to an NDDimension_t structure, must have been allocated by caller.
[in]sizeThe size of this dimension.

◆ release()

int NDArray::release ( )

Calls NDArrayPool::release() for this object; decreases the reference count for this array.

◆ report()

int NDArray::report ( FILE *  fp,
int  details 
)

Reports on the properties of the array.

Parameters
[in]fpFile pointer for the report output.
[in]detailsLevel of report details desired; if >5 calls NDAttributeList::report().

◆ reserve()

int NDArray::reserve ( )

Calls NDArrayPool::reserve() for this NDArray object; increases the reference count for this array.

Friends And Related Function Documentation

◆ NDArrayPool

friend class NDArrayPool
friend

Member Data Documentation

◆ codec

Codec_t NDArray::codec

Definition of codec used to compress the data.

◆ compressedSize

size_t NDArray::compressedSize

Size of the compressed data.

Should be equal to dataSize if pData is uncompressed.

◆ dataSize

size_t NDArray::dataSize

Data size for this array; actual amount of memory allocated for *pData, may be more than required to hold the array.

◆ dataType

NDDataType_t NDArray::dataType

Data type for this array.

◆ dims

Array of dimension sizes for this array; first ndims values are meaningful.

◆ epicsTS

epicsTimeStamp NDArray::epicsTS

The epicsTimeStamp; this is set with pasynManager->updateTimeStamp(), and can come from a user-defined timestamp source.

◆ ndims

int NDArray::ndims

The number of dimensions in this array; minimum=1.

◆ pAttributeList

NDAttributeList* NDArray::pAttributeList

Linked list of attributes.

◆ pData

void* NDArray::pData

Pointer to the array data.

The data is assumed to be stored in the order of dims[0] changing fastest, and dims[ndims-1] changing slowest.

◆ pDriver

class asynNDArrayDriver* NDArray::pDriver

The asynNDArrayDriver that created this array.

◆ pNDArrayPool

class NDArrayPool* NDArray::pNDArrayPool

The NDArrayPool object that created this array.

◆ timeStamp

double NDArray::timeStamp

The time stamp in seconds for this array; seconds since EPICS epoch (00:00:00 UTC, January 1, 1990) is recommended, but some drivers may use a different start time.

◆ uniqueId

int NDArray::uniqueId

A number that must be unique for all NDArrays produced by a driver after is has started.


The documentation for this class was generated from the following files: