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
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #ifndef __PLUGGABLEWARE_HPP__
00042 #define __PLUGGABLEWARE_HPP__
00043
00044 #include <boost/filesystem/path.hpp>
00045 #include <boost/property_tree/ptree.hpp>
00046 #include <string>
00047
00048 #include <openfluid/dllexport.hpp>
00049 #include <openfluid/base/EnvProperties.hpp>
00050 #include <openfluid/ware/WareSignature.hpp>
00051
00052
00053 namespace openfluid { namespace ware {
00054
00055
00056
00057
00058
00059 #define WAREBODY_PROC_NAME "GetWareBody"
00060
00061
00062
00063
00064 #define WARESIGNATURE_PROC_NAME "GetWareSignature"
00065
00066
00067
00068
00069 #define WAREABIVERSION_PROC_NAME "GetWareABIVersion"
00070
00071
00072
00073
00074 typedef std::string WareParamKey_t;
00075 typedef openfluid::core::StringValue WareParamValue_t;
00076
00077 typedef std::map<WareParamKey_t, WareParamValue_t> WareParams_t;
00078
00079
00080
00081
00082
00083
00084 class DLLEXPORT PluggableWare
00085 {
00086 public:
00087
00088 enum WareType { UNDEFINED, OBSERVER, SIMULATOR, OTHER };
00089
00090
00091 private:
00092
00093
00094
00095
00096 const openfluid::base::EnvironmentProperties* mp_WareEnv;
00097
00098
00099
00100
00101 WareID_t m_WareID;
00102
00103
00104 protected:
00105
00106 virtual bool isLinked() const { return mp_WareEnv != NULL; };
00107
00108 bool m_Initialized;
00109
00110
00111
00112
00113
00114 virtual void OPENFLUID_RaiseError(const std::string& Msg);
00115
00116
00117
00118
00119
00120
00121 bool OPENFLUID_GetRunEnvironment(std::string Key, std::string& Val);
00122
00123
00124
00125
00126
00127
00128 bool OPENFLUID_GetRunEnvironment(std::string Key, bool& Val);
00129
00130
00131
00132
00133
00134 WareID_t OPENFLUID_GetWareID() const { return m_WareID; };
00135
00136 WareType m_WareType;
00137
00138
00139 PluggableWare(WareType WType);
00140
00141 public:
00142
00143 virtual ~PluggableWare();
00144
00145 void linkToRunEnvironment(const openfluid::base::EnvironmentProperties* Env)
00146 {
00147 mp_WareEnv = Env;
00148 };
00149
00150 virtual void initializeWare(const WareID_t& ID);
00151
00152 virtual void finalizeWare();
00153
00154
00155
00156
00157 static bool isWellFormated(const openfluid::ware::WareParamKey_t& ParameterKey);
00158
00159 static boost::property_tree::ptree getParamsAsPropertyTree(
00160 const WareParams_t& Params);
00161
00162 };
00163
00164
00165
00166 } }
00167
00168
00169
00170 #endif