DataBox.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef __DATASTRUCTURE_DATABOX_H_
00032 #define __DATASTRUCTURE_DATABOX_H_
00033
00034 #include "DataStructureDescription.hpp"
00035 #include "DataValue.hpp"
00036 #include "DataValueVector.hpp"
00037
00038 #include "IntegerArray.hpp"
00039 #include "DoubleArray.hpp"
00040 #include "StringArray.hpp"
00041
00042
00043 #include <map>
00044 #include <string>
00045
00046 namespace mermaid
00047 {
00048 namespace support
00049 {
00050 namespace data
00051 {
00052 using boost::shared_ptr;
00053
00054
00055 class DataBoxArray;
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 class DataBox : public DataValue
00066 {
00067
00068 friend class DataFactory;
00069
00070 public:
00071
00072
00073 DataBox (const DataBox &dbox);
00074
00075 DataBox * clone();
00076
00077 std::string getBoxStructureName() const;
00078
00079 shared_ptr<DataValue> getValue (std::string valueName) const;
00080
00081 shared_ptr<DataValueVector> getDataValueVector() const;
00082
00083 int getInteger (std::string name) const;
00084 shared_ptr<IntegerArray> getIntegerArray (std::string name) const;
00085
00086 double getDouble (std::string name) const;
00087 shared_ptr<DoubleArray> getDoubleArray (std::string name) const;
00088
00089 std::string getString (std::string name) const;
00090 shared_ptr<StringArray> getStringArray (std::string name) const;
00091
00092 shared_ptr<DataBox> getDataBox (std::string name) const;
00093 shared_ptr<DataBoxArray> getDataBoxArray (std::string name) const;
00094
00095 void setInteger (std::string name, int value);
00096 void setDouble (std::string name, double value);
00097 void setString (std::string name, std::string value);
00098
00099 void setValueFromString (std::string name, std::string value);
00100
00101
00102
00103 virtual operator std::string() const;
00104 void print() const;
00105 private:
00106
00107 DataBox();
00108 DataBox (shared_ptr<DataStructureDescription> dsd);
00109
00110
00111 void addInteger (std::string name, int i = 0);
00112 shared_ptr<IntegerArray> addDynamicIntegerArray (std::string name);
00113 shared_ptr<IntegerArray> addStaticIntegerArray (std::string name, int size);
00114
00115 void addDouble (std::string name, double d = 0.0);
00116 shared_ptr<DoubleArray> addDynamicDoubleArray (std::string name);
00117 shared_ptr<DoubleArray> addStaticDoubleArray (std::string name, int size);
00118
00119 void addString (std::string name, std::string s = std::string (""));
00120 shared_ptr<StringArray> addDynamicStringArray (std::string name);
00121 shared_ptr<StringArray> addStaticStringArray (std::string name, int size);
00122
00123 void addDataBox (std::string name, std::string type);
00124 shared_ptr<DataBoxArray> addDynamicDataBoxArray (std::string name, std::string type);
00125 shared_ptr<DataBoxArray> addStaticDataBoxArray (std::string name, std::string type, int size);
00126
00127 void addDataValue (std::string name, shared_ptr<DataValue> value);
00128
00129
00130
00131
00132 int setDataFromValueVector (shared_ptr<DataValueVector> vv, int startPos = 0);
00133
00134
00135 shared_ptr<DataStructureDescription> dataStructureDescription_;
00136 shared_ptr<DataValueVector> valueVector_;
00137 std::map<std::string, shared_ptr<DataValue> > nameToPtrMap_;
00138 std::map<shared_ptr<DataValue>, std::string> ptrToNameMap_;
00139 };
00140 }
00141 }
00142 }
00143
00144 #endif // __DATASTRUCTURE_DATABOX_H_