AAO DRAMA C++ Interface (Old style)
DRAMA C++, Depreciated, don't use for new code

◆ ArrayAccess() [2/4]

template<typename T >
void SdsId::ArrayAccess ( SdsArrayAccessHelper< T > *const  data,
long *  ndims,
unsigned long  dims[],
StatusType *const  status 
)
inline

Access the data of an SDS array.

Accesses an array using an SdsArrayAccessHelper of the appropiate type. This version allows access to an array of any dimensions and number of dimensions. Various other versions also exist.

On return, "data[index]" can be used to access the array element at the specified index. See the SdsArrayAccessHelper class for more information. Note that mult-idimensional arrays must be indexed by calculating the single dimensional index (otherwise the type definitions are too hard).

In this example, SdsArrayShort is a sub-class of SdsArrayAccessHelper.

   SdsId structure;
   ...
   long ndims;
   unsigned long dims[SDS_C_MAXARRAYDIMS];
   SdsArrayShort value;
   structure.ArrayAccess(&value, &ndims, dims, status);
   unsigned long count = value.Size();
   if (*status == STATUS__OK)
   {
      for (unsigned long i = 0; i < count ; ++i)
        printf("Element %ld = %d\\n", i, (int)value[i]);
   }
Remarks
Only available if the marcro DRAMA_ALLOW_CPP_STDLIB is defined.
See also
SdsArrayAccessHelper
Parameters
dataA pointer to an object which allows you to access the underlying SDS data. It must be a sub-class of SdsArrayAccessHelper appropiate for type T.
ndimsThe number of dimensions is written here.
dimsThe dimensions are written to this array. Must have space for 7 dimensions.
statusInherited status. In addition to the values returned by SdsInfo() and SdsPointer(), the values SDS__TYPE, SDS__NOTARR and SDS__INVDIMS may be returned.