Main Page | Class Hierarchy | Compound List | File List | Compound Members

BxDataset.h

00001 /********************************************************************
00002  * Binx
00003  * $Id: BxDataset_8h-source.html,v 1.1.1.1 2006/04/19 14:19:02 edikt2 Exp $
00004  *
00005  * Class for BinX dataset object
00006  *
00007  *
00008  * edikt::BinX
00009  * www.edikt.org
00010  * support@edikt.org
00011  *
00012  * Copyright (c) 2005 The University of Edinburgh.
00013  *
00014  ********************************************************************/
00015 
00016 #ifndef BXDATASET_H
00017 #define BXDATASET_H
00018 
00019 #include "BxProtos.h"
00020 #include "BxDataTypes.h"
00021 #include "BxDataObjects.h"
00022 
00063 class DECLSPEC BxDataset : public BxDataObject
00064 {
00065 public:
00066         // The default constructor
00067     BxDataset();
00068 
00069         // The copy constructor
00070     BxDataset(const BxDataset& copy);
00071 
00072         // The destructor
00073     virtual ~BxDataset();
00074     virtual BxDataset* clone() const;
00075     virtual char* className() const {return "BxDataset";} //<Returns the null-terminated string "BxDataset".
00076     virtual void print();
00077 
00078     virtual void    setBinaryFilePtr(BxBinaryFile* fp);
00079     virtual char*   typeName() const;
00080     virtual char*   varName() const;   //returns the variable name
00081     virtual char*   testValue() const;
00082     virtual BxByteOrder byteOrder() const;
00083     virtual int blockSize() const;
00084     virtual void    setByteOrder(BxByteOrder bo);
00085     virtual void    setBlockSize(int blocksize);
00086     virtual void    setOffset(long offset);
00087 
00088     virtual byte* getDataPointer(); //return data pointer
00089     virtual void  readFromBuffer(const byte * buf);
00090     virtual bool  readFromFile();
00091     virtual char* toString(bool xml);
00092     virtual bool  toStream(FILE*);
00093     virtual bool  toStreamBinary(FILE*);
00094 
00095         // Write out the binary data with the specified byte order
00096     virtual bool  toStreamBinary(FILE*, BxByteOrder); 
00097 
00098     // loop access methods
00099     void reset();
00100     bool next();    // set next data object in list and return true, or false if passed end
00101     BxDataObject* getDataObject() const;  // return the set object with next()
00102     BxByte8* getByte8();
00103     BxCharacter8* getCharacter8();
00104     BxUnicode16* getUnicode16();
00105     BxUnicode32* getUnicode32();
00106     BxShort16* getShort16();
00107     BxInteger32* getInteger32();
00108     BxLong64* getLong64();
00109     BxUnsignedShort16* getUnsignedShort16();
00110     BxUnsignedInteger32* getUnsignedInteger32();
00111     BxUnsignedLong64* getUnsignedLong64();
00112     BxFloat32* getFloat32();
00113     BxDouble64* getDouble64();
00114     BxDoubleExtended80* getDoubleExtended80();
00115     BxDoubleExtended96* getDoubleExtended96();
00116     BxQuadruple128* getQuadruple128();
00117     BxDataset* getDataset();
00118     BxArray* getArray();
00119     BxUnion* getUnion();
00120     BxString* getString();
00121     bool isByte8() const;
00122     bool isCharacter8() const;
00123     bool isUnicode16() const;
00124     bool isUnicode32() const;
00125     bool isShort16() const;
00126     bool isInteger32() const;
00127     bool isLong64() const;
00128     bool isUnsignedShort16() const;
00129     bool isUnsignedInteger32() const;
00130     bool isUnsignedLong64() const;
00131     bool isFloat32() const;
00132     bool isDouble64() const;
00133     bool isExtended80() const;
00134     bool isExtended96() const;
00135     bool isDoubleExtended() const;
00136     bool isQuadruple128() const;
00137     bool isVoid0() const;
00138     bool isDataset() const;
00139     bool isArray() const;
00140     bool isUnion() const;
00141     bool isString() const;
00142 
00143     int count() const;   //count number of elements in dataObjects_
00144 
00145     BxDataObject* getDataObject(int index) const;
00146     BxDataObject * getDataObject(const char* name) const;
00147 
00148     BxByte8* getByte8(int index);
00149     BxCharacter8* getCharacter8(int index);
00150     BxUnicode16* getUnicode16(int index);
00151     BxUnicode32* getUnicode32(int index);
00152     BxShort16* getShort16(int index);
00153     BxInteger32* getInteger32(int index);
00154     BxLong64* getLong64(int index);
00155     BxUnsignedShort16* getUnsignedShort16(int index);
00156     BxUnsignedInteger32* getUnsignedInteger32(int index);
00157     BxUnsignedLong64* getUnsignedLong64(int index);
00158     BxFloat32* getFloat32(int index);
00159     BxDouble64* getDouble64(int index);
00160     BxDoubleExtended80* getDoubleExtended80(int index);
00161     BxDoubleExtended96* getDoubleExtended96(int index);
00162     BxQuadruple128* getQuadruple128(int index);
00163     BxDataset* getDataset(int index);
00164     BxArray* getArray(int index);
00165     BxUnion* getUnion(int index);
00166     BxString* getString(int index);
00167     bool isByte8(int index) const;
00168     bool isCharacter8(int index) const;
00169     bool isUnicode16(int index) const;
00170     bool isUnicode32(int index) const;
00171     bool isShort16(int index) const;
00172     bool isInteger32(int index) const;
00173     bool isLong64(int index) const;
00174     bool isUnsignedShort16(int index) const;
00175     bool isUnsignedInteger32(int index) const;
00176     bool isUnsignedLong64(int index) const;
00177     bool isFloat32(int index) const;
00178     bool isDouble64(int index) const;
00179     bool isExtended80(int index) const;
00180     bool isExtended96(int index) const;
00181     bool isDoubleExtended(int index) const;
00182     bool isQuadruple128(int index) const;
00183     bool isVoid0(int index) const;
00184     bool isDataset(int index) const;
00185     bool isArray(int index) const;
00186     bool isUnion(int index) const;
00187     bool isString(int index) const;
00188 
00189     BxByte8* getByte8(const char* vname);
00190     BxCharacter8* getCharacter8(const char* vname);
00191     BxUnicode16* getUnicode16(const char* vname);
00192     BxUnicode32* getUnicode32(const char* vname);
00193     BxShort16* getShort16(const char* vname);
00194     BxInteger32* getInteger32(const char* vname);
00195     BxLong64* getLong64(const char* vname);
00196     BxUnsignedShort16* getUnsignedShort16(const char* vname);
00197     BxUnsignedInteger32* getUnsignedInteger32(const char* vname);
00198     BxUnsignedLong64* getUnsignedLong64(const char* vname);
00199     BxFloat32* getFloat32(const char* vname);
00200     BxDouble64* getDouble64(const char* vname);
00201     BxDoubleExtended80* getDoubleExtended80(const char* vname);
00202     BxDoubleExtended96* getDoubleExtended96(const char* vname);
00203     BxQuadruple128* getQuadruple128(const char* vname);
00204     BxDataset* getDataset(const char* vname);
00205     BxArray* getArray(const char* vname);
00206     BxUnion* getUnion(const char* vname);
00207     BxString* getString(const char* vname);
00208     bool isByte8(const char* vname) const;
00209     bool isCharacter8(const char* vname) const;
00210     bool isUnicode16(const char* vname) const;
00211     bool isUnicode32(const char* vname) const;
00212     bool isShort16(const char* vname) const;
00213     bool isInteger32(const char* vname) const;
00214     bool isLong64(const char* vname) const;
00215     bool isUnsignedShort16(const char* vname) const;
00216     bool isUnsignedInteger32(const char* vname) const;
00217     bool isUnsignedLong64(const char* vname) const;
00218     bool isFloat32(const char* vname) const;
00219     bool isDouble64(const char* vname) const;
00220     bool isExtended80(const char* vname) const;
00221     bool isExtended96(const char* vname) const;
00222     bool isDoubleExtended(const char* vname) const;
00223     bool isQuadruple128(const char* vname) const;
00224     bool isVoid0(const char* vname) const;
00225     bool isDataset(const char* vname) const;
00226     bool isArray(const char* vname) const;
00227     bool isUnion(const char* vname) const;
00228     bool isString(const char* vname) const;
00229 
00230     bool addDataObject(BxDataObject &); // add a object reference with copy to the list
00231     bool addDataObject(BxDataObject *); // add a pointer to a BxDataObject or deriatives
00232 
00233     int findObjectIndex(const char* name) const;
00234 
00235     void resize();  // calculate sizeInAll_ for this dataset
00236 
00237         // Set the number of times to repeat the elements using the dim attribute
00238     void repeat(int);
00239 
00240         // Return the number of times to repeat the elements using the dim attribute
00241     int repeat() const { return repeat_; }
00242 
00243 protected:
00244         // Protected operations
00245 
00246     BxDataObject* findObject(const char* name) const;
00247     void copyDataObjects(const BxDataset& ds);
00248     byte* getBuffer(); // return the buffer
00249 
00250 
00251         // Protected data
00252 
00253     BxDataObjects dataObjects_;   //<a list of data elements
00254     byte* pBuffer_;    //<buffer to hold byte stream of all elements
00255 private:
00256         // Private data
00257 
00258         // keep an index of the current referenced data object. to be used by next(), is*, get().
00259     int nCurrentObject_; 
00260 
00261         // Stores the number of times to repeat the elements using the dim attribute
00262     int repeat_;
00263 };
00264 
00265 #endif

Generated on Fri May 6 13:36:17 2005 for edikt::BinX by doxygen 1.3.3