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 #define WAREBODY_PROC_DECL GetWareBody
00061
00062
00063
00064
00065 #define WARESIGNATURE_PROC_NAME "GetWareSignature"
00066 #define WARESIGNATURE_PROC_DECL GetWareSignature
00067
00068
00069
00070
00071 #define WAREABIVERSION_PROC_NAME "GetWareABIVersion"
00072 #define WAREABIVERSION_PROC_DECL GetWareABIVersion
00073
00074
00075
00076
00077
00078
00079 typedef std::string WareParamKey_t;
00080 typedef openfluid::core::StringValue WareParamValue_t;
00081
00082 typedef std::map<WareParamKey_t, WareParamValue_t> WareParams_t;
00083
00084
00085
00086
00087
00088
00089 class DLLEXPORT PluggableWare
00090 {
00091 public:
00092
00093 enum WareType { UNDEFINED, OBSERVER, SIMULATOR, OTHER };
00094
00095
00096 private:
00097
00098
00099
00100
00101 const openfluid::base::EnvironmentProperties* mp_WareEnv;
00102
00103
00104
00105
00106 WareID_t m_WareID;
00107
00108
00109 protected:
00110
00111 virtual bool isLinked() const { return mp_WareEnv != NULL; };
00112
00113 bool m_Initialized;
00114
00115
00116
00117
00118
00119 virtual void OPENFLUID_RaiseError(const std::string& Msg);
00120
00121
00122
00123
00124
00125
00126 bool OPENFLUID_GetRunEnvironment(std::string Key, std::string& Val);
00127
00128
00129
00130
00131
00132
00133 bool OPENFLUID_GetRunEnvironment(std::string Key, bool& Val);
00134
00135
00136
00137
00138
00139 WareID_t OPENFLUID_GetWareID() const { return m_WareID; };
00140
00141 WareType m_WareType;
00142
00143
00144 PluggableWare(WareType WType);
00145
00146 public:
00147
00148 virtual ~PluggableWare();
00149
00150 void linkToRunEnvironment(const openfluid::base::EnvironmentProperties* Env)
00151 {
00152 mp_WareEnv = Env;
00153 };
00154
00155 virtual void initializeWare(const WareID_t& ID);
00156
00157 virtual void finalizeWare();
00158
00159
00160
00161
00162 static bool isWellFormated(const openfluid::ware::WareParamKey_t& ParameterKey);
00163
00164 static boost::property_tree::ptree getParamsAsPropertyTree(
00165 const WareParams_t& Params);
00166
00167 };
00168
00169
00170
00171 } }
00172
00173
00174
00175 #endif