40 const std::string &
file,
68 template <
typename T>
void SdsArgPut(
72 template <>
void SdsArgPut<bool>(
75 template <>
void SdsArgPut<char>(
78 template <>
void SdsArgPut<short>(
81 template <>
void SdsArgPut<unsigned short>(
84 template <>
void SdsArgPut<INT32>(
87 template <>
void SdsArgPut<UINT32>(
90 template <>
void SdsArgPut<INT64>(
93 template <>
void SdsArgPut<UINT64>(
96 template <>
void SdsArgPut<float>(
99 template <>
void SdsArgPut<double>(
103 template <>
void SdsArgPut<const char *>(
117 template <
typename T>
void SdsArgGet(
121 template <>
void SdsArgGet<bool>(
124 template <>
void SdsArgGet<char>(
127 template <>
void SdsArgGet<short>(
130 template <>
void SdsArgGet<unsigned short>(
133 template <>
void SdsArgGet<INT32>(
136 template <>
void SdsArgGet<UINT32>(
139 template <>
void SdsArgGet<INT64>(
142 template <>
void SdsArgGet<UINT64>(
145 template <>
void SdsArgGet<float>(
148 template <>
void SdsArgGet<double>(
151 template <>
void SdsArgGet<std::string>(
171 template <
typename T>
void PutScalar(
175 template <>
void PutScalar<bool>(
178 template <>
void PutScalar<char>(
181 template <>
void PutScalar<short>(
184 template <>
void PutScalar<unsigned short>(
187 template <>
void PutScalar<INT32>(
190 template <>
void PutScalar<UINT32>(
193 template <>
void PutScalar<INT64>(
196 template <>
void PutScalar<UINT64>(
199 template <>
void PutScalar<float>(
202 template <>
void PutScalar<double>(
206 template <>
void PutScalar<const char *>(
210 template <>
void PutScalar<const std::string &>(
226 template <
typename T>
void GetScalar(
230 template <>
void GetScalar<bool>(
233 template <>
void GetScalar<char>(
236 template <>
void GetScalar<short>(
239 template <>
void GetScalar<unsigned short>(
242 template <>
void GetScalar<INT32>(
245 template <>
void GetScalar<UINT32>(
248 template <>
void GetScalar<INT64>(
251 template <>
void GetScalar<UINT64>(
254 template <>
void GetScalar<float>(
257 template <>
void GetScalar<double>(
260 template <>
void GetScalar<std::string>(
278 virtual void Print(
const std::string &
line) = 0;
283 class PrintObjectCR {
293 virtual void Print(
const std::string &
line)
const = 0;
422 void CleanUp(
const std::string &
from_where)
noexcept {
423#if defined(SDS_CHECK_FREE)||defined(SDS_CHECK_FREE_W)
434 void CleanUpWorker(
bool check,
const std::string &
from_where)
noexcept;
441 template <
class ContainerType>
458 "SDS type does not match expected array type");
460 if (
dims->size() == 0)
463 "Attempt to access an array in an SDS structure which is not an array");
465 if (
dims->size() !=
static_cast<unsigned>(
ndims))
468 "SDS Array structure has % dimensions instead of the expected %",
477 void CheckArrayTypeSingleDim(
479 unsigned long *
const nitems)
const {
481 std::vector<unsigned long>
dims;
482 CheckArrayType(code, 1, &
dims);
492 template <
class T>
void SetArrayHelperDataAddr(
493 T *
const data)
const {
558 CleanUp(
"sds::Id move assignment");
561 _flags = std::move(
rhs._flags);
588 _flags.readfree =
false;
620 const bool del =
false,
const bool readfree =
false) :
624 _flags.readfree = readfree;
671 const bool del =
false,
const bool readfree =
false);
752 template <
class ContainerType>
761 std::is_standard_layout<typename ContainerType::value_type>::value,
762 "The value type in the container must be a standard layout type");
767 "Attempt to access data in empty container");
769 Id item(0,
true,
false,
false);
800 template <
class ContainerType>
808 std::is_standard_layout<typename ContainerType::value_type>::value,
809 "The value type in the container must be a standard layout type");
815 "Attempt to access data in empty container");
819 Id item(0,
true,
true,
false);
863 const std::string &name,
865 const std::string &
extra =
"")
const;
881 const std::string &name,
883 const std::string &
extra =
"");
909 template <
class ContainerType>
911 const std::string &name,
914 const std::string &
extra =
"")
const {
916 Id item(0,
true,
false,
false);
928 "Failed to create new SDS array - % dimensions, minimum supported 1, maximum supported is %",
970 const std::string &name,
972 const unsigned nElem,
973 const std::string &
extra =
"")
const {
975 Id item(0,
true,
false,
false);
982 unsigned long dims[1];
1012 template <
class ContainerType>
1014 const std::string & name,
1017 const std::string &
extra =
""){
1019 Id item(0,
true,
true,
false);
1031 "Failed to create new SDS array - % dimensions, minimum supported 1, maximum supported is %",
1072 const std::string & name,
1074 const unsigned nElem,
1075 const std::string &
extra =
""){
1077 Id item(0,
true,
true,
false);
1084 unsigned long dims[1];
1131 template <
class ContainerType>
1134 Id item(0,
true,
false,
false);
1145 "Failed to access SDS array cell - % dimensions, minimum supported 1, maximum supported is %",
1164 item._flags.del =
false;
1170 "Failed to access cell of existing SDS array id");
1211 virtual Id Find(
const std::string &name,
1261 CleanUp(
"sds::Id destructor");
1270 virtual void SetFree() { _flags.free =
true; }
1276 virtual void SetDelete() { _flags.del =
true; }
1298 _flags.free =
false;
1300 _flags.readfree =
false;
1337 _flags.free =
false;
1371 template <
class ContainerType>
1381 std::is_standard_layout<typename ContainerType::value_type>::value,
1382 "The value type in the container must be a standard layout type");
1417 template <
class ContainerType>
1425 std::is_standard_layout<typename ContainerType::value_type>::value ,
1426 "The value type in the container must be a standard layout type");
1463 _flags.readfree =
false;
1477 virtual void Flush() {
1514 template <
typename T>
1517 unsigned long *
actlen =
nullptr,
1518 const unsigned long offset=0)
const {
1526 std::is_standard_layout<T>::value,
1527 "The type T must be a standard layout type");
1549 virtual std::string
GetExtra()
const {
1551 unsigned long length = 0;
1568 "Failed to Get extra data from SDS item");
1581 virtual std::string
GetName()
const {
1589 "Failed to Get Name of SDS item");
1642 "SDS Item % has code %, was expected to have code %",
1671 template <
class ContainerType>
1680 "Failed to Get dimensions of SDS item");
1708 "Failed to Get number of SDS items");
1758 template <
class ContainerType>
1772 "Failed to create new SDS array - % dimensions, minimum supported 1, maximum supported is %",
1852 template <
typename T>
1862 std::is_standard_layout<T>::value,
1863 "The type T must be a standard layout and type");
1877 *data =
static_cast<T *
>(
tdata);
1908 template <
typename T>
1910 const T *
const data,
1911 const unsigned long offset=0) {
1919 std::is_standard_layout<T>::value,
1920 "The type T must be a standard layout type");
1922 const void *
tdata =
static_cast<const void *
>(data);
1957 virtual void Rename(
const std::string &name) {
1990 template <
class ContainerType>
2004 "Failed to create new SDS array - % dimensions, minimum supported 1, maximum supported is %",
2030 virtual unsigned long Size()
const {
2031 unsigned long bytes;
2053 unsigned long bytes;
2066 virtual void List()
const {
2096 virtual void List(std::ostream &
strm,
2163 "Failed to write SDS structure to file \"%\"",
2203 "Failed to get SDS external structure address");
2224 virtual bool Exists(
const std::string &name)
const;
2238 virtual bool Exists(
unsigned index)
const;
2252 explicit operator SdsIdType()
const {
return _id; }
2259 explicit operator bool()
const {
2291 bool *
const del= 0,
bool *
const readfree = 0) {
2293 *free = _flags.free;
2297 *readfree = _flags.readfree;
2299 _flags.free = _flags.del = _flags.readfree =
false;
2324 CleanUp(
"sds::Id::ShallowCopy 1");
2326 _flags.free = _flags.del = _flags.readfree =
false;
2353 CleanUp(
"sds::Id::ShallowCopy 2");
2361 _flags.free =
source->_flags.free;
2362 _flags.del =
source->_flags.del;
2363 _flags.readfree =
source->_flags.readfree;
2366 source->_flags.readfree =
false;
2370 _flags.free = _flags.del = _flags.readfree =
false;
2396 const bool del =
false,
const bool readfree =
false) {
2397 CleanUp(
"sds::Id::ShallowCopy 3");
2400 _flags.readfree = readfree;
2423 _flags.del, _flags.readfree);
2424 _flags.free =
false;
2426 _flags.readfree =
false;
2433 target->ShallowCopy(_id);
2477 CheckArrayTypeSingleDim(data->Code(),
dims);
2478 data->SetNumElements(
dims[0]);
2479 SetArrayHelperDataAddr(data);
2518 const unsigned long nitems,
2519 sds::ArrayAccessHelper<T> *
const data)
const {
2522 CheckArrayTypeSingleDim(data->Code(),
dims);
2526 "ArrayAccess expected % items, found %",
2529 data->SetNumElements(
dims[0]);
2530 SetArrayHelperDataAddr(data);
2576 template <
typename T,
class ContainerType>
void ArrayAccess(
2586 "Failed to access SDS array. Numbers of dimensions % invalid, must be in range 1 to %",
2590 CheckArrayType(data->Code(),
ndims,
dims);
2595 unsigned long elements = (*dims)[0];
2596 for (
unsigned long i = 1;
i <
dims->size() ; ++
i)
2600 data->SetNumElements(elements);
2604 SetArrayHelperDataAddr(data);
2654 template <
typename T,
class ContainerType>
void ArrayAccess(
2720 template <
typename ContainerType>
2723 const std::string &name=
"ArgStructure") {
2776 template <
typename T>
2778 const std::initializer_list<T> &
values,
2779 const std::string &name=
"ArgStructure") {
2812 template <
typename T>
2815 const std::string &name=
"ArgStructure") {
2852 template <
typename ContainerType>
2891 char *
string =
new char[
maxlen];
2904 std::string
result=&
string[0];
2935 template <
typename T>
2948 "ArgPut failed of item \"%\" failed",
2969 void Put (
const std::string &name,
const std::string &
value,
2977 "ArgPut failed of item \"%\" failed",
3005 template <
typename T>
3006 void Get (
const std::string &name, T *
value)
const {
3018 "ArgGet failed of item \"%\" failed",
3041 template <
typename T>
3064 void Put (
const std::string &
value) {
3085 template <
typename T>
3123 template <
class ContainerType>
3139 "Failed to check SDS array - % dimensions, minimum supported 0, maximum supported is %",
3163 virtual int GetInt()
const;
3169 virtual unsigned int GetUInt()
const;
3182 virtual unsigned long GetULong()
const;
3207 nullptr,
nullptr,
nullptr, &
status);
3227 std::string _function;
3250 : _line(
line), _file(
file), _function(function) {
3264 fprintf(
stderr,
"Warning:sds::IdChecker:Function leaked SDS id's - function %s, file %s, check object at line %d\n", _function.c_str(), _file.c_str(), _line);
3266 fprintf(
stderr,
"Warning:sds::IdChecker:Function released SDS id's - function %s, file %s, check object at line %d\n", _function.c_str(), _file.c_str(), _line);
3280#define SDS_CHECK_IDS2(function_) drama::sds:IdChecker _sds_id_checker(__LINE__, __FILE__, (function_))
3285 typedef std::shared_ptr<Id>
IdPtr;
3296 void operator()(
void *)
const { }
3317 template <
typename T>
3318 class DataPointer :
public std::unique_ptr<T,_nodel> {
3321 unsigned long _lengthBytes;
3339 std::is_standard_layout<T>::value,
3340 "The type T must be a standard layout and type");
3345 if (_lengthBytes !=
sizeof(T))
3348 "SDS Pointer error - expected % bytes, got %",
3349 sizeof(T), _lengthBytes);
3354 std::unique_ptr<T, _nodel>
p(
dataPnt, _nodel());
3356 *((std::unique_ptr<T,_nodel>*)(
this)) = std::move(
p);
3378 std::is_standard_layout<T>::value,
3379 "The type T must be a standard layout type");
3384 if (_lengthBytes !=
sizeof(T))
3387 "SDS Pointer error - expected % bytes, got %",
3388 sizeof(T), _lengthBytes);
3393 std::unique_ptr<T, _nodel>
p(
dataPnt, _nodel());
3395 *((std::unique_ptr<T,_nodel>*)(
this)) = std::move(
p);
3420 return _lengthBytes;
3443 template <
typename T>
3444 class DataPointer<T[]> :
public std::unique_ptr<T[], _nodel> {
3447 unsigned long _numItems;
3448 unsigned long _lengthBytes;
3452 typedef T * iterator;
3454 typedef const T * const_iterator;
3456 typedef T value_type;
3476 std::is_standard_layout<T>::value,
3477 "The type T must be a standard layout type");
3482 if (_lengthBytes <
sizeof(T))
3485 "SDS Array Pointer error - expected at least % bytes, got %",
3486 sizeof(T), _lengthBytes);
3491 _numItems = _lengthBytes/
sizeof(
dataPnt[0]);
3496 *((std::unique_ptr<T[],_nodel>*)(
this)) = std::move(
p);
3519 std::is_standard_layout<T>::value,
3520 "The type T must be a standard layout type");
3525 if (_lengthBytes <
sizeof(T))
3528 "SDS Array Pointer error - expected at least % bytes, got %",
3529 sizeof(T), _lengthBytes);
3534 _numItems = _lengthBytes/
sizeof(
dataPnt[0]);
3539 *((std::unique_ptr<T[],_nodel>*)(
this)) = std::move(
p);
3562 unsigned long size()
const {
3570 return _lengthBytes;
3577 return & (*this)[0];
3584 return (&(*
this)[0])+_numItems;
3590 const_iterator begin()
const {
3591 return & (*this)[0];
3597 const_iterator end()
const {
3598 return (&(*
this)[0])+_numItems;
3607 const_iterator cbegin()
const {
3608 return & (*this)[0];
3618 return (&(*
this)[0])+_numItems;
3631 bool empty()
const {
3678 using iterator_category = std::forward_iterator_tag;
3679 using value_type =
Id;
3680 using difference_type =std::ptrdiff_t;
3681 using pointer =
Id*;
3682 using reference =
Id&;
3690 bool _isArray =
false;
3715 "Attempt to construct IdIterator on non-structured SDS item (code %)", _top.
GetCode());
3721 std::vector<unsigned>
dims;
3723 if (
dims.size() > 0)
3737 "Attempt to construct IdIterator on an array of structures with more then 1 dimension - can't yet do that. ");
3743 _endCell =
dims[0]+1;
3752 _endCell =
id.GetNumItems()+1;
3759 _curCell = _endCell;
3771 if (&_top != &
other._top)
3773 return _curCell !=
other._curCell;
3782 if (_curCell >= _endCell)
3785 "Attempt to dereference IdIterator past end of structure");
3790 std::vector<unsigned long>
indicies(1);
3794 return _top.
Index(_curCell);
3809 if (_curCell < _endCell)
3838 template <
typename T>
3839 class ArrayContainer {
3848 T *_address =
nullptr;
3860 std::is_standard_layout<T>::value,
3861 "The type T must be a standard layout and type");
3867 bool empty()
const {
3868 return (_size <= 0);
SdsCodeType Code() const
Return the SDS type code of the item being accessed.
Definition sdsarray.hh:262
Helper class for access to an SDS Scalar Arrays.
Definition sdsarray.hh:180
size_type size() const
Returns the size of the container in items.
Definition sds.hh:3901
reference operator[](size_type n)
Returns an item at a particular address.
Definition sds.hh:3909
bool empty() const
Returns true if the container is empty.
Definition sds.hh:3894
value_type & reference
The type for a reference to the value.
Definition sds.hh:3871
T value_type
The value type.
Definition sds.hh:3869
ArrayContainer(T *address, size_type size)
Create a container to access the array.
Definition sds.hh:3884
std::size_t size_type
The type used for sizes.
Definition sds.hh:3873
~ArrayContainer()
Destroy the container, not the underlying array item.
Definition sds.hh:3914
A container for simple arrays for use with SDS templates.
Definition sds.hh:3866
const_iterator cend() const
Returns a const iterator pointing to the past-the-end element in the array.
Definition sds.hh:3644
iterator begin()
Returns an iterator pointing to the first element in the array.
Definition sds.hh:3603
const_iterator cbegin() const
Returns a const iterator pointing to the first element in the array.
Definition sds.hh:3634
bool empty() const
Returns true if container is empty.
Definition sds.hh:3658
const T * const_iterator
const iterator for this item
Definition sds.hh:3481
iterator end()
Returns an iterator pointing to the past-the-end element in the array.
Definition sds.hh:3610
unsigned long size() const
Return the number of elements in the array.
Definition sds.hh:3589
DataPointer(const drama::sds::Id &theId)
DataPointer Constructor.
Definition sds.hh:3494
const_iterator begin() const
Returns a const iterator pointing to the first element in the array.
Definition sds.hh:3617
unsigned long NumBytes() const
Return the size of the item in bytes.
Definition sds.hh:3596
~DataPointer()
DataPointer destructor.
Definition sds.hh:3576
T * iterator
iterator for this item
Definition sds.hh:3479
T value_type
Returns the type of T
Definition sds.hh:3483
DataPointer(drama::sds::Id *theId, bool outlives=false)
DataPointer Constructor.
Definition sds.hh:3537
const_iterator end() const
Returns a const iterator pointing to the past-the-end element in the array.
Definition sds.hh:3624
unsigned long NumBytes() const
Return the size of the item in bytes.
Definition sds.hh:3446
DataPointer(drama::sds::Id *theId, bool outlives)
DataPointer Constructor.
Definition sds.hh:3396
~DataPointer()
DataPointer destructor.
Definition sds.hh:3433
DataPointer(const drama::sds::Id &theId)
DataPointer Constructor.
Definition sds.hh:3358
A class that provides direct access to the data of an SDS item, via a sub-class of std::unique_ptr<>.
Definition sds.hh:3345
IdChecker(int line, const char *file, const char *function)
Construct an SdsChecker object.
Definition sds.hh:3276
virtual ~IdChecker()
SdsCheck destructor.
Definition sds.hh:3287
A class to check for SDS leaks.
Definition sds.hh:3249
IdIterator(const Id &id, const bool setEnd=false)
Construct a forward iterator for working through an SDS structure or array of structures.
Definition sds.hh:3734
bool operator!=(const IdIterator &other) const
Inequality operator.
Definition sds.hh:3796
Id operator*() const
Dereference operator - return the sds::Id item the iterator is pointing to.
Definition sds.hh:3808
const IdIterator & operator++()
Increment operator (prefix version).
Definition sds.hh:3830
An iterator for working through SDS Structures and SDS arrays of structures.
Definition sds.hh:3703
virtual void SetFree()
Indicate the underlying SDS item should be free-ed when the sds::Id object is destroyed.
Definition sds.hh:1297
virtual unsigned long GetULong() const
If the SDS item refers to a scalar value, convert it to an unsigned long integer.
Id CreateChildArray(const std::string &name, const SdsCodeType code, const unsigned nElem, const std::string &extra="") const
Factory constructor method Constructor which creates a new child item which is a one-dimensional arra...
Definition sds.hh:996
Id & operator=(Id &&rhs) noexcept
Move assignment operator.
Definition sds.hh:582
virtual std::string GetName() const
Return the name of the SDS item.
Definition sds.hh:1608
virtual std::string GetExtra() const
Get extra data from an SDS item.
Definition sds.hh:1576
virtual Id CreateChildItem(const std::string &name, const SdsCodeType code, const std::string &extra="") const
Factory constructor method which creates a new (non-array) child item.
void Resize(const ContainerType &dims)
Change the dimensions of an SDS array.
Definition sds.hh:2018
static Id FromFile(const std::string &filename)
Factory constructor method that reads an SDS structure from a file.
void Get(const std::string &name, T *value) const
Fetch primitive value from a named component of the structure.
Definition sds.hh:3033
virtual void ClearDelete()
Indicate the underlying SDS structure should NOT be deleted when the sds::Id object is destroyed.
Definition sds.hh:1313
virtual bool Exists(unsigned index) const
Determine if a item of a given index exists in a structure.
void CheckItem(SdsCodeType code, const ContainerType &dims) const
Check an item has a required structure.
Definition sds.hh:3151
unsigned GetNumItems() const
Return the number of components in an SDS structure.
Definition sds.hh:1728
virtual long GetLong() const
If the SDS item refers to a scalar value, convert it to long integer.
virtual void Outlive()
Force the actual SDS ID to outlive the sds::Id variable.
Definition sds.hh:1324
void ArrayAccess(const unsigned long nitems, sds::ArrayAccessHelper< T > *const data) const
Access the data of a single dimensional SDS primitive item array of a specified number of elements.
Definition sds.hh:2544
void ArrayAccess(ArrayAccessHelper< T > *const data) const
Access the data of a single dimensional SDS primitive array item of a specified number of elements.
Definition sds.hh:2500
static Id CreateArgCmdStruct(const ContainerType &values, const std::string &name="ArgStructure")
Factory constructor which creates a new "Arg" style SDS structure in the DRAMA Command style.
Definition sds.hh:2748
virtual void List(const PrintObjectCR &printer, int lineMaxLen=100) const
List the contents of the structure via a PrintObjectCR.
virtual void SetDelete()
Indicate the underlying SDS structure should be deleted when the sds::Id object is destroyed.
Definition sds.hh:1303
virtual Id Find(const std::string &name, bool throwOnNotFound=true) const
Factory constructor method Constructor which returns a reference to a named item.
static Id CreateByAccess(ContainerType *container)
Factory constructor method that accesses an exported SDS structure found in a byte stream.
Definition sds.hh:780
virtual unsigned long SizeDefined() const
Return the size of an SDS structure, as required for exporting when fully defined.
Definition sds.hh:2079
virtual void Write(const std::string &filename) const
Write the contents of the structure to a file.
Definition sds.hh:2185
virtual void Rename(const std::string &name)
Rename the SDS item.
Definition sds.hh:1984
virtual void List() const
List the contents of the structure to standard output.
Definition sds.hh:2093
void Put(const std::string &name, const std::string &value, const std::string &extraData="")
Insert a string value into a named component of the structure.
Definition sds.hh:2996
static Id CreateFromSdsId(SdsId *item)
Factory constructor method that constructs an sds::Id item from an existing old C++ interface SdsId i...
virtual unsigned int GetUInt() const
If the SDS item refers to a scalar value, convert it to an unsigned integer.
void Put(T value)
Insert a primitive value into the item.
Definition sds.hh:3069
Id & operator=(const Id &rhs)=delete
Assignment operator - deleted.
virtual double GetDouble() const
If the SDS item refers to a scalar value, convert it to a double item.
void Insert(Id &to_insert, const ContainerType &dims)
Insert an SDS object into this object, which is a structured array.
Definition sds.hh:1786
Id Cell(const ContainerType &indicies, bool throwOnNotFound=true) const
Factory constructor method Constructor that returns a cell of an existing id which must refer to an S...
Definition sds.hh:1159
virtual void ToSdsId(::SdsId *target, const bool outlives=false)
Shallow copy to an SdsId type.
Definition sds.hh:2442
static Id CreateByImport(const ContainerType &container)
Factory constructor method that imports an exported SDS structure found in a byte stream.
Definition sds.hh:828
virtual void List(FILE *to) const
List the contents of the structure to a C file.
Definition sds.hh:2105
virtual void ValidateCode(SdsCodeType requiredCode) const
Validate the code of the SDS item.
Definition sds.hh:1657
void ExportDefined(ContainerType *container) const
Export the SDS structure into a buffer, defining any undefined data.
Definition sds.hh:1445
void Export(ContainerType *container) const
Export the SDS structure into a buffer.
Definition sds.hh:1399
void Pointer(T **data, unsigned long *length=0) const
Obtain a pointer to the data area of a primitive SDS item.
Definition sds.hh:1880
virtual SdsCodeType GetCode() const
Return the code of the SDS item.
Definition sds.hh:1635
void ArrayAccess(ArrayAccessHelper< T > *const data, ContainerType *dims) const
Access the data of an SDS primitive item array.
Definition sds.hh:2681
static Id CreateTopLevelArray(const std::string &name, const SdsCodeType code, const unsigned nElem, const std::string &extra="")
Factory constructor method Constructor which creates a new one-dimensional array top-level item.
Definition sds.hh:1098
virtual void List(std::ostream &strm, int lineMaxLen=100) const
List the contents of the structure to an output stream.
Id(const Id &source)=delete
Copy constructor - deleted.
virtual void ShallowCopy(const SdsIdType source, const bool free=false, const bool del=false, const bool readfree=false)
Shallow copy from SdsIdType.
Definition sds.hh:2422
virtual void Delete()
Delete the SDS item.
Definition sds.hh:1352
static Id CreateFromSdsId(const SdsId &item)
Factory constructor method that constructs an sds::Id item from an existing old C++ interface SdsId i...
void GetDims(ContainerType *dims) const
Return the dimensions of the SDS item.
Definition sds.hh:1699
virtual ~Id()
sds::Id Destructor.
Definition sds.hh:1286
virtual void FillArray(const Id &elem)
Fill out the contents of this object, which is a structured array.
Definition sds.hh:1834
virtual SdsIdType COut(const bool outlives, bool *const free=0, bool *const del=0, bool *const readfree=0)
Return this item as an SdsIdType for return to C code.
Definition sds.hh:2317
void ArrayAccess(ArrayAccessHelper< T > *const data, long ndims, ContainerType *dims) const
Access the data of an SDS primitive item array.
Definition sds.hh:2603
virtual void Insert(Id &to_insert)
Insert an SDS object into this object.
Definition sds.hh:1750
virtual Id Index(const long index, bool throwOnNotFound=true) const
Factory constructor method Constructor which returns an id to a structured item indexed by position...
virtual unsigned long Size() const
Return the size of an SDS structure, as required for exporting.
Definition sds.hh:2057
void Get(const unsigned long length, T *const data, unsigned long *actlen=nullptr, const unsigned long offset=0) const
Get data from an SDS item.
Definition sds.hh:1542
static Id CreateArgCmdStructSingle(const T value, const std::string &name="ArgStructure")
Factory constructor which creates a new "Arg" style SDS structure in the DRAMA Command style.
Definition sds.hh:2840
void Put(const std::string &value)
Insert a string value into the component.
Definition sds.hh:3091
virtual void Extract()
Extract the SDS structure from its parent.
Definition sds.hh:1478
virtual void PutExtra(const std::string &extra)
Put extra data into an SDS item.
Definition sds.hh:1969
virtual void List(PrintObjectPnt *printer, int lineMaxLen=100) const
List the contents of the structure via a PrintObjectPnt object.
static Id CreateTopLevel(const std::string &name, const SdsCodeType code, const std::string &extra="")
Constructor which creates a new (non-array) top-level item.
virtual Id Copy() const
Factory constructor method Id Copy constructor.
void AddToArgCmdStruct(const ContainerType &values, const unsigned firstArg=1)
Insert a set of values from a container into an SDS structure in in the DRAMA Command style.
Definition sds.hh:2880
static Id CreateFromSdsIdType(const SdsIdType item, const bool free=false, const bool del=false, const bool readfree=false)
Factory constructor method that constructs an sds::Id item from an existing C language SDS id.
virtual void ShallowCopy(Id *source, const bool outlives)
Shallow copy from sds::Id.
Definition sds.hh:2377
void Put(const unsigned long length, const T *const data, const unsigned long offset=0)
Put data into an SDS item.
Definition sds.hh:1936
virtual void Flush()
Flush data modified by pointer.
Definition sds.hh:1504
static Id CreateArgStruct(const std::string &name="ArgStructure")
Factory constructor which creates a new "Arg" style SDS structure.
void Get(T *value) const
Fetch primitive value from the component.
Definition sds.hh:3113
static Id CreateArgCmdStruct(const std::initializer_list< T > &values, const std::string &name="ArgStructure")
Factory constructor which creates a new "Arg" style SDS structure in the DRAMA Command style.
Definition sds.hh:2804
virtual int GetInt() const
If the SDS item refers to a scalar value, convert it to an integer.
Id()
Default constructor.
Definition sds.hh:611
Id(Id &&source) noexcept
Move copy constructor.
Definition sds.hh:600
Id CreateChildArray(const std::string &name, const SdsCodeType code, const ContainerType &dims, const std::string &extra="") const
Factory constructor method Constructor which creates a new child item which is an multi-dimensional a...
Definition sds.hh:937
std::string GetString() const
If the SDS item refers to a scalar value or a character string, convert it to a string item.
virtual void ShallowCopy(const Id &source)
Shallow copy from a const sds::Id which will outlive this object.
Definition sds.hh:2348
static Id CreateTopLevelArray(const std::string &name, const SdsCodeType code, const ContainerType &dims, const std::string &extra="")
Factory constructor method Constructor which creates a new array top-level item.
Definition sds.hh:1040
void Put(const std::string &name, T value, const std::string &extraData="")
Insert a primitive value into a named component of the structure.
Definition sds.hh:2963
static Id CreateFromSdsIdTypeCopy(const SdsIdType item)
Factory constructor method that constructs an sds::Id item by coping an existing C language SDS id.
static Id CreateNullItem()
Factory constructor method that constructs an null sds::Id item .
virtual bool IsExternal() const
Determine if the SDS structure is external.
Definition sds.hh:2205
virtual std::string toString(int maxlen=200)
Convert the structure to a string.
Definition sds.hh:2912
virtual bool Exists(const std::string &name) const
Determine if a named item exists in a structure.
A C++ Interface to the handling SDS structures.
Definition sds.hh:428
virtual void Print(const std::string &line) const =0
Method invoked to print one line of an SDS listing.
Abstract class which is sub-classed to print SDS item listings.
Definition sds.hh:310
virtual void Print(const std::string &line)=0
Method invoked to print one line of an SDS listing.
Abstract class which is sub-classed to print SDS item listings.
Definition sds.hh:295
#define DramaTHROW_S(status_, format_,...)
Throw a Drama exception with safe string formatting.
Definition exception.hh:108
#define DramaTHROW(status_, message_)
Throw a Drama exception.
Definition exception.hh:87
DRAMA 2 Exception classes.
std::shared_ptr< Id > IdPtr
A shared pointer for sds::Id items.
Definition sds.hh:3312
void CreateRunDramaTask()
Create and run a DRAMA task, with standard exception handling.
Definition task.hh:1322
void CheckLockTaken(const std::string func, const std::string &file, const int lineNum)
Ensure the current thread has taken the DRAMA task lock.
The drama namespace contains all the classes, types etc of the DRAMA 2 implementation.
Definition drama.hh:93
DRAMA 2 include file - drama::sds::ArrayAccessHelper Sds class definitions.