cxDataObjNew - create a new data object of an arbitrary type
#include <cx/DataOps.h>

void *cxDataObjNew( const char *typename )
integer function cxDataObjNew( typename )
character * (*) typename
Data type name.
Returns a pointer to a new data object of the given type. cxDataObjNew is used to create a new reference-counted data object. It is used by automatically generated routines for allocating user-defined data types, and you must use it if you write your own data allocation routine.

Only the base structure is created by cxDataObjNew. For example, given a type name of "cxLattice", cxDataObjNew will return a pointer to a cxLattice structure. The ndim, data, dims, and coord fields will be 0 or NULL. Additional memory allocation for arrays is done with cxDataMalloc, cxDataCalloc, and cxDataRealloc. The data's reference count will be 0; the allocation routine should NOT increment the reference count.

Data structures are allocated from a shared memory arena. This shared memory is a limited resource, so it is possible for the memory to be exhausted, causing the allocation routine to fail.

See cxDataManAbortOnError for more details on writing portable module code that copes well with limited memory.

Use cxDataFree to free regular memory, and cxDataRefDec to free any reference-counted structures.

cxDataManAbortOnError, cxDataMalloc, cxDataCalloc, cxDataRealloc, cxDataFree, cxDataRefDec

[ Documentation Home ]