1#ifndef _DRAMA2_SDSARRAY_INC
2#define _DRAMA2_SDSARRAY_INC
42 template<
typename SDS_T>
int CodeForType() {
return -1; }
158 unsigned long elements;
167 void SetDataToAddr(
void *
dataAddr) {
177 void SetNumElements(
unsigned long nelem) {
187 void CheckIndexAndData(
unsigned long index)
const {
191 "drama::Sds::ArrayAccessHelper Index {0}, Code {1}, elements {2} - data is invalid",
192 index, code, elements);
194 if (index >= elements)
197 "drama::Sds::ArrayAccessHelper Index {0}, Code {1}, elements {2} - index is invalid",
198 index, code, elements);
229 "ArrayAccessHelper constructor with invalid code {0}, must be in range 0 to {1}",
242 unsigned long Size()
const {
return elements; }
278 template <
typename T>
class ArrayWriteHelper :
public ArrayAccessHelper<T> {
299 this->CheckIndexAndData(index);
309 T
const &
operator[](
const unsigned long index)
const {
313 this->CheckIndexAndData(index);
360 template <
typename T>
class ArrayReadHelper :
public ArrayAccessHelper<T> {
377 T
const &
operator[](
const unsigned long index)
const {
381 this->CheckIndexAndData(index);
SdsCodeType Code() const
Return the SDS type code of the item being accessed.
Definition sdsarray.hh:264
ArrayAccessHelper()
Create a drama::sds::ArrayAccessHelper object.
Definition sdsarray.hh:253
unsigned long Size() const
Return the number of elements in the array.
Definition sdsarray.hh:269
const T * GetDataAddress() const
Return the address of the data.
Definition sdsarray.hh:242
T * GetDataAddress()
Return the address of the data.
Definition sdsarray.hh:235
Helper class for access to an SDS Scalar Arrays.
Definition sdsarray.hh:180
ArrayReadHelper()
Create a drama::sds::ArrayReadHelper object.
Definition sdsarray.hh:395
T const & operator[](const unsigned long index) const
SDS array subscript operator.
Definition sdsarray.hh:404
const T * DataAddress() const
Access the data directly - read only.
Definition sdsarray.hh:419
Helper class for reading data from SDS Scalar Arrays.
Definition sdsarray.hh:387
ArrayWriteHelper()
Create a drama::sds::ArrayWriteHelper object.
Definition sdsarray.hh:313
T & operator[](const unsigned long index)
SDS array subscript operator - non-const version.
Definition sdsarray.hh:322
T const & operator[](const unsigned long index) const
SDS array subscript operator - const version.
Definition sdsarray.hh:336
T * DataAddress()
Access the data directly.
Definition sdsarray.hh:352
Helper class for writing data to SDS Scalar Arrays.
Definition sdsarray.hh:305
A C++ Interface to the handling SDS structures.
Definition sds.hh:428
#define DramaTHROW_F(status_, format_,...)
Throw a Drama exception with fmt::format string formatting.
Definition exception.hh:129
int CodeForType< short >()
Returns the SDS type for a short - SDS_SHORT.
int CodeForType< unsigned short >()
Returns the SDS type for an unsigned short - SDS_USHORT.
int CodeForType< double >()
Returns the SDS type for a double - SDS_DOUBLE.
int CodeForType< const std::string & >()
Returns the SDS type for a string - ARG_STRING.
int CodeForType< signed char >()
Returns the SDS type for a signed char - SDS_BYTE.
int CodeForType< char >()
Returns the SDS type for a char - SDS_CHAR.
int CodeForType< unsigned char >()
Returns the SDS type for an unsigned char - SDS_UBYTE.
int CodeForType< INT64 >()
Returns the SDS type for a 64 bit integer - SDS_I64.
int CodeForType()
Functions which returns the SDS type of a given C type.
Definition sdsarray.hh:69
int CodeForType< UINT32 >()
Returns the SDS type for an unsigned integer - SDS_UINT.
int CodeForType< float >()
Returns the SDS type for a flat - SDS_FLOAT.
int CodeForType< UINT64 >()
Returns the SDS type for an unsigned 64 bit integer - SDS_UI64.
int CodeForType< INT32 >()
Returns the SDS type for a 32 bit integer - SDS_INT.
int CodeForType< bool >()
Return the SDS type code for C - SDS_SHORT
void CreateRunDramaTask()
Create and run a DRAMA task, with standard exception handling.
Definition task.hh:1339
The drama namespace contains all the classes, types etc of the DRAMA 2 implementation.
Definition drama.hh:99