AAO DRAMA/DRAMA2 C++ Interface
DRAMA C++11 and later interface

◆ ArrayAccess() [2/4]

template<typename T , class ContainerType >
void drama::sds::Id::ArrayAccess ( ArrayAccessHelper< T > *const  data,
ContainerType dims 
) const
inline

Access the data of an SDS primitive item array.

Any dimensions.

Accesses an array using an ArrayWriteHelper or ArrayReadHelper of the appropriate 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, we instantiate value to provide access to an array of SDS short items, of unknown dimensions.

   sds::Id structure;
   ...
   std::vector<unsigned long> dims;
   sds::ArrayAccessHelper value;
   structure.ArrayAccess(&value, dims);
   unsigned long count = value.Size();
   for (unsigned long i = 0; i < count ; ++i)
        printf("Element %ld = %d\\n", i, (int)value[i]);
See also
sds::ArrayAccessHelper
sds::ArrayWriteHelper
sds::ArrayReadHelper
Parameters
dataA pointer to an object which allows you to access the underlying SDS data. It must be an Instantiations of a sub-class ArrayAccessHelper appropriate for type T.
dimsThe dimensions are written to this array. This is the address of a container. The container is cleared before the dimensions are pushed into it.
Template Parameters
TThe array access helper to use.
ContainerTypeA container with clear() and push_back() methods. The push_back() method must accept unsigned long items.

References ArrayAccess(), drama::CreateRunDramaTask(), and GetDims().