00001 #ifndef _RDA_DATA_H_
00002 #define _RDA_DATA_H_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <rda/DataEntry.h>
00015 #include <rda/Set.h>
00016
00101 class rdaData : public rdaSet
00102 {
00103 friend class rdaDataIterator;
00104
00105 public:
00106
00107 rdaDataEntry* newEntry(const char* tag);
00108
00112 rdaData() : rdaSet() {}
00116 rdaData(const rdaData& data) { *this = data; }
00120 virtual ~rdaData();
00125 rdaData& operator=(const rdaData& data);
00126
00134
00141 void print(FILE* fp, unsigned long maxElements) const;
00142
00148 void print(unsigned long maxElements) const;
00149
00153 void print() const;
00155
00162 void asciiDump(unsigned long maxElements=5) const;
00167 bool contains(const char* tag) const;
00172
00173
00174 bool isEmpty() const { return rdaSet::isEmpty(); }
00175
00180 rdaDataEntry* get(const char* tag) const;
00185 void remove(const char* tag);
00189 void removeAll();
00190
00191
00192
00193
00194
00195
00202
00212 bool extractBoolean(const char* tag) const;
00222 bool* extractBooleanArray(const char* tag, unsigned long& size) const;
00232 const bool* getBooleanArray(const char* tag, unsigned long& size) const;
00242 signed char extractByte(const char* tag) const;
00252 signed char* extractByteArray(const char* tag, unsigned long& size) const;
00262 const signed char* getByteArray(const char* tag, unsigned long& size) const;
00263
00273 short extractShort(const char* tag) const;
00283 short* extractShortArray(const char* tag, unsigned long& size) const;
00293 const short* getShortArray(const char* tag, unsigned long& size) const;
00294
00304 long extractInt(const char* tag) const;
00314 long* extractIntArray(const char* tag, unsigned long& size) const;
00324 const long* getIntArray(const char* tag, unsigned long& size) const;
00325
00335 longlong extractLong(const char* tag) const;
00345 longlong* extractLongArray(const char* tag, unsigned long& size) const;
00355 const longlong* getLongArray(const char* tag, unsigned long& size) const;
00356
00366 float extractFloat(const char* tag) const;
00376 float* extractFloatArray(const char* tag, unsigned long& size) const;
00386 const float* getFloatArray(const char* tag, unsigned long& size) const;
00387
00397 double extractDouble(const char* tag) const;
00407 double* extractDoubleArray(const char* tag, unsigned long& size) const;
00417 const double* getDoubleArray(const char* tag, unsigned long& size) const;
00418
00429 char* extractString(const char* tag) const;
00439 const char* getString(const char* tag) const;
00440
00450 char** extractStringArray(const char* tag, unsigned long& size) const;
00451
00461 const char** getStringArray(const char* tag, unsigned long& size) const;
00462
00464
00471
00472
00473
00474
00475
00479 void insert(const char* tag, bool value);
00485 void insert(const char* tag, const bool* value, unsigned long size);
00491 void put(const char* tag, const bool* value, unsigned long size);
00492
00496 void insert(const char* tag, signed char value);
00502 void insert(const char* tag, const signed char* value, unsigned long size);
00503
00509 void put(const char* tag, const signed char* value, unsigned long size);
00513 void insert(const char* tag, short value);
00519 void insert(const char* tag, const short* value, unsigned long size);
00520
00526 void put(const char* tag, const short* value, unsigned long size);
00527
00531 void insert(const char* tag, long value);
00537 void insert(const char* tag, const long* value, unsigned long size);
00543 void put(const char* tag, const long* value, unsigned long size);
00544
00548 void insert(const char* tag, longlong value);
00554 void insert(const char* tag, const longlong* value, unsigned long size);
00560 void put(const char* tag, const longlong* value, unsigned long size);
00561
00565 void insert(const char* tag, float value);
00571 void insert(const char* tag, const float* value, unsigned long size);
00577 void put(const char* tag, const float* value, unsigned long size);
00578
00582 void insert(const char* tag, double value);
00588 void insert(const char* tag, const double* value, unsigned long size);
00594 void put(const char* tag, const double* value, unsigned long size);
00595
00602 void insert(const char* tag, const char* value);
00608 void put(const char* tag, const char* value);
00609
00618 void insert(const char* tag, const char** value, unsigned long size);
00619
00625 void put(const char* tag, const char** value, unsigned long size);
00626
00628
00629 };
00630
00659 class rdaDataIterator
00660 {
00661 const rdaData& data;
00662 int index;
00663
00664 public:
00665
00669 rdaDataIterator(const rdaData& d) : data(d), index(-1) {}
00670
00674 ~rdaDataIterator() {}
00675
00681 bool hasNext() { return (index < (data.size()-1)); }
00682
00687 rdaDataEntry* next()
00688 {
00689 if (hasNext()) return (rdaDataEntry*) data.elementAt(++index);
00690 else return 0;
00691 }
00692 };
00693
00694 #ifndef RDA_HAS_NO_IOSTREAM
00695 #ifndef RDA_HAS_NO_STD_IOSTREAM
00696 #include <iostream>
00697 using std::ostream;
00698 using std::endl;
00699 #else
00700 #include <iostream.h>
00701 #endif
00702
00707 ostream& operator<<(ostream& os, const rdaData& data);
00708 #endif
00709
00710 #endif
00711