AAO DRAMA C++ Interface (Old style)
DRAMA C++, Depreciated, don't use for new code
arg.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#ifndef ARGINC
29#define ARGINC
30/*
31 * @(#) $Id$
32 */
33/*
34 * This file now uses DOXYGEN comments to generate the C++ web pages.
35 * m4 macros of the form @htmlonly <a href="../routines/function.html">function()</a>@endhtmlonly are used in the comments
36 * to refer to DRAMA C function documentation (see DramaHtml/Makefile,
37 * DramaHtml/doxygen.config and DramaHtml/filter.m4 for details)
38 */
39
40#ifdef __cplusplus
41
42/*
43 * If under C++ and this is allowed, then we can add functions which
44 * require the C++ Standard Library (say under GCC 2.95.2 or later).
45 */
46#ifdef DRAMA_ALLOW_CPP_STDLIB
47#include <string>
48#endif
49
50extern "C" {
51
52#endif
53#include "sds.h"
54#include "arg_err.h"
55#include "status.h"
56
57/*
58 * Is const acceptable on this machine.
59 */
60#if defined(__cplusplus) || defined(__STDC__) || defined (VAXC)
61# define ARGCONST const
62#else
63# define ARGCONST /* */
64#endif
65
66
67/*
68 * Under Windows, we may need to export or import the functions, depending
69 * on if we are building the DLL or linking against it.
70 */
71#ifdef WIN32
72#ifdef DRAMA_DLL /* Am building DRAMA DLL */
73#define ARGEXTERN __declspec(dllexport)
74#elif defined(DRAMA_STATIC) /* Building a static library */
75#define ARGEXTERN extern
76#else /* Am building application with DLL */
77#define ARGEXTERN __declspec(dllimport)
78#endif
79
80#else
81#define ARGEXTERN extern
82#endif
83
84/*
85 * If defined, we are using the newer C++ overloads.
86 */
87#define ARG_NEWCPP_OVERLOADS 1
88
89
90ARGEXTERN void ArgNew(SdsIdType *id, StatusType * ARGCONST status);
91ARGEXTERN void ArgPutc(SdsIdType id, ARGCONST char *name, char value,
92 StatusType * ARGCONST status);
93ARGEXTERN void ArgPuts(SdsIdType id, ARGCONST char *name, short value,
94 StatusType * ARGCONST status);
95ARGEXTERN void ArgPutus(SdsIdType id, ARGCONST char *name, unsigned short value,
96 StatusType * ARGCONST status);
97ARGEXTERN void ArgPuti(SdsIdType id, ARGCONST char *name, long value,
98 StatusType * ARGCONST status);
99ARGEXTERN void ArgPuti64(SdsIdType id, ARGCONST char *name, INT64 value,
100 StatusType * ARGCONST status);
101
102ARGEXTERN void ArgPutu(SdsIdType id, ARGCONST char *name, unsigned long value,
103 StatusType * ARGCONST status);
104
105ARGEXTERN void ArgPutu64(SdsIdType id, ARGCONST char *name, UINT64 value,
106 StatusType * ARGCONST status);
107
108ARGEXTERN void ArgPutf(SdsIdType id, ARGCONST char *name, float value,
109 StatusType * ARGCONST status);
110ARGEXTERN void ArgPutd(SdsIdType id, ARGCONST char *name, double value,
111 StatusType * ARGCONST status);
112ARGEXTERN void ArgPutString(SdsIdType id, ARGCONST char *name, ARGCONST char *value,
113 StatusType * ARGCONST status);
114ARGEXTERN void ArgGetc(SdsIdType id, ARGCONST char *name, char *value,
115 StatusType * ARGCONST status);
116ARGEXTERN void ArgGets(SdsIdType id, ARGCONST char *name, short *value,
117 StatusType * ARGCONST status);
118ARGEXTERN void ArgGetus(SdsIdType id, ARGCONST char *name, unsigned short *value,
119 StatusType * ARGCONST status);
120ARGEXTERN void ArgGeti(SdsIdType id, ARGCONST char *name, long *value,
121 StatusType * ARGCONST status);
122ARGEXTERN void ArgGeti64(SdsIdType id, ARGCONST char *name, INT64 *value,
123 StatusType * ARGCONST status);
124
125ARGEXTERN void ArgGetu(SdsIdType id, ARGCONST char *name, unsigned long *value,
126 StatusType * ARGCONST status);
127ARGEXTERN void ArgGetu64(SdsIdType id, ARGCONST char *name, UINT64 *value,
128 StatusType * ARGCONST status);
129
130ARGEXTERN void ArgGetf(SdsIdType id, ARGCONST char *name, float *value,
131 StatusType * ARGCONST status);
132ARGEXTERN void ArgGetd(SdsIdType id, ARGCONST char *name, double *value,
133 StatusType * ARGCONST status);
134ARGEXTERN void ArgGetString(SdsIdType id, ARGCONST char *name, long len, char *value,
135 StatusType * ARGCONST status);
136ARGEXTERN void ArgDelete(SdsIdType id, StatusType * ARGCONST status);
137
138
139ARGEXTERN void ArgCvt (ARGCONST void * SrcAddr, SdsCodeType SrcType, SdsCodeType DstType,
140 void * DstAddr, unsigned long int DstLen ,
141 StatusType * ARGCONST status);
142ARGEXTERN void ArgLook (char *SrcAddr, int USFlag, int MinFlag, SdsCodeType *DstType,
143 StatusType * ARGCONST status);
144
145
146ARGEXTERN void ArgToString (SdsIdType id,int maxlen,int *length,char *string,
147 StatusType * ARGCONST status);
148
149typedef void (*ArgListFuncType)(
150 void *client_data,
151 ARGCONST char *line,
152 StatusType * status);
153ARGEXTERN void ArgSdsList(SdsIdType id, unsigned buflen, char *buffer,
154 ArgListFuncType func, void * client_data,
155 StatusType * ARGCONST status);
156
157
158ARGEXTERN void ArgFind(SdsIdType parent_id, ARGCONST char *name,
159 SdsIdType *id,
160 StatusType * ARGCONST status);
161
162ARGEXTERN void ArgCheckItem(SdsIdType id,
163 SdsCodeType code, long ndims,
164 long * ARGCONST dims,
165 StatusType * ARGCONST status);
166
167
168/*
169 * Methods for creating/setting array items. We don't have the complete
170 * set as yet.
171 */
172ARGEXTERN void ArgPut1DArrayD(SdsIdType id,
173 const char *name,
174 unsigned long dim,
175 const double data[],
176 StatusType * status);
177
178
179ARGEXTERN void ArgPut1DArrayDElem(SdsIdType id,
180 const char *name,
181 unsigned long dim,
182 unsigned int index,
183 double data,
184 StatusType * const status);
185
186
187ARGEXTERN void ArgPut1DArrayI(SdsIdType id,
188 const char *name,
189 unsigned long dim,
190 const INT32 data[],
191 StatusType * status);
192
193
194ARGEXTERN void ArgPut1DArrayIElem(SdsIdType id,
195 const char *name,
196 unsigned long dim,
197 unsigned int index,
198 INT32 data,
199 StatusType * const status);
200
201ARGEXTERN void ArgPut1DArrayB(SdsIdType id,
202 const char *name,
203 unsigned long dim,
204 const unsigned char data[],
205 StatusType * status);
206
207
208ARGEXTERN void ArgPut1DArrayBElem(SdsIdType id,
209 const char *name,
210 unsigned long dim,
211 unsigned int index,
212 unsigned char data,
213 StatusType * const status);
214
215
216
217ARGEXTERN void ArgPut1DArrayS(SdsIdType id,
218 const char *name,
219 unsigned long slen,
220 unsigned long dim,
221 const char *data[],
222 StatusType * status);
223
224
225ARGEXTERN void ArgPut1DArraySElem(SdsIdType id,
226 const char *name,
227 unsigned long slen,
228 unsigned long dim,
229 unsigned int index,
230 const char *data,
231 StatusType * const status);
232
233
234#ifdef __cplusplus
235} /* extern "C" */
236
237
238/*
239 * C++ only section.
240 *
241 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
242 *
243 * Here is the a C++ interface to ARG. No object modifications required since
244 * all code is inline.
245 */
263class Arg : public SdsId {
264 private:
265 /* Assignment and Copy operators, made private to avoid misuse, but
266 this is done in SdsId so would have been prohibited anyway
267 */
268 Arg& operator=(const Arg&); /* Assignment */
269 Arg(const Arg&); /* Copy */
270 public:
271
295 Arg (const SdsIdType item=0, const bool free=false,
296 const bool del = false, const bool readfree = false) :
297 SdsId(item,free,del,readfree) {
298 };
315 Arg (bool /*flag*/, StatusType * const status,
316 const char * const name = "ArgStructure") :
317 SdsId(name, SDS_STRUCT,status) {
318 }
319
332 void New (StatusType * const status,
333 const char * const name = "ArgStructure") {
334 /*
335 * We create the new item and then us SdsId::ShallowCopy to
336 * copy it into this object.
337 */
338 Arg tid(true,status, name);
339 ShallowCopy(tid,true);
340 };
341
356 Arg(const SdsId& source, const char * const name,
357 StatusType * const status) :
358 SdsId(0,false,false,false) {
359 /*
360 * This is confusing since what we really want is to do is SdsFind
361 * but we want the ErsRep reporting facilities of ArgFind, so we
362 * must create this item as a null item, call ArgFind using the
363 * arguments and then use ShallowCopy to copy the SdsIdType to this
364 * item
365 */
366 SdsIdType tid=0;
367 ArgFind(source,name,&tid,status);
368 ShallowCopy(tid,true,false,false);
369 }
370
371
387 void ToString(int maxlen, int *length, char *string,
388 StatusType * const status)
389 {
390 ArgToString(*this,maxlen,length,string,status);
391 }
407 /* More modern naming of this */
408 void toString(int maxlen, int *length, char *string,
409 StatusType * const status) {
410 ToString(maxlen, length, string, status);
411 }
440 void CheckItem(SdsCodeType code,
441 StatusType *status,
442 long ndims=-1,
443 long * dims=0)
444 {
445 ArgCheckItem(*this, code, ndims, dims, status);
446 }
447
448
449# ifndef CPP_NOBOOL
468 void Put (const char *name, bool value, StatusType * const status) {
469 unsigned short v = (int)value;
470 ArgPutus(*this,name,v,status);
471 };
472# endif
487 void Put (const char *name, char value, StatusType * const status) {
488 ArgPutc(*this,name,value,status);
489 };
504 void Put (const char *name, short value, StatusType * const status) {
505 ArgPuts(*this,name,value,status);
506 };
522 void Put (const char *name, unsigned short value,
523 StatusType * const status) {
524 ArgPutus(*this,name,value,status);
525 };
526
542 void Put (const char *name, INT32 value, StatusType * const status) {
543 ArgPuti(*this,name,value,status);
544 };
545
561 void Put (const char *name, UINT32 value, StatusType * const status) {
562 ArgPutu(*this,name,value,status);
563 };
579 void Put (const char *name, INT64 value, StatusType * const status) {
580 ArgPuti64(*this,name,value,status);
581 };
597 void Put (const char *name, UINT64 value, StatusType * const status) {
598 ArgPutu64(*this,name,value,status);
599 };
615 void Put (const char *name, float value, StatusType * const status) {
616 ArgPutf(*this,name,value,status);
617 };
633 void Put (const char *name, double value, StatusType * const status) {
634 ArgPutd(*this,name,value,status);
635 };
653#ifndef DRAMA_ALLOW_CPP_STDLIB
654 // There is a version below which works when CPP_STDLIB is allowed.
655 void Put (const char *name, const char *value, StatusType * const status) {
656 ArgPutString(*this,name,value,status);
657 };
658#endif
659
660# ifndef CPP_NOBOOL
676 void Get (const char *name, bool * value,
677 StatusType * const status)const {
678 unsigned short v;
679 ArgGetus(*this,name,&v,status);
680 *value = v ? true : false;
681 }
682# endif
683
684
707 void Put (const char *name, const long dim, const double data[],
708 StatusType * const status) {
709 ArgPut1DArrayD(*this, name, dim, data, status);
710 };
711
712
713
736 void Put (const char *name, const long dim, const unsigned index,
737 const double data, StatusType * const status) {
738 ArgPut1DArrayDElem(*this, name, dim, index, data, status);
739 };
740
741
742
743
766 void Put (const char *name, const long dim, const INT32 data[],
767 StatusType * const status) {
768 ArgPut1DArrayI(*this, name, dim, data, status);
769 };
770
793 void Put (const char *name, const long dim, const unsigned index,
794 const INT32 data, StatusType * const status) {
795 ArgPut1DArrayIElem(*this, name, dim, index, data, status);
796 };
797
798
799
800
823 void Put (const char *name, const long dim, const unsigned char data[],
824 StatusType * const status) {
825 ArgPut1DArrayB(*this, name, dim, data, status);
826 };
827
828
851 void Put (const char *name, const long dim, const unsigned index,
852 const unsigned char data, StatusType * const status) {
853 ArgPut1DArrayBElem(*this, name, dim, index, data, status);
854 };
855
856
885 void Put (const char *name, const long slen, const long dim, const char *data[],
886 StatusType * const status) {
887 ArgPut1DArrayS(*this, name, slen, dim, data, status);
888 };
889
890
920 void Put (const char *name, const long slen, const long dim, const unsigned index,
921 const char *data, StatusType * const status) {
922 ArgPut1DArraySElem(*this, name, slen, dim, index, data, status);
923 };
924
925
938 void Get (const char *name, char * value, StatusType * const status)const {
939 ArgGetc(*this,name,value,status);
940 }
953 void Get (const char *name, short * value, StatusType * const status)const {
954 ArgGets(*this,name,value,status);
955 }
969 void Get (const char *name, unsigned short * value,
970 StatusType * const status) const {
971 ArgGetus(*this,name,value,status);
972 }
986 void Get (const char *name, INT32 * value, StatusType * const status ) const{
987 long v; /* Since ArgGeti uses long */
988 ArgGeti(*this,name,&v,status);
989 *value = v;
990 }
1004 void Get (const char *name, UINT32 * value,
1005 StatusType * const status)const {
1006 unsigned long v; /* Since ArgGetu always uses long */
1007 ArgGetu(*this,name,&v,status);
1008 *value = v;
1009 }
1023 void Get (const char *name, INT64 * value, StatusType * const status) const{
1024 ArgGeti64(*this,name,value,status);
1025 }
1039 void Get (const char *name, UINT64 * value, StatusType * const status)const{
1040 ArgGetu64(*this,name,value,status);
1041 }
1042
1055 void Get (const char *name, float * value, StatusType * const status) const{
1056 ArgGetf(*this,name,value,status);
1057 }
1070 void Get (const char *name, double * value, StatusType * const status)const {
1071 ArgGetd(*this,name,value,status);
1072 }
1086 void Get (const char *name, long len, char * value,
1087 StatusType * const status) const{
1088 ArgGetString(*this,name,len,value,status);
1089 }
1108 static void List(const SdsId & id, unsigned buflen, char *buffer,
1109 ArgListFuncType func, void * client_data,
1110 StatusType * ARGCONST status) {
1111 ArgSdsList(id,buflen,buffer,func,client_data,status);
1112 }
1113
1114/*
1115 *
1116 * Arg hids some Sds functions, so we redeclare them here.
1117 */
1124 void List(StatusType * const status) const {
1125 SdsList(*this,status);
1126 }
1127
1134 void List(FILE *to, StatusType * const status) const {
1135 SdsListTo(to, *this,status);
1136 }
1137
1160 void Get(const unsigned long length,
1161 void * const data,
1162 StatusType * const status,
1163 unsigned long *actlen = 0,
1164 const unsigned long offset=0) const {
1165 SdsId::Get(length,data,status,actlen,offset);
1166 }
1187 void Put(const unsigned long length,
1188 void * const data,
1189 StatusType * const status,
1190 const unsigned long offset=0)
1191 {
1192 SdsId::Put(length,data,status,offset);
1193 }
1194
1209 void Convert(SdsCodeType DstType,
1210 void * DstAddr,
1211 unsigned long int DstLen ,
1212 StatusType *status)
1213 {
1214 SdsIdType id = SdsIdType(*this); // Grab as an SDS id.
1215 ArgCvt(&id, ARG_SDS, DstType, DstAddr, DstLen, status);
1216 }
1231 Arg(const SdsId &source,
1232 const long index,
1233 StatusType *status) :
1234 SdsId(0, false, false, false)
1235 {
1236 SdsIdType tid = 0;
1237 SdsIndex(source,index,&tid,status);
1238 ShallowCopy(tid,true,false,false);
1239 }
1240
1241#ifdef DRAMA_ALLOW_CPP_STDLIB
1242 /*
1243 * If DRAMA is allowed to use the C++ Standard Template library, then
1244 * we add these functions to arg. All of these are about using
1245 * std::string instead of char[], and the only complicate one
1246 * is the Get function which gets the value as a string.
1247 *
1248 */
1249
1265 Arg(const SdsId &source,
1266 const std::string &name,
1267 StatusType *const status) :
1268 SdsId(0,false,false,false) {
1269 SdsIdType tid=0;
1270 ArgFind(source,name.c_str(),&tid,status);
1271 ShallowCopy(tid,true,false,false);
1272 }
1273
1284 void PutExtra(const std::string &name,
1285 const std::string &extraData,
1286 StatusType *const status) {
1287
1288 if (*status != STATUS__OK) return;
1289 SdsId item(*this, name.c_str(), status);
1290 item.PutExtra(extraData.length(),
1291 extraData.c_str(),
1292 status);
1293 }
1294
1320 void Put (const std::string &name, bool value,
1321 StatusType * const status,
1322 const std::string &extraData="") {
1323 unsigned short v = (int)value;
1324 ArgPutus(*this,name.c_str(),v,status);
1325
1326 if (extraData != "")
1327 {
1328 PutExtra(name, extraData, status);
1329 }
1330 };
1351 void Put (const std::string &name,
1352 char value,
1353 StatusType * const status,
1354 const std::string &extraData="") {
1355 ArgPutc(*this,name.c_str(),value,status);
1356 if (extraData != "")
1357 {
1358 PutExtra(name, extraData, status);
1359 }
1360 };
1381 void Put (const std::string &name,
1382 short value,
1383 StatusType * const status,
1384 const std::string &extraData="") {
1385 ArgPuts(*this,name.c_str(),value,status);
1386 if (extraData != "")
1387 {
1388 PutExtra(name, extraData, status);
1389 }
1390 };
1408 void Put (const std::string &name, unsigned short value,
1409 StatusType * const status) {
1410 ArgPutus(*this,name.c_str(),value,status);
1411 };
1433 void Put (const std::string &name,
1434 INT32 value,
1435 StatusType * const status,
1436 const std::string &extraData="") {
1437 ArgPuti(*this,name.c_str(),value,status);
1438 if (extraData != "")
1439 {
1440 PutExtra(name, extraData, status);
1441 }
1442 };
1464 void Put (const std::string &name,
1465 UINT32 value,
1466 StatusType * const status,
1467 const std::string &extraData="") {
1468 ArgPutu(*this,name.c_str(),value,status);
1469 if (extraData != "")
1470 {
1471 PutExtra(name, extraData, status);
1472 }
1473 };
1474
1496 void Put (const std::string &name,
1497 INT64 value,
1498 StatusType * const status,
1499 const std::string &extraData="") {
1500 ArgPuti64(*this,name.c_str(),value,status);
1501 if (extraData != "")
1502 {
1503 PutExtra(name, extraData, status);
1504 }
1505 };
1527 void Put (const std::string &name,
1528 UINT64 value,
1529 StatusType * const status,
1530 const std::string &extraData="") {
1531 ArgPutu64(*this,name.c_str(),value,status);
1532 if (extraData != "")
1533 {
1534 PutExtra(name, extraData, status);
1535 }
1536 };
1558 void Put (const std::string &name,
1559 float value,
1560 StatusType * const status,
1561 const std::string &extraData="") {
1562 ArgPutf(*this,name.c_str(),value,status);
1563 if (extraData != "")
1564 {
1565 PutExtra(name, extraData, status);
1566 }
1567
1568 };
1590 void Put (const std::string &name,
1591 double value,
1592 StatusType * const status,
1593 const std::string &extraData="") {
1594 ArgPutd(*this,name.c_str(),value,status);
1595 if (extraData != "")
1596 {
1597 PutExtra(name, extraData, status);
1598 }
1599 };
1622 void Put(const char *name,
1623 const std::string &value,
1624 StatusType *status,
1625 const std::string &extraData="") {
1626 ArgPutString(*this, name, value.c_str(), status);
1627 if (extraData != "")
1628 {
1629 PutExtra(name, extraData, status);
1630 }
1631
1632 }
1633 /*
1634 * This actually replaced a version in the non STL section
1635 * above. It is needed to avoid ambiguous overloading cases
1636 */
1637 void Put (const char *name,
1638 const char *value,
1639 StatusType * const status,
1640 const std::string &extraData="") {
1641 ArgPutString(*this,name,value,status);
1642 if (extraData != "")
1643 {
1644 PutExtra(name, extraData, status);
1645 }
1646
1647 };
1648
1672 void Put(const std::string &name,
1673 const std::string &value,
1674 StatusType *status,
1675 const std::string &extraData="") {
1676 ArgPutString(*this, name.c_str(), value.c_str(), status);
1677 if (extraData != "")
1678 {
1679 PutExtra(name, extraData, status);
1680 }
1681 }
1699 void Get (const std::string &name, bool * value,
1700 StatusType * const status) const{
1701 unsigned short v;
1702 ArgGetus(*this,name.c_str(),&v,status);
1703 *value = v ? true : false;
1704 }
1719 void Get (const std::string &name, char * value, StatusType * const status) const {
1720 ArgGetc(*this,name.c_str(),value,status);
1721 }
1736 void Get (const std::string &name, short * value, StatusType * const status) const {
1737 ArgGets(*this,name.c_str(),value,status);
1738 }
1754 void Get (const std::string &name, unsigned short * value,
1755 StatusType * const status) const{
1756 ArgGetus(*this,name.c_str(),value,status);
1757 }
1773 void Get (const std::string &name, INT32 * value,
1774 StatusType * const status) const {
1775 Get(name.c_str(), value, status);
1776 }
1792 void Get (const std::string &name, UINT32 * value,
1793 StatusType * const status) const{
1794 Get(name.c_str(), value, status);
1795 }
1811 void Get (const std::string &name, INT64 * value, StatusType * const status) const {
1812 ArgGeti64(*this,name.c_str(),value,status);
1813 }
1828 void Get (const std::string &name, UINT64 * value, StatusType * const status) const {
1829 ArgGetu64(*this,name.c_str(),value,status);
1830 }
1845 void Get (const std::string &name, float * value, StatusType * const status) const {
1846 ArgGetf(*this,name.c_str(),value,status);
1847 }
1862 void Get (const std::string &name, double * value, StatusType * const status) const {
1863 ArgGetd(*this,name.c_str(),value,status);
1864 }
1886 void Get(const char *name,
1887 std::string *value,
1888 StatusType *status,
1889 int buflen = 100) const {
1890
1891 /* Find the item we are interested in */
1892 Arg ItemId(*this, name, status);
1893 if (*status != STATUS__OK) return;
1894
1895 char tname[SDS_C_NAMELEN];
1896 SdsCodeType code;
1897 long ndims;
1898 unsigned long dims[SDS_C_MAXARRAYDIMS];
1899
1900 /* Get details on this item */
1901 ItemId.Info(tname, &code, &ndims, dims, status);
1902 if (*status != STATUS__OK) return;
1903
1904 if ((code == SDS_CHAR)&&(ndims == 1))
1905 {
1906 /* Character array. Ensure we have sufficent space */
1907 buflen = dims[0] + 1;
1908 }
1909 char *buffer;
1910 buffer = new char[buflen];
1911 if (buffer == 0)
1912 {
1913 *status = ARG__MALLOCERR;
1914 return;
1915 }
1916 ArgGetString(*this, name, buflen, buffer, status);
1917 if (*status == STATUS__OK)
1918 *value = buffer;
1919 delete[] buffer;
1920
1921 }
1922
1923 /*
1924 * Interface to the above were the name string is a std::string.
1925 */
1947 void Get(const std::string &name,
1948 std::string *value,
1949 StatusType *status,
1950 int buflen = 100) const {
1951 Get(name.c_str(), value, status, buflen);
1952 }
1953
1954
1968 void ToString(std::string *s, StatusType * const status, int maxlen=200)
1969 {
1970 /*
1971 * Allocate some space to store the string in.
1972 */
1973 char *string = new char[maxlen];
1974 int length=0;
1975 /*
1976 * ArgToString() does the job for us.
1977 */
1978 ArgToString(*this,maxlen,&length,&string[0],status);
1979 if (*status != STATUS__OK)
1980 {
1981 delete[] string;
1982 *s = "";
1983 return;
1984 }
1985 *s = string;
1986 delete[] string;
1987 }
2000 /* More modern naming of this */
2001 void toString(std::string *s, StatusType * const status, int maxlen=200) {
2002 ToString(s, status, maxlen);
2003 }
2004
2005#endif
2006
2007}; /* class */
2008
2009
2010#endif
2011
2012#endif
void Get(const char *name, UINT64 *value, StatusType *const status) const
Fetch a unsigned 64 bit integer value from a named component of the Arg structure.
Definition arg.h:1039
void Put(const char *name, short value, StatusType *const status)
Insert a short value into a named component of the Arg structure.
Definition arg.h:504
void Get(const char *name, UINT32 *value, StatusType *const status) const
Fetch an unsigned 32 bit integer value from a named component of the Arg structure.
Definition arg.h:1004
void Put(const char *name, INT64 value, StatusType *const status)
Insert a 64 bit integer value into a named component of the Arg structure.
Definition arg.h:579
void PutExtra(const std::string &name, const std::string &extraData, StatusType *const status)
Put the extra data of a named item.
Definition arg.h:1284
static void List(const SdsId &id, unsigned buflen, char *buffer, ArgListFuncType func, void *client_data, StatusType *ARGCONST status)
List an SDS structure through a print function.
Definition arg.h:1108
void Put(const std::string &name, unsigned short value, StatusType *const status)
Insert an unsigned short value into a named component of the Arg structure.
Definition arg.h:1408
Arg(bool, StatusType *const status, const char *const name="ArgStructure")
Arg constructor which creates a new SDS structure.
Definition arg.h:315
void Put(const std::string &name, float value, StatusType *const status, const std::string &extraData="")
Insert an float size real value into a named component of the Arg structure.
Definition arg.h:1558
void Put(const unsigned long length, void *const data, StatusType *const status, const unsigned long offset=0)
Put data into an SDS item.
Definition arg.h:1187
void Get(const char *name, char *value, StatusType *const status) const
Fetch a char value from a named component of the Arg structure.
Definition arg.h:938
void Get(const char *name, INT32 *value, StatusType *const status) const
Fetch a 32 bit integer value from a named component of the Arg structure.
Definition arg.h:986
void Put(const char *name, char value, StatusType *const status)
Insert a char value into a named component of the Arg structure.
Definition arg.h:487
void Get(const std::string &name, std::string *value, StatusType *status, int buflen=100) const
Fetch a string value as a std::string from a named component of the Arg structure.
Definition arg.h:1947
void Put(const char *name, const long slen, const long dim, const char *data[], StatusType *const status)
Insert an array of string into a named component of the Arg structure.
Definition arg.h:885
void Put(const std::string &name, INT64 value, StatusType *const status, const std::string &extraData="")
Insert a 64 bit integer value into a named component of the Arg structure.
Definition arg.h:1496
void Get(const char *name, short *value, StatusType *const status) const
Fetch a short integer value from a named component of the Arg structure.
Definition arg.h:953
void List(StatusType *const status) const
List the contents of the structure to standard output.
Definition arg.h:1124
void Put(const std::string &name, INT32 value, StatusType *const status, const std::string &extraData="")
Insert a 32 bit integer value into a named component of the Arg structure.
Definition arg.h:1433
void Get(const char *name, std::string *value, StatusType *status, int buflen=100) const
Fetch a string value as a std::string from a named component of the Arg structure.
Definition arg.h:1886
void Get(const char *name, long len, char *value, StatusType *const status) const
Fetch a string value as a char * from a named component of the Arg structure.
Definition arg.h:1086
void Put(const char *name, unsigned short value, StatusType *const status)
Insert an unsigned short value into a named component of the Arg structure.
Definition arg.h:522
void Get(const std::string &name, unsigned short *value, StatusType *const status) const
Fetch an unsigned short integer value from a named component of the Arg structure.
Definition arg.h:1754
void Put(const char *name, UINT64 value, StatusType *const status)
Insert an unsigned 64 bit integer value into a named component of the Arg structure.
Definition arg.h:597
void Put(const char *name, const long slen, const long dim, const unsigned index, const char *data, StatusType *const status)
Insert an 1D string array element.
Definition arg.h:920
void Get(const char *name, bool *value, StatusType *const status) const
Insert a char * string into a named component of the Arg structure.
Definition arg.h:676
void Get(const std::string &name, UINT32 *value, StatusType *const status) const
Fetch a 32 bit unsigned integer value from a named component of the Arg structure.
Definition arg.h:1792
Arg(const SdsId &source, const long index, StatusType *status)
Constructor which returns an id to a structured item indexed by position.
Definition arg.h:1231
void Get(const std::string &name, INT64 *value, StatusType *const status) const
Fetch a 64 bit integer value from a named component of the Arg structure.
Definition arg.h:1811
void ToString(int maxlen, int *length, char *string, StatusType *const status)
Convert the structure to a string.
Definition arg.h:387
void Get(const std::string &name, float *value, StatusType *const status) const
Fetch a float size real value from a named component of the Arg structure.
Definition arg.h:1845
void Get(const std::string &name, INT32 *value, StatusType *const status) const
Fetch a 32 bit integer value from a named component of the Arg structure.
Definition arg.h:1773
void Put(const char *name, INT32 value, StatusType *const status)
Insert a 32 bit integer value into a named component of the Arg structure.
Definition arg.h:542
void Put(const char *name, const std::string &value, StatusType *status, const std::string &extraData="")
Insert a std::string into a named component of the Arg structure.
Definition arg.h:1622
void Put(const std::string &name, double value, StatusType *const status, const std::string &extraData="")
Insert an double size real value into a named component of the Arg structure.
Definition arg.h:1590
void Put(const char *name, const long dim, const unsigned index, const unsigned char data, StatusType *const status)
Insert an 1D unsigned char array element.
Definition arg.h:851
void Get(const std::string &name, UINT64 *value, StatusType *const status) const
Fetch a unsigned 64 bit integer value from a named component of the Arg structure.
Definition arg.h:1828
void Get(const char *name, INT64 *value, StatusType *const status) const
Fetch a 64 bit integer value from a named component of the Arg structure.
Definition arg.h:1023
void Put(const char *name, const long dim, const INT32 data[], StatusType *const status)
Insert an array of INT32 into a named component of the Arg structure.
Definition arg.h:766
void Put(const std::string &name, short value, StatusType *const status, const std::string &extraData="")
Insert a short value into a named component of the Arg structure.
Definition arg.h:1381
void Put(const char *name, UINT32 value, StatusType *const status)
Insert an unsigned 32 bit integer into a named component of the Arg structure.
Definition arg.h:561
void toString(std::string *s, StatusType *const status, int maxlen=200)
Convert the structure to a string This method attempts to convert the SDS structure maintained by thi...
Definition arg.h:2001
void Put(const char *name, const long dim, const unsigned index, const double data, StatusType *const status)
Insert an 1D double array element.
Definition arg.h:736
void ToString(std::string *s, StatusType *const status, int maxlen=200)
Convert the structure to a string.
Definition arg.h:1968
void Put(const char *name, const long dim, const unsigned index, const INT32 data, StatusType *const status)
Insert an 1D INT32 array element.
Definition arg.h:793
void Get(const std::string &name, char *value, StatusType *const status) const
Fetch a char value from a named component of the Arg structure.
Definition arg.h:1719
void Get(const std::string &name, double *value, StatusType *const status) const
Fetch a double size real value from a named component of the Arg structure.
Definition arg.h:1862
void Put(const char *name, float value, StatusType *const status)
Insert an float size real value into a named component of the Arg structure.
Definition arg.h:615
Arg(const SdsId &source, const char *const name, StatusType *const status)
Constructor which returns an id to a named item of another item.
Definition arg.h:356
void Put(const std::string &name, UINT64 value, StatusType *const status, const std::string &extraData="")
Insert an unsigned 64 bit integer value into a named component of the Arg structure.
Definition arg.h:1527
void List(FILE *to, StatusType *const status) const
List the contents of the structure to a file.
Definition arg.h:1134
Arg(const SdsIdType item=0, const bool free=false, const bool del=false, const bool readfree=false)
Arg constructor to access an item created by C language SDS.
Definition arg.h:295
void Put(const std::string &name, char value, StatusType *const status, const std::string &extraData="")
Insert a char value into a named component of the Arg structure.
Definition arg.h:1351
void Convert(SdsCodeType DstType, void *DstAddr, unsigned long int DstLen, StatusType *status)
Convert the data in this item to another (normally scalar) type.
Definition arg.h:1209
void Get(const char *name, double *value, StatusType *const status) const
Fetch a double size real value from a named component of the Arg structure.
Definition arg.h:1070
void Get(const std::string &name, bool *value, StatusType *const status) const
Fetch a boolean value from a named component of the Arg structure.
Definition arg.h:1699
void Put(const std::string &name, UINT32 value, StatusType *const status, const std::string &extraData="")
Insert an unsigned 32 bit integer value into a named component of the Arg structure.
Definition arg.h:1464
void Get(const char *name, unsigned short *value, StatusType *const status) const
Fetch an unsigned short integer value from a named component of the Arg structure.
Definition arg.h:969
void Put(const char *name, const long dim, const double data[], StatusType *const status)
Insert an array of double into a named component of the Arg structure.
Definition arg.h:707
void Put(const std::string &name, const std::string &value, StatusType *status, const std::string &extraData="")
Insert a std::string into a named component of the Arg structure.
Definition arg.h:1672
void Put(const char *name, bool value, StatusType *const status)
Insert a boolean value into a named component of the Arg structure.
Definition arg.h:468
void Get(const std::string &name, short *value, StatusType *const status) const
Fetch a short integer value from a named component of the Arg structure.
Definition arg.h:1736
void CheckItem(SdsCodeType code, StatusType *status, long ndims=-1, long *dims=0)
Check an item has a required structure.
Definition arg.h:440
void New(StatusType *const status, const char *const name="ArgStructure")
Create a new Arg structure within this object.
Definition arg.h:332
Arg(const SdsId &source, const std::string &name, StatusType *const status)
Constructor which returns an id to a named item of another item.
Definition arg.h:1265
void Put(const std::string &name, bool value, StatusType *const status, const std::string &extraData="")
Insert a boolean value into a named component of the Arg structure.
Definition arg.h:1320
void Get(const char *name, float *value, StatusType *const status) const
Fetch a float size real value from a named component of the Arg structure.
Definition arg.h:1055
void Put(const char *name, const long dim, const unsigned char data[], StatusType *const status)
Insert an array of unsigned char into a named component of the Arg structure.
Definition arg.h:823
void Put(const char *name, double value, StatusType *const status)
Insert an double size real value into a named component of the Arg structure.
Definition arg.h:633
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 arg.h:1160
void toString(int maxlen, int *length, char *string, StatusType *const status)
Convert the structure to a string.
Definition arg.h:408
A C++ Interface to the SDS Arg library.
Definition arg.h:263
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
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 PutExtra(const long nextra, const char *const extra, StatusType *const status)
Put extra data into an SDS item.
Definition sds.h:1640
void ShallowCopy(SdsId &source, const bool outlives=true)
Shallow copy from SdsId.
Definition sds.h:1932
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
A C++ Interface to the handling SDS structures.
Definition sds.h:761