DataFactory.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 #ifndef __DATASTRUCTURE_DATAFACTORY_H_
00031 #define __DATASTRUCTURE_DATAFACTORY_H_
00032
00033 #include <yarp/os/all.h>
00034
00035 #include <string>
00036 #include "Boolean.hpp"
00037 #include "DataBox.hpp"
00038 #include "DataBoxArray.hpp"
00039 #include "DataStructureDescription.hpp"
00040 #include "DataValueVector.hpp"
00041 #include "Double.hpp"
00042 #include "DoubleArray.hpp"
00043 #include "Integer.hpp"
00044 #include "IntegerArray.hpp"
00045 #include "String.hpp"
00046 #include "StringArray.hpp"
00047 #include "XmlDocument.hpp"
00048
00049
00050
00051 #include <map>
00052
00053 namespace mermaid
00054 {
00055 namespace support
00056 {
00057 namespace data
00058 {
00059
00060 using boost::shared_ptr;
00061 using mermaid::support::xml::XmlDocument;
00062 using mermaid::support::xml::XmlElement;
00063 using mermaid::support::xml::XmlElementVector;
00064
00065 using yarp::os::Bottle;
00066
00067
00068
00069
00070
00071
00072
00073
00074 class DataFactory
00075 {
00076
00077 public:
00078
00079
00080
00081
00082
00083 static shared_ptr<Integer> buildInteger (int value = 0);
00084
00085 static shared_ptr<IntegerArray> buildDynamicIntegerArray();
00086
00087 static shared_ptr<IntegerArray> buildStaticIntegerArray (int size);
00088
00089
00090
00091
00092
00093
00094 static shared_ptr<Double> buildDouble (double value = 0.0);
00095
00096 static shared_ptr<DoubleArray> buildDynamicDoubleArray();
00097
00098 static shared_ptr<DoubleArray> buildStaticDoubleArray (int size);
00099
00100
00101
00102
00103
00104
00105 static shared_ptr<String> buildString (std::string value = std::string (""));
00106
00107 static shared_ptr<StringArray> buildDynamicStringArray();
00108
00109 static shared_ptr<StringArray> buildStaticStringArray (int size);
00110
00111
00112
00113
00114
00115 static shared_ptr<DataBox> buildDataBox (std::string typeName);
00116
00117 static shared_ptr<DataBox> buildDataBoxFromStructureAndBottle (std::string structureTypeName, Bottle &bottle);
00118 static shared_ptr<DataBox> buildDataBoxFromStructureAndValueVector (std::string structureTypeName, shared_ptr<DataValueVector> vv);
00119
00120 static shared_ptr<DataBoxArray> buildDynamicDataBoxArray (std::string typeName);
00121
00122 static shared_ptr<DataBoxArray> buildStaticDataBoxArray (std::string typeName, int size);
00123
00124
00125 static shared_ptr<DataValueVector> buildDataValueVector (Bottle& b);
00126 static shared_ptr<DataValueVector> buildDataValueVector();
00127
00128
00129 static void loadDataDescription (shared_ptr<XmlDocument> document);
00130
00131 static void writeDataBoxToBottle (shared_ptr<DataBox> box, Bottle &bottle);
00132
00133 static shared_ptr<DataStructureDescription> getDataStructureDescription (std::string dataStructureName);
00134
00135 private:
00136
00137 static std::map<std::string, shared_ptr<DataStructureDescription> > dataStructureDescriptionMap;
00138
00139 };
00140 }
00141 }
00142 }
00143
00144 #endif // __DATASTRUCTURE_DATAFACTORY_H_