AAO DRAMA C++ Interface (Old style)
DRAMA C++, Depreciated, don't use for new code
sds.h
1/*
2 * Name: filter.m4
3 *
4 * Description:
5 * DOXYGEN Input file filter for DRAMA source files.
6 *
7 * This file must be complatible with both Solaris and GNU m4. All
8 * unused macros are deleted and this comment must end up as a C/C++
9 * compatible comment which is not picked up by DOXYGEN.
10 *
11 * Synopsis:
12 * DCF(func) => Produces a link to a DRAMA C source file func.html
13 * in ../routines.
14 * DDL(link,text) => Produce a link to ../link.html, specified link text.
15 *
16 * Language: m4 macro.
17 *
18 * Author: Tony Farrell, AAO.
19 *
20 * "@(#) $Id$"
21 *
22 * History:
23 * 10-Nov-2004 - TJF - Original Version.
24 */
25
26
27
28/* SDS Include file */
29/* */
30/* Jeremy Bailey 1998 Jul 13 */
31/* */
32/* @(#) $Id$ */
33/* */
34/* */
35/* */
36
37/*
38 * This file now uses DOXYGEN comments to generate the C++ web pages.
39 * m4 macros of the form @htmlonly <a href="../routines/function.html">function()</a>@endhtmlonly are used in the comments
40 * to refer to DRAMA C function documentation (see DramaHtml/Makefile,
41 * DramaHtml/doxygen.config and DramaHtml/filter.m4 for details)
42 */
43#define USE_INTERP_RESULT 1
44#ifndef _SDS_INCLUDE_
45#define _SDS_INCLUDE_ 1
46
47#include "sdsport.h"
48#include "status.h"
49#include <stdio.h>
50
51
52#ifdef __cplusplus
53extern "C" {
54
55#endif
56
62#define SDS_VERSION 100
63
64/* Status codes */
65
66#include "sds_err.h"
67
68/* Type codes */
69
70#define SDS_STRUCT 0 /* Structure */
71#define SDS_CHAR 1 /* Character */
72#define SDS_UBYTE 2 /* Unsigned byte */
73#define SDS_BYTE 3 /* byte */
74#define SDS_USHORT 4 /* Unsigned short */
75#define SDS_SHORT 5 /* short */
76#define SDS_UINT 6 /* Unsigned int */
77#define SDS_INT 7 /* int */
78#define SDS_FLOAT 8 /* float */
79#define SDS_DOUBLE 9 /* double */
80#define SDS_I64 11 /* Int 64 */
81#define SDS_UI64 12 /* Unsigned Int 64 */
82#define SDS_C_MAXCODE SDS_UI64 /* The maximum code value */
83
84
85/*
86 * These three are really part of "arg.h" (which includes this file) but
87 * must be put there so that SdsTypeToStr() can support them and be
88 * built independently of arg.
89 */
90#define ARG_SDS -1
91#define ARG_STRING -2
92#define ARG_STRING2 -3
93
94/* Name length */
95
96#define SDS_C_NAMELEN 16
97
98#define SDS_C_MAXARRAYDIMS 7
99
100#define SDS_WATCH_EVENT_FREE 0
101#define SDS_WATCH_EVENT_DELETE 1
102#define SDS_WATCH_EVENT_READFREE 2
103#define SDS_WATCH_EVENT_NEW 3
104#define SDS_WATCH_EVENT_COPY 4
105#define SDS_WATCH_EVENT_INSERT 5
106#define SDS_WATCH_EVENT_INSERT_CELL 6
107#define SDS_WATCH_EVENT_EXTRACT 7
108#define SDS_WATCH_EVENT_RESIZE 8
109#define SDS_WATCH_EVENT_NEWID 9
110
111typedef long SdsIdType;
112
113typedef long SdsCodeType;
114
115typedef void (*SdsWatchRoutineType)(SdsIdType, void *, int reserved);
116
117/*
118 * Functions defined in sds.c.
119 */
120SDSEXTERN void SdsSetWatch(SdsIdType id,
121 SdsWatchRoutineType watchRoutine,
122 void * clientData,
123 SdsIdType *oldId,
124 SdsWatchRoutineType *oldWatchRoutine,
125 void ** oldClientData,
126 StatusType * SDSCONST status);
127
128SDSEXTERN void SdsCreate(SDSCONST char *name, long nextra, SDSCONST char *extra,
129 SdsIdType *id, StatusType * SDSCONST status);
130
131SDSEXTERN void SdsInfo(SdsIdType id,char *name, SdsCodeType *code, long *ndims,
132 unsigned long* dims, StatusType * SDSCONST status);
133SDSEXTERN void SdsGetName(SdsIdType id, char *name, StatusType * SDSCONST status);
134SDSEXTERN void SdsGetCode(SdsIdType id, SdsCodeType *code,
135 StatusType * SDSCONST status);
136
137SDSEXTERN void SdsGetDims(SdsIdType id, long *ndims,
138 unsigned long *dims, StatusType * SDSCONST status);
139
140SDSEXTERN void SdsNew(SdsIdType parent_id, SDSCONST char *name, long nextra,
141 SDSCONST char *extra, SdsCodeType code, long ndims,
142 SDSCONST unsigned long *dims,
143 SdsIdType *id, StatusType * SDSCONST status);
144
145SDSEXTERN int SdsIsDefined(SdsIdType parent_id, StatusType * SDSCONST status);
146
147SDSEXTERN void SdsIndex(SdsIdType parent_id, long index, SdsIdType *id, StatusType * SDSCONST status);
148SDSEXTERN void SdsNumItems(SdsIdType id, long *numItems, StatusType * SDSCONST status);
149
150SDSEXTERN void SdsFind(SdsIdType parent_id, SDSCONST char *name, SdsIdType *id, StatusType * SDSCONST status);
151
152SDSEXTERN void SdsFindByPath(SdsIdType parent_id, SDSCONST char *name, SdsIdType *id, StatusType * SDSCONST status);
153
154SDSEXTERN void SdsPointer(SdsIdType id, void **data, unsigned long *length, StatusType * SDSCONST status);
155
156SDSEXTERN void SdsGet(SdsIdType id, unsigned long length, unsigned long offset,
157 void *data, unsigned long *actlen, StatusType * SDSCONST status);
158
159SDSEXTERN void SdsPut(SdsIdType id, unsigned long length, unsigned long offset,
160 SDSCONST void *data, StatusType * SDSCONST status);
161
162
163SDSEXTERN void SdsCell(SdsIdType array_id, long nindices,
164 SDSCONST unsigned long *indices,
165 SdsIdType *id, StatusType * SDSCONST status);
166
167
168SDSEXTERN void SdsInsertCell(SdsIdType array_id, long nindices,
169 SDSCONST unsigned long *indices,
170 SdsIdType id, StatusType * SDSCONST status);
171
172SDSEXTERN void SdsDelete(SdsIdType id, StatusType * SDSCONST status);
173
174SDSEXTERN void SdsSize(SdsIdType id, unsigned long *bytes, StatusType * SDSCONST status);
175SDSEXTERN void SdsExport(SdsIdType id, unsigned long length, void *data, StatusType * SDSCONST status);
176
177SDSEXTERN void SdsImport(SDSCONST void *data, SdsIdType *id,
178 StatusType * SDSCONST status);
179
180SDSEXTERN void SdsAccess(void *data, SdsIdType *id, StatusType * SDSCONST status);
181
182SDSEXTERN void SdsExtract(SdsIdType id, StatusType * SDSCONST status);
183
184SDSEXTERN void SdsInsert(SdsIdType parent_id, SdsIdType id, StatusType * SDSCONST status);
185
186SDSEXTERN void SdsCopy(SdsIdType id, SdsIdType *copy_id, StatusType * SDSCONST status);
187
188SDSEXTERN void SdsCloneId(SdsIdType id, SdsIdType *clone_id, StatusType * SDSCONST status);
189
190SDSEXTERN void SdsResize(SdsIdType id, long ndims, SDSCONST unsigned long *dims,
191 StatusType * SDSCONST status);
192
193SDSEXTERN void SdsRename(SdsIdType id, SDSCONST char* name, StatusType * SDSCONST status);
194
195SDSEXTERN void SdsGetExtra(SdsIdType id, long length, char* extra, unsigned long *actlen,
196StatusType * SDSCONST status);
197SDSEXTERN void SdsGetExtraLen(SdsIdType id,
198 unsigned long *length, StatusType * SDSCONST status);
199
200SDSEXTERN void SdsPutExtra(SdsIdType id, long length, SDSCONST char *extra,
201 StatusType * SDSCONST status);
202
203SDSEXTERN void SdsExportDefined(SdsIdType id, unsigned long length, void *data, StatusType * SDSCONST status);
204
205SDSEXTERN void SdsSizeDefined(SdsIdType id, unsigned long *bytes, StatusType * SDSCONST status);
206
207SDSEXTERN void SdsIsExternal(SdsIdType id, int *external, StatusType * SDSCONST status);
208
209SDSEXTERN void SdsGetExternInfo(SdsIdType id, void **data, StatusType * SDSCONST status);
210
211SDSEXTERN void SdsListInUse();
212
213/*
214 * Functions defined in sds.c, not intended to be public but needed by
215 * sdsutil.c. sdsutil.c will define _SDS_UTIL_BUILD before this is
216 * included, and sds.c will define _SDS_BUILD.
217 */
218#if defined(_SDS_UTIL_BUILD) || defined (_SDS_BUILD)
219SDSEXTERN void Sds__MarkFree(SdsIdType id);
220
221SDSEXTERN void Sds__Free(SdsIdType id, StatusType * SDSCONST status);
222
223SDSEXTERN void Sds___WatchEvent(SdsIdType id, int eventFlag, const char * sourceFunc);
224
225#endif /* defined _SDS_UTIL_BUILD */
226
227/*
228 * Functions used to work with 64 bit data on machines
229 * without any native 64 bit type .
230 *
231 * Note - if you get a syntax error at this point, it is likely
232 * that INT64 has not been defined. See the relevant part of
233 * sdsport.h.
234 */
235SDSEXTERN INT64 SdsSetI64(long high, unsigned long low);
236
237SDSEXTERN UINT64 SdsSetUI64(unsigned long high, unsigned long low);
238
239SDSEXTERN void SdsGetI64(INT64 i64, long *high, unsigned long *low);
240
241SDSEXTERN void SdsGetUI64(UINT64 i64, unsigned long *high, unsigned long *low);
242
243SDSEXTERN double SdsGetI64toD(INT64 i64);
244
245SDSEXTERN double SdsGetUI64toD(UINT64 i64);
246
247/*
248 * Debugging functions.
249 */
250SDSEXTERN void SdsGetIdInfo( INT32 * pnum, INT32 * pasize, INT32 * puids );
251
252SDSEXTERN void SdsFreeIdAndCheck(const char *mes, SdsIdType id, StatusType *status);
253
254SDSEXTERN unsigned Sds___GetIdBlockSize();
255SDSEXTERN void Sds___GetIdUsage(int size, unsigned char *array, StatusType *status);
256/*
257 * These two macros used by SdsCheckBuild().
258 */
259#ifdef NATIVE__INT64
260#define __SDS_NATIVE__INT64 1
261#else
262#define __SDS_NATIVE__INT64 0
263#endif
264#ifdef LONG__64
265#define __SDS_LONG__64 1
266#else
267#define __SDS_LONG__64 0
268#endif
269
270extern void Sds___CheckBuild(int bigend, int long_64, int native_64, StatusType *status);
271#define SdsCheckBuild(_status_) Sds___CheckBuild(SDS_BIGEND, __SDS_LONG__64, __SDS_NATIVE__INT64, (_status_));
272
273
274/*
275 * These ones are defined in sdsutil.c
276 */
277SDSEXTERN void SdsList(SdsIdType id, StatusType * SDSCONST status);
278SDSEXTERN void SdsListTo(FILE *to, SdsIdType id, StatusType * SDSCONST status);
279
280SDSEXTERN void SdsWrite(SdsIdType id, SDSCONST char *filename, StatusType * SDSCONST status);
281
282SDSEXTERN void SdsFreeId(SdsIdType id, StatusType * SDSCONST status);
283
284SDSEXTERN void SdsFlush(SdsIdType id, StatusType * SDSCONST status);
285
286SDSEXTERN void SdsRead(SDSCONST char *filename, SdsIdType *id, StatusType * SDSCONST status);
287
288SDSEXTERN void SdsFillArray(SdsIdType array_id, SdsIdType elem_id,
289 StatusType * SDSCONST status);
290
291
292SDSEXTERN void SdsReadFree(SdsIdType id, StatusType * SDSCONST status);
293SDSEXTERN SDSCONST char *SdsTypeToStr(SdsCodeType code, int mode);
294SDSEXTERN void SdsFindByName( SdsIdType parent_id,
295 SDSCONST char * name,
296 unsigned int * skip,
297 SdsIdType * id,
298 StatusType * SDSCONST status );
299
300
301SDSEXTERN SDSCONST char * SdsErrorCodeString(StatusType error);
302
303
304
305
306
307
309 INT32 _init_last_id;
310 INT32 _init_current_array_size;
311 INT32 _init_unused_ids;
312 INT32 leakCount;
313 INT32 usedAfter;
314 INT32 usedBefore;
315 INT32 allow;
316};
317typedef struct SdsCheckStruct SdsCheckType;
318
319SDSEXTERN void SdsCheckInit(SdsCheckType *chkData, StatusType *status);
320SDSEXTERN void SdsCheck(const char *mes, SdsCheckType *chkData,
321 StatusType *status);
322
323/* End of functions defined in sdsutil.c */
324
325
326
327#define SDS_COMP_MESS_ERROR 1
328#define SDS_COMP_MESS_WARN 2
329
330/*
331 * Defined in sdsc.c.
332 */
333SDSEXTERN void SdsCompiler(SDSCONST char *string, int messages, int intaslong, SdsIdType *id, StatusType *status);
334
335
336
337
338#if defined(SDS_CHECK_FREE)||defined(SDS_CHECK_FREE_W)
339#ifndef SdsFreeId
340#ifdef SDS_CHECK_FREE_W
341#warning "Checking SdsFree operations"
342#endif
343/*
344 * Note - the C++ version does its own thing below - see cleanup().
345 */
346#define SdsFreeId(_id_, _status) \
347 { \
348 if (*(_status) == STATUS__OK) \
349 { \
350 SdsFreeIdAndCheck("", (_id_), (_status)); \
351 if (*(_status) == SDS__CHK_FREE) \
352 { \
353 fprintf(stderr, " At file %s, line %d\n", __FILE__, __LINE__); \
354 fprintf(stderr, " This warning was enabled by SDS_CHECK_FREE or SDS_CHECK_FREE_W macro\n"); \
355 *(_status) = STATUS__OK; \
356 } \
357 } \
358 }
359#endif
360#endif
361
362
363
364#ifdef __cplusplus
365
366} /* extern "C" */
367
368/*
369 * C++ only section.
370 *
371 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
372 * Here is the a C++ interface to SDS. No object code is required since
373 * all code is inline.
374 *
375 */
408#ifdef DRAMA_ALLOW_CPP_STDLIB
409#include <string>
410template <typename T> class SdsArrayAccessHelper {
411public:
412 friend class SdsId;
413 /* Some exceptions thrown from the subscript operator */
419 std::string detail;
420 public:
425 NoDataException(const char *why) :detail(why) { }
429 std::string const & GetDetails() const { return detail; };
430
431 };
437 std::string detail;
438 public:
443 InvalidIndexException(const char *why) :detail(why) { }
447 std::string const & GetDetails() const { return detail; };
448 };
449
450private:
451 SdsCodeType code; /* The SDS code of the item */
452 unsigned long elements; /* Number of element in the array */
453 T* data; /* The array pointer is written here */
454
455 /*
456 * Help function used to check an index is valid. Also checks
457 * that we have some data. Throws expections on problems.
458 */
459 void CheckIndexAndData(unsigned long index) const {
460 if (!data)
461 {
462 throw new NoDataException("Index %d, Code %d, elements %d - data is invalid");
463 }
464 if (index >= elements)
465 {
466 throw new InvalidIndexException("Index %d, Code %d, elements %d - index is invalid");
467 }
468 }
469
470
471 /*
472 * The remaining private items are accessed by SdsId as a friend class.
473 */
474 /*
475 * Return the address of the address of the data being accessed
476 *
477 * This is used by SdsId.AccessArray() to put the address of the
478 * data item.
479 */
480 void ** Data() { return (void **)&data; }
481
482 /*
483 * Set the number of elements in the array.
484 *
485 * This is used by SdsId.AccessArray() set the number of elements in
486 * the array.
487 */
488 void SetElements(unsigned long nelem) {
489 elements = nelem;
490 }
491
492
493protected:
501 SdsArrayAccessHelper(SdsCodeType c) : code(c), elements(0), data(0) {
502 }
503public:
504
507 SdsCodeType Code() const { return code; }
510 unsigned long Size() const { return elements; }
524 T const & operator[](const unsigned long index) const {
525 CheckIndexAndData(index);
526 return data[index];
527 }
541 T & operator[](const unsigned long index) {
542 CheckIndexAndData(index);
543 return data[index];
544 }
552 return data;
553 }
560 const T * DataAddressRO() const {
561 return data;
562 }
563}; /* SdsArrayAccessHelper */
564
565/*
566 * Classes for each SDS data type.
567 */
574class SdsArrayChar : public SdsArrayAccessHelper<char> {
575public:
577 }
578
579};
586class SdsArrayUbyte : public SdsArrayAccessHelper<unsigned char> {
587public:
589 }
590
591};
598class SdsArrayByte : public SdsArrayAccessHelper<signed char> {
599public:
601 }
602
603};
604
605
612class SdsArrayUshort : public SdsArrayAccessHelper<unsigned short> {
613public:
615 }
616
617};
624class SdsArrayShort : public SdsArrayAccessHelper<short> {
625public:
627 }
628
629};
630
631
632
639class SdsArrayINT32 : public SdsArrayAccessHelper<INT32> {
640public:
642 }
643
644};
651class SdsArrayUINT32 : public SdsArrayAccessHelper<UINT32> {
652public:
654 }
655};
656
657
664class SdsArrayINT64 : public SdsArrayAccessHelper<INT64> {
665public:
667 }
668
669};
676class SdsArrayUINT64 : public SdsArrayAccessHelper<UINT64> {
677public:
679 }
680};
681
688class SdsArrayDouble : public SdsArrayAccessHelper<double> {
689public:
691 }
692};
699class SdsArrayFloat : public SdsArrayAccessHelper<float> {
700 public:
702 }
703};
704
705#endif /* defined DRAMA_ALLOW_CPP_STDLIB */
706
761SDSCLASS SdsId {
762 private:
763 SdsIdType id; /* Actual Sds id. If 0, then no id is allocated */
764 struct {
765 bool free : 1;/* Set true to cause destructor to free the id*/
766 bool del : 1;/* If free is true, destructor will do SdsDelete*/
767 bool readfree : 1;/* if free and del, to SdsReadFree */
768 } flags;
769
770 /* Private routine to clean up, will be called by destructor and
771 Shallow and Deep copy operations */
772
773 /* If this check free code is not to be run, we don't want the from_where argument, it
774 causes warnings in all using code. This macro setup allows that
775 */
776#if defined(SDS_CHECK_FREE)||defined(SDS_CHECK_FREE_W)
777#define SDS__CHECK_ARG(_arg_) _arg_
778#else
779#define SDS__CHECK_ARG(_arg_)
780#endif
781
782
783 void CleanUp(const char * SDS__CHECK_ARG(from_where)) {
784 /* If we have an id and the free flag is set */
785 /* In the future, we should consider do a throw if status goes */
786 /* bad, instead of just ignoring it */
787
788 if ((id)&&(flags.free))
789 {
790 /* If del and readfree, we need to do SdsReadFree */
791 if ((flags.del)&&(flags.readfree))
792 {
793 StatusType ignore = STATUS__OK;
794 SdsReadFree(id,&ignore);
795 }
796 /* If del and not readfree, we need to to SdsDelete */
797 else if (flags.del)
798 {
799 StatusType ignore = STATUS__OK;
800 SdsDelete(id,&ignore);
801 }
802 /* Free the id */
803 StatusType ignore = STATUS__OK;
804#if defined(SDS_CHECK_FREE)||defined(SDS_CHECK_FREE_W)
805 SdsFreeIdAndCheck("", id, &ignore);
806 if (ignore != STATUS__OK)
807 {
808 fprintf(stderr, "SDS FreeId failure in C++ cleanup(), called from \"%s\" for id %d\n", from_where,(int)id);
809 fprintf(stderr, " Status Code:%s\n", SdsErrorCodeString(ignore));
810 fprintf(stderr, " SdsId object address is %p\n", (void *)(this));
811 fprintf(stderr, " Sorry - don't have more exact location information\n");
812 fprintf(stderr, " This warning was enabled by SDS_CHECK_FREE or SDS_CHECK_FREE_W macro\n");
813 }
814#else
815 SdsFreeId(id,&ignore);
816#endif
817
818 }
819 }
820 /* Assignment and Copy operators, made private to avoid misuse */
821 SdsId& operator=(const SdsId& a); /* Assignment */
822 SdsId(const SdsId&); /* Copy */
823
824
825#ifdef DRAMA_ALLOW_CPP_STDLIB
826 /* This is used by the ArrayAccess methods to check the item
827 is appropriate for the SdsArrayAccessHelper being used
828 */
829 void CheckArrayType(
830 const SdsCodeType code, /* Expected code */
831 const int ndims, /* Expected number of dims */
832 unsigned long * const dims, /* Actual dims written here */
833 StatusType * const status) {
834
835 if (*status != STATUS__OK) return;
836 char name[SDS_C_NAMELEN];
837 SdsCodeType tcode;
838 long tndims;
839 /*
840 * Get details on the object.
841 */
842 Info(name, &tcode, &tndims, dims, status);
843 /*
844 * Check the code and number of dimensions are correct.
845 */
846 if (tcode != code)
847 {
848 *status = SDS__TYPE;
849 return;
850 }
851 if (tndims == 0)
852 {
853 *status = SDS__NOTARR;
854 return;
855 }
856 if (tndims != ndims)
857 {
858 *status = SDS__INVDIMS;
859 return;
860 }
861
862 }
863 /*
864 * A simplified access to CheckArrayType, for a single dimensional
865 * array.
866 */
867 void CheckArrayTypeSingleDim(
868 const SdsCodeType code,
869 unsigned long * const nitems, /* Actual number of items written here*/
870 StatusType * const status) {
871
872 unsigned long dims[SDS_C_MAXARRAYDIMS];
873 CheckArrayType(code, 1, dims, status);
874 if (*status != STATUS__OK) return;
875 *nitems = dims[0];
876
877 }
878#endif /* defined DRAMA_ALLOW_CPP_STDLIB */
879
880 public:
909 SdsId(const SdsIdType item = 0, const bool free=false,
910 const bool del = false, const bool readfree = false) :
911 id(item) {
912 flags.free = free;
913 flags.del = del;
914 flags.readfree = readfree;
915 }
935 SdsId(void * const data, StatusType * const status,
936 const bool import = false) :
937 id(0) {
938 flags.free = true;
939 flags.readfree = false;
940 if (import)
941 {
942 SdsImport(data,&id,status);
943 flags.del = true;
944 }
945 else
946 {
947 SdsAccess(data,&id,status);
948 flags.del = false;
949 }
950 }
967 SdsId(const void * const data, StatusType * const status) : id(0) {
968 flags.free = true;
969 flags.readfree = false;
970 flags.del = true;
971 SdsImport(data,&id,status);
972 }
986 SdsId(const char * const filename, StatusType * const status) :
987 id(0) {
988 flags.free = true;
989 flags.del = true;
990 flags.readfree = true;
991 SdsRead(filename,&id,status);
992 }
1008 SdsId(const SdsId &parent_id, const char * const name,
1009 const SdsCodeType code,
1010 StatusType * const status, const long nextra = 0,
1011 const char * const extra = 0) :
1012 id(0) {
1013 flags.free = true;
1014 flags.del = false;
1015 flags.readfree = false;
1016 SdsNew(parent_id.id,name,nextra,extra,code,0,0,&id,status);
1017 }
1029 SdsId(const char * const name, const SdsCodeType code,
1030 StatusType * const status, const long nextra = 0,
1031 const char * const extra = 0) :
1032 id(0) {
1033 flags.free = true;
1034 flags.del = true;
1035 flags.readfree = false;
1036 SdsNew(0,name,nextra,extra,code,0,0,&id,status);
1037 }
1055 SdsId(const SdsId &parent_id, const char * const name,
1056 const SdsCodeType code,
1057 const long ndims, const unsigned long *dims,
1058 StatusType * const status, const long nextra = 0,
1059 const char * const extra = 0) :
1060 id(0) {
1061 flags.free = true;
1062 flags.del = false;
1063 flags.readfree = false;
1064 SdsNew(parent_id.id,name,nextra,extra,code,ndims,dims,&id,status);
1065 }
1081 /* Constructor which creates a new array top-level item */
1082 SdsId(const char * const name, const SdsCodeType code,
1083 const long ndims, const unsigned long *dims,
1084 StatusType * const status, const long nextra = 0,
1085 const char * const extra = 0) :
1086 id(0) {
1087 flags.free = true;
1088 flags.del = true;
1089 flags.readfree = false;
1090 SdsNew(0,name,nextra,extra,code,ndims,dims,&id,status);
1091 }
1092
1106 SdsId(const SdsId &array_id, const long nindicies,
1107 const unsigned long * const indicies, StatusType * const status) :
1108 id(0) {
1109 flags.free = true;
1110 flags.del = false;
1111 flags.readfree = false;
1112 SdsCell(array_id.id, nindicies, indicies, &id,status);
1113 }
1126 SdsId(const SdsId& source, StatusType * const status):
1127 id(0) {
1128 flags.free = true;
1129 flags.del = true;
1130 flags.readfree = false;
1131 SdsCopy(source.id, &id, status);
1132 }
1145 SdsId(const SdsId& source, const char * const name,
1146 StatusType * const status) :
1147 id(0) {
1148 flags.free = true;
1149 flags.del = false;
1150 flags.readfree = false;
1151 SdsFind(source.id,name,&id,status);
1152 }
1153
1168 SdsId(const SdsId& source, const long index, StatusType * const status):
1169 id(0) {
1170 flags.free = true;
1171 flags.del = false;
1172 flags.readfree = false;
1173 SdsIndex(source.id,index,&id,status);
1174 }
1175
1192 /*Just invoke the private cleanup routine */
1193 virtual ~SdsId() {
1194 CleanUp("SdsId destructor");
1195 }
1196 /* Modify flags */
1197
1203 void SetFree() { flags.free = true; }
1209 void SetDelete() { flags.del = true; }
1210
1219 void ClearDelete() { flags.del = false; }
1220
1228 void Outlive() { flags.free = false; flags.del = false;
1229 flags.readfree = false; }
1230
1231/*
1232 * General operations, as per similar Sds operation.
1233 * Currently only Delete, Get and Put are virtual.
1234 */
1235
1252 virtual void Delete(StatusType * const status) {
1253 SdsDelete(id,status);
1254 if (*status == STATUS__OK)
1255 {
1256 flags.del = false;
1257 if (flags.free)
1258 {
1259 SdsFreeId(id, status);
1260 if (*status == STATUS__OK)
1261 {
1262 id = 0;
1263 flags.free = false;
1264 }
1265 }
1266 }
1267 }
1290 void Export(const unsigned long length,
1291 void * const data,
1292 StatusType * const status) {
1293 SdsExport(id,length,data,status);
1294 }
1314 void ExportDefined(const unsigned long length,
1315 void * const data,
1316 StatusType * const status) {
1317 SdsExportDefined(id,length,data,status);
1318 }
1331 void Extract(StatusType * const status) {
1332 SdsExtract(id,status);
1333 /* If we succeed, we need to modify the flags to appropiate for
1334 and indepent toplevel item */
1335 if (*status == STATUS__OK)
1336 {
1337 flags.free = true;
1338 flags.del = true;
1339 flags.readfree = false;
1340 }
1341 }
1355 void Flush(StatusType * const status) {
1356 SdsFlush(id,status);
1357 }
1380 virtual void Get(const unsigned long length,
1381 void * const data,
1382 StatusType * const status,
1383 unsigned long *actlen = 0,
1384 const unsigned long offset=0) const
1385 {
1386 unsigned long myactlen;
1387 if (!actlen) actlen = &myactlen;
1388 SdsGet(id,length,offset,data,actlen,status);
1389 }
1406 void GetExtra(const unsigned long length,
1407 char * const extra,
1408 StatusType * const status,
1409 unsigned long *actlen = 0) const
1410 {
1411 unsigned long myactlen;
1412 if (!actlen) actlen = &myactlen;
1413 SdsGetExtra(id,length,extra,actlen,status);
1414 }
1435 void Info(char * const name,
1436 SdsCodeType * const code,
1437 long * const ndims,
1438 unsigned long * const dims,
1439 StatusType * const status) const {
1440 SdsInfo(id,name,code,ndims,dims,status);
1441 }
1442 /* Give access to individual things normally returned by SdsInfo*/
1458 void GetName(char * const name,
1459 StatusType * const status) const {
1460 SdsCodeType code;
1461 long ndims;
1462 unsigned long dims[SDS_C_MAXARRAYDIMS];
1463 SdsInfo(id,name,&code,&ndims,dims,status);
1464 }
1480 void Code(SdsCodeType * const code,
1481 StatusType * const status) const {
1482 char name[SDS_C_NAMELEN];
1483 long ndims;
1484 unsigned long dims[SDS_C_MAXARRAYDIMS];
1485 SdsInfo(id,name,code,&ndims,dims,status);
1486 }
1506 void Dims(long * const ndims, unsigned long * const dims,
1507 StatusType * const status) const {
1508 char name[SDS_C_NAMELEN];
1509 SdsCodeType code;
1510 SdsInfo(id,name,&code,ndims,dims,status);
1511 }
1522 void Insert(SdsId & to_insert, StatusType * const status) {
1523 SdsInsert(id,to_insert.id,status);
1524 /* If we succeed, the new child should not be deleted when
1525 it's id is destroyed, so clear the flag */
1526 if (*status == STATUS__OK)
1527 to_insert.flags.del = false;
1528 }
1543 void Insert(SdsId & to_insert, const long ndims,
1544 const unsigned long * const dims,
1545 StatusType * const status) {
1546 SdsInsertCell(id,ndims,dims,to_insert.id,status);
1547 /* If we succeed, the new child should not be deleted when
1548 it's id is destroyed, so clear the flag */
1549 if (*status == STATUS__OK)
1550 to_insert.flags.del = false;
1551 }
1552
1564 void FillArray(const SdsId &elem, StatusType * const status) {
1565 SdsFillArray(id,elem.id,status);
1566 }
1567
1592 void Pointer(void **data, StatusType * const status,
1593 unsigned long * length = 0) {
1594 unsigned long mylength;
1595 if (!length) length = &mylength;
1596 SdsPointer(id,data,length,status);
1597 }
1598
1619 virtual void Put(const unsigned long length,
1620 void * const data,
1621 StatusType * const status,
1622 const unsigned long offset=0)
1623 {
1624 SdsPut(id,length,offset,data,status);
1625 }
1640 void PutExtra(const long nextra,
1641 const char * const extra,
1642 StatusType * const status)
1643 {
1644 SdsPutExtra(id,nextra,extra,status);
1645 }
1655 void Rename(const char * const name,
1656 StatusType * const status) {
1657 SdsRename(id,name,status);
1658 }
1682 void Resize(const long ndims, const unsigned long *dims,
1683 StatusType * const status) {
1684 SdsResize(id,ndims,dims,status);
1685 }
1694 void Size(unsigned long * const bytes,
1695 StatusType * const status) const {
1696 SdsSize(id,bytes,status);
1697 }
1707 void SizeDefined(unsigned long * const bytes,
1708 StatusType * const status) const {
1709 SdsSizeDefined(id,bytes,status);
1710 }
1717 void List(StatusType * const status) const {
1718 SdsList(id,status);
1719 }
1726 void List(FILE *to, StatusType * const status) const {
1727 SdsListTo(to, id,status);
1728 }
1729
1741 void Write(const char * const filename,
1742 StatusType * const status) const {
1743 SdsWrite(id,filename,status);
1744 }
1745
1758 void IsExternal(int * const external,
1759 StatusType * const status) const {
1760 SdsIsExternal(id, external, status);
1761 }
1773 void GetExternInfo(void **data,
1774 StatusType * const status) const {
1775 SdsGetExternInfo(id, data, status);
1776 }
1777
1789 operator SdsIdType(void) const { return id; }
1790
1796 /* Note, if there is no bool type, we can just use the above operator which
1797 returns the Sds id. Similary for Borland and Sunpro CC (Version 6) which do not like
1798 this operator (ambigious with the above operator
1799 */
1800# if (!defined(CPP_NOBOOL)) && (!defined(BORLAND)) && (!defined(__SUNPRO_CC))
1801 operator bool(void) const { return (id != 0); }
1802# endif
1803
1831 SdsIdType COut(const bool outlives, bool * const free = 0,
1832 bool * const del= 0, bool * const readfree = 0) {
1833 if (free)
1834 *free = flags.free;
1835 if (del)
1836 *del = flags.del;
1837 if (readfree)
1838 *readfree = flags.readfree;
1839 if (outlives)
1840 flags.free = flags.del = flags.readfree = false;
1841 return (SdsId::id);
1842 }
1843 /* Obsolete version */
1873 void COut(const bool outlives, SdsIdType *item, bool * const free = 0,
1874 bool * const del= 0, bool * const readfree = 0) {
1875 *item = COut(outlives,free,del,readfree);
1876 }
1877
1878
1904 void Find(const SdsId& source,
1905 const char * const name,
1906 StatusType * const status) {
1907 CleanUp("SdsId::Find"); /* Run destructor on old id */
1908
1909 flags.free = true;
1910 flags.del = false;
1911 flags.readfree = false;
1912 SdsFind(source.id,name,&id,status);
1913 }
1914
1932 void ShallowCopy (SdsId & source, const bool outlives=true) {
1933 if (this != &source)
1934 {
1935 CleanUp("SdsId::ShallowCopy 1"); /* Run destructor on old id */
1936 id = source.id;
1937 if (outlives)
1938 {
1939 /* If we will outlive the source, then we copy the source's
1940 * flags and set the sources flags to false.
1941 */
1942
1943 flags.free = source.flags.free;
1944 flags.del = source.flags.del;
1945 flags.readfree = source.flags.readfree;
1946
1947 source.flags.free = source.flags.del =
1948 source.flags.readfree = false;
1949 }
1950 else
1951 {
1952 flags.free = flags.del = flags.readfree = false;
1953 }
1954 }
1955 }
1968 void DeepCopy (const SdsId &source, StatusType * const status)
1969 {
1970 if (this != &source)
1971 {
1972 CleanUp("SdsId::DeepCopy 1"); /* Run destructor code on old id */
1973 id = 0;
1974 SdsCopy(source.id,&id,status);
1975 flags.free = true;
1976 flags.del = true;
1977 flags.readfree = false;
1978 }
1979 else
1980 {
1981 /*
1982 * this = &source;
1983 *
1984 * Deep copy of self. If this item is external, then
1985 * we actual do a copy - but we have to get the ordering
1986 * right. This ensures that DeepCopy() always gives us
1987 * something we can modify the structure of.
1988 */
1989 int external;
1990 SdsIsExternal(id, &external, status);
1991 if (external)
1992 {
1993 /*
1994 * copy this to a new SDS id..
1995 */
1996 SdsIdType newId;
1997 SdsCopy(id,&newId,status);
1998
1999 if (*status == STATUS__OK)
2000 {
2001 /*
2002 * Run the contructor on "this" and then set up
2003 * this again.
2004 */
2005 CleanUp("SdsId::DeepCopy 2");
2006 id = newId;
2007 flags.free = true;
2008 flags.del = true;
2009 flags.readfree = false;
2010
2011 }
2012
2013 }
2014 }
2015 }
2016
2017
2037 void ShallowCopy (const SdsIdType source, const bool free=false,
2038 const bool del = false, const bool readfree = false)
2039 {
2040 CleanUp("SdsId::ShallowCopy 2"); /* Run destructor on old id */
2041 flags.free = free;
2042 flags.del = del;
2043 flags.readfree = readfree;
2044 id = source;
2045 }
2053 void DeepCopy (const SdsIdType source, StatusType *status)
2054 {
2055 CleanUp("SdsId::DeepCopy 3"); /* Run destructor code on old id */
2056 id = 0;
2057 SdsCopy(source,&id,status);
2058 flags.free = true;
2059 flags.del = true;
2060 flags.readfree = false;
2061 }
2062#ifdef DRAMA_ALLOW_CPP_STDLIB
2100 template <typename T> void ArrayAccess(
2101 SdsArrayAccessHelper<T> * const data,
2102 StatusType *const status) {
2103
2104 unsigned long dims[SDS_C_MAXARRAYDIMS];
2105 CheckArrayTypeSingleDim(data->Code(), dims, status);
2106 if (*status != STATUS__OK) return;
2107 data->SetElements(dims[0]);
2108
2109 Pointer(data->Data(), status);
2110 }
2151 template <typename T> void ArrayAccess(
2152 const unsigned long expitems, /* Expected number of elements in array*/
2153 SdsArrayAccessHelper<T> * const data,
2154 StatusType *const status) {
2155
2156 unsigned long dims[SDS_C_MAXARRAYDIMS];
2157 CheckArrayTypeSingleDim(data->Code(), dims, status);
2158 if (*status != STATUS__OK) return;
2159 if (dims[0] != expitems)
2160 {
2161 *status = SDS__INVDIMS;
2162 return;
2163 }
2164 data->SetElements(dims[0]);
2165 Pointer(data->Data(), status);
2166 }
2209 template <typename T> void ArrayAccess(
2210 SdsArrayAccessHelper<T> * const data,
2211 long ndims,
2212 unsigned long dims[],
2213 StatusType *const status) {
2214
2215 if ((ndims < 1)||(ndims > 7))
2216 {
2217 *status = SDS__INVDIMS;
2218 return;
2219 }
2220 CheckArrayType(data->Code(), ndims, dims, status);
2221 if (*status != STATUS__OK) return;
2222
2223 /*
2224 * work out the number of elements
2225 */
2226 unsigned long elements = dims[0];
2227 for (long i = 1; i < ndims ; ++i)
2228 {
2229 elements *= dims[i];
2230 }
2231 data->SetElements(elements);
2232 /*
2233 * Access the data.
2234 */
2235 Pointer(data->Data(), status);
2236 }
2237
2238
2284 template <typename T> void ArrayAccess(
2285 SdsArrayAccessHelper<T> * const data,
2286 long *ndims,
2287 unsigned long dims[],
2288 StatusType *const status) {
2289
2290 /*
2291 * A bit of a pain, we need to call Dims to get the number
2292 * of dimensions.
2293 */
2294 Dims(ndims, dims, status);
2295 /*
2296 * The use the above version where we know the number of dimenions
2297 */
2298 ArrayAccess(data, *ndims, dims, status);
2299 }
2300
2301
2302
2303#endif /* defined DRAMA_ALLOW_CPP_STDLIB */
2304
2305
2306}; /* class SdsId */
2307
2308SDSEXTERN const SdsId SdsNull;
2309
2310#ifdef DRAMA_ALLOW_CPP_STDLIB
2311#include <stdio.h>
2320#include <vector>
2322private:
2323 SdsCheckType _chkData;
2324 int _line;
2325 std::string _file;
2326 std::string _function;
2327 bool _enabled;
2328 bool _listChanges;
2329 std::vector<unsigned char> _idUseOnEntry;
2330 static unsigned _checkNum;
2331public:
2356 SdsIDChecker(int line, const char *file, const char *function, bool listChanges = false, bool enable=true);
2362 void SetLeakCount(int leaksAllowedCount) {
2363 _chkData.allow = leaksAllowedCount;
2364 }
2365
2370 ++_chkData.allow;
2371 }
2375 --_chkData.allow;
2376 }
2381 int getLeakAllowance() { return _chkData.allow; }
2382
2388 virtual ~SdsIDChecker();
2389private:
2390 /* Invoked by destructor to output leak/release details. Argument would be leaked/released.*/
2391 void print(const char *reason) const;
2392 /* Print details of which IDs were released or freed, if listChanges is true. */
2393 void printChanges() const;
2394
2395
2396};
2408#define SDS_CHECK_IDS(_function_) SdsIDChecker _sds_id_checker(__LINE__, __FILE__, (_function_))
2409#endif /* defined DRAMA_ALLOW_CPP_STDLIB */
2410
2411
2412#endif
2413
2414/* Define SdsMalloc and SdsFree. These are normally just defined
2415 to malloc and free but sometimes when debugging we want different
2416 versions
2417 */
2418
2419#define SdsMalloc(_size) (void *)malloc(_size)
2420#define SdsFree(_where) (void)free((void *)(_where))
2421
2422#endif
2423
2424
std::string const & GetDetails() const
Return reason why the exception was thrown.
Definition sds.h:447
InvalidIndexException(const char *why)
InvalidIndexException Constructor.
Definition sds.h:443
This class is thrown by the SdsArrayAccessHelper index operator when it is found the index is invalid...
Definition sds.h:436
std::string const & GetDetails() const
Return reason why the exception was thrown.
Definition sds.h:429
NoDataException(const char *why)
NoDataException Constructor.
Definition sds.h:425
This class is thrown by the SdsArraAccessHelper index operator when it is found there is no data to a...
Definition sds.h:418
SdsCodeType Code() const
Return the SDS type code of the item being accessed.
Definition sds.h:507
T const & operator[](const unsigned long index) const
SDS array subscript operator (const version)
Definition sds.h:524
const T * DataAddressRO() const
Access the data directly - read only.
Definition sds.h:560
unsigned long Size() const
Return the number of elements in the array.
Definition sds.h:510
T * DataAddressRW()
Access the data directly.
Definition sds.h:551
T & operator[](const unsigned long index)
SDS array subscript operator (non-const version)
Definition sds.h:541
SdsArrayAccessHelper(SdsCodeType c)
Constructor - only available to sub-classes.
Definition sds.h:501
Helper class for access to an SDS Scaler Array.
Definition sds.h:410
This is the SdsArrayAccessHelper class Instantiated for access to SDS_BYTE type items.
Definition sds.h:598
This is the SdsArrayAccessHelper class Instantiated for access to SDS_CHAR type items.
Definition sds.h:574
This is the SdsArrayAccessHelper class Instantiationed for access ot SDS_DOUBLE type items.
Definition sds.h:688
This is the SdsArrayAccessHelper class Instantiated for access ot SDS_FLOAT type items.
Definition sds.h:699
This is the SdsArrayAccessHelper class Instantiationed for access ot SDS_INT type items.
Definition sds.h:639
This is the SdsArrayAccessHelper class Instantiationed for access ot SDS_I64 type items.
Definition sds.h:664
This is the SdsArrayAccessHelper class Instantiationed for access ot SDS_SHORT type items.
Definition sds.h:624
This is the SdsArrayAccessHelper class Instantiationed for access ot SDS_UINT type items.
Definition sds.h:651
This is the SdsArrayAccessHelper class Instantiationed for access ot SDS_UI64 type items.
Definition sds.h:676
This is the SdsArrayAccessHelper class Instantiated for access to SDS_UBYTE type items.
Definition sds.h:586
This is the SdsArrayAccessHelper class Instantiated for access to SDS_USHORT type items.
Definition sds.h:612
void SetLeakCount(int leaksAllowedCount)
Set leak allowance count.
Definition sds.h:2362
virtual ~SdsIDChecker()
SdsCheck destructor.
SdsIDChecker(int line, const char *file, const char *function, bool listChanges=false, bool enable=true)
Construct an SdsChecker object.
void DecrLeakCount()
Decrement leak allowance count.
Definition sds.h:2374
int getLeakAllowance()
Get leak count.
Definition sds.h:2381
void IncrLeakCount()
Increment leak allowance count.
Definition sds.h:2369
A class to check for SDS leaks.
Definition sds.h:2321
SdsId(const char *const filename, StatusType *const status)
Constructor which creates an SDS Id after reading a structure from a file.
Definition sds.h:986
SdsId(const void *const data, StatusType *const status)
Constructor that imports a previously exported SDS structure from a const byte stream.
Definition sds.h:967
void Resize(const long ndims, const unsigned long *dims, StatusType *const status)
Change the dimensions of an SDS array.
Definition sds.h:1682
void DeepCopy(const SdsId &source, StatusType *const status)
Replace the item refered to by this object by a deep copy of source.
Definition sds.h:1968
void ArrayAccess(SdsArrayAccessHelper< T > *const data, long ndims, unsigned long dims[], StatusType *const status)
Access the data of an SDS array.
Definition sds.h:2209
void ExportDefined(const unsigned long length, void *const data, StatusType *const status)
Export the SDS structure into a buffer, defining any undefined data.
Definition sds.h:1314
void ArrayAccess(SdsArrayAccessHelper< T > *const data, long *ndims, unsigned long dims[], StatusType *const status)
Access the data of an SDS array.
Definition sds.h:2284
virtual ~SdsId()
SdsId Destructor.
Definition sds.h:1193
void ShallowCopy(const SdsIdType source, const bool free=false, const bool del=false, const bool readfree=false)
Shallow copy from SdsIdType.
Definition sds.h:2037
virtual void Get(const unsigned long length, void *const data, StatusType *const status, unsigned long *actlen=0, const unsigned long offset=0) const
Get data from an SDS item.
Definition sds.h:1380
SdsId(const SdsId &source, StatusType *const status)
SdsId Copy constructor.
Definition sds.h:1126
void Write(const char *const filename, StatusType *const status) const
Write the contents of the structure to a file.
Definition sds.h:1741
void List(FILE *to, StatusType *const status) const
List the contents of the structure to a C file.
Definition sds.h:1726
SdsId(const SdsId &source, const char *const name, StatusType *const status)
Constructor which returns a reference to a named item.
Definition sds.h:1145
void SetDelete()
Indicate the underlying SDS structure should be deleted when the SdsId object is destroyed.
Definition sds.h:1209
void IsExternal(int *const external, StatusType *const status) const
Determine if the SDS structure is external.
Definition sds.h:1758
void GetName(char *const name, StatusType *const status) const
Return the name of the SDS item.
Definition sds.h:1458
void ArrayAccess(const unsigned long expitems, SdsArrayAccessHelper< T > *const data, StatusType *const status)
Access the data of a single dimensional SDS array.
Definition sds.h:2151
void SetFree()
Indicate the underlying SDS item should be free-ed when the SdsId object is destroyed.
Definition sds.h:1203
void Info(char *const name, SdsCodeType *const code, long *const ndims, unsigned long *const dims, StatusType *const status) const
Return information about an SDS item.
Definition sds.h:1435
void DeepCopy(const SdsIdType source, StatusType *status)
Replace the item refered to by this object by a deep copy of source.
Definition sds.h:2053
void GetExternInfo(void **data, StatusType *const status) const
Return the address of an external item.
Definition sds.h:1773
void Extract(StatusType *const status)
Extract the SDS structure from its parent.
Definition sds.h:1331
SdsId(const SdsId &parent_id, const char *const name, const SdsCodeType code, const long ndims, const unsigned long *dims, StatusType *const status, const long nextra=0, const char *const extra=0)
Constructor which creates a new array child item.
Definition sds.h:1055
void PutExtra(const long nextra, const char *const extra, StatusType *const status)
Put extra data into an SDS item.
Definition sds.h:1640
void Export(const unsigned long length, void *const data, StatusType *const status)
Export the SDS structure into a buffer.
Definition sds.h:1290
void ShallowCopy(SdsId &source, const bool outlives=true)
Shallow copy from SdsId.
Definition sds.h:1932
void Insert(SdsId &to_insert, const long ndims, const unsigned long *const dims, StatusType *const status)
Insert an SDS object into this object, which is a structured array.
Definition sds.h:1543
void FillArray(const SdsId &elem, StatusType *const status)
Fill out the contents of this object, which is a structured array.
Definition sds.h:1564
void Insert(SdsId &to_insert, StatusType *const status)
Insert an SDS object into this object.
Definition sds.h:1522
void SizeDefined(unsigned long *const bytes, StatusType *const status) const
Return the size of an SDS structure, as required for exporting defined.
Definition sds.h:1707
void ClearDelete()
Indicate the underlying SDS structure should NOT be deleted when the SdsId object is desroyed.
Definition sds.h:1219
SdsId(const SdsId &array_id, const long nindicies, const unsigned long *const indicies, StatusType *const status)
Constructor that returns a cell of an existing array id.
Definition sds.h:1106
virtual void Put(const unsigned long length, void *const data, StatusType *const status, const unsigned long offset=0)
Put data into an SDS item.
Definition sds.h:1619
void Pointer(void **data, StatusType *const status, unsigned long *length=0)
Object a pointer to the data area of a primitive SDS item.
Definition sds.h:1592
SdsId(void *const data, StatusType *const status, const bool import=false)
Constructor that accesses an exported SDS structure in a byte stream.
Definition sds.h:935
SdsId(const char *const name, const SdsCodeType code, const long ndims, const unsigned long *dims, StatusType *const status, const long nextra=0, const char *const extra=0)
Constructor which creates a new array top-level item.
Definition sds.h:1082
void List(StatusType *const status) const
List the contents of the structure to standard output.
Definition sds.h:1717
void GetExtra(const unsigned long length, char *const extra, StatusType *const status, unsigned long *actlen=0) const
Get extra data from an SDS item.
Definition sds.h:1406
void Find(const SdsId &source, const char *const name, StatusType *const status)
Find an SDS object and make available in the current SdsId object.
Definition sds.h:1904
void Rename(const char *const name, StatusType *const status)
Rename the SDS item.
Definition sds.h:1655
SdsId(const SdsId &parent_id, const char *const name, const SdsCodeType code, StatusType *const status, const long nextra=0, const char *const extra=0)
Constructor which creates a new (non-array) child item.
Definition sds.h:1008
void Outlive()
Force the actual SDS ID to outlive the SdsId variable.
Definition sds.h:1228
void Flush(StatusType *const status)
Flush data modified by pointer.
Definition sds.h:1355
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.h:1831
SdsId(const char *const name, const SdsCodeType code, StatusType *const status, const long nextra=0, const char *const extra=0)
Constructor which creates a new (non-array) top-level item.
Definition sds.h:1029
SdsId(const SdsId &source, const long index, StatusType *const status)
Constructor which returns an id to a structured item indexed by position.
Definition sds.h:1168
void COut(const bool outlives, SdsIdType *item, 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.h:1873
void Dims(long *const ndims, unsigned long *const dims, StatusType *const status) const
Return the dimensions of the SDS item.
Definition sds.h:1506
void Size(unsigned long *const bytes, StatusType *const status) const
Return the size of an SDS structure, as required for exporting.
Definition sds.h:1694
virtual void Delete(StatusType *const status)
Delete the SDS item.
Definition sds.h:1252
void Code(SdsCodeType *const code, StatusType *const status) const
Return the code of the SDS item.
Definition sds.h:1480
SdsId(const SdsIdType item=0, const bool free=false, const bool del=false, const bool readfree=false)
Construct an SdsId item from an existing C language SDS id.
Definition sds.h:909
void ArrayAccess(SdsArrayAccessHelper< T > *const data, StatusType *const status)
Access the data of a single dimensional SDS array item.
Definition sds.h:2100
A C++ Interface to the handling SDS structures.
Definition sds.h:761
Definition sds.h:308