Commit bf54b7d40ec1c4eee6c697b009b922804ece2a4d
1 parent
f2cf89d8
Exists in
master
and in
84 other branches
not woring yet
Showing
34 changed files
with
551 additions
and
450 deletions
Show diff stats
src/Common/Application.cc
... | ... | @@ -64,86 +64,90 @@ using namespace AMDA::XMLParameterConfigurator; |
64 | 64 | LoggerPtr logger(Logger::getLogger("AMDA-Kernel")); |
65 | 65 | |
66 | 66 | namespace AMDA { |
67 | - namespace Common { | |
67 | + namespace Common { | |
68 | 68 | |
69 | - int Application::main(int argc, char *argv[], | |
70 | - std::function<int(int argc, char *argv[], AMDA::helpers::Properties&)> exec, bool skipPluginLoad) { | |
71 | - int result = AMDA_EXIT_OK; | |
69 | + int Application::main(int argc, char *argv[], | |
70 | + std::function<int(int argc, char *argv[], AMDA::helpers::Properties&) > exec, bool skipPluginLoad) { | |
71 | + int result = AMDA_EXIT_OK; | |
72 | 72 | |
73 | - try { | |
74 | - if (access("app.properties", F_OK) != 0) { | |
75 | - BOOST_THROW_EXCEPTION( | |
76 | - AMDA::AMDA_exception() << AMDA::errno_code(AMDA_FILEPROPERTIES_ERR) << AMDA::ex_msg("Properties file not found")); | |
77 | - } | |
78 | - try { | |
79 | - AMDA::helpers::Properties lProperties("app.properties"); | |
73 | + try { | |
74 | + if (access("app.properties", F_OK) != 0) { | |
75 | + BOOST_THROW_EXCEPTION( | |
76 | + AMDA::AMDA_exception() << AMDA::errno_code(AMDA_FILEPROPERTIES_ERR) << AMDA::ex_msg("Properties file not found")); | |
77 | + } | |
78 | + try { | |
79 | + AMDA::helpers::Properties lProperties("app.properties"); | |
80 | 80 | |
81 | - std::string lLoggerFileconfiguration = | |
82 | - lProperties["app.log4cxx.configfile"]; | |
81 | + std::string lLoggerFileconfiguration = | |
82 | + lProperties["app.log4cxx.configfile"]; | |
83 | 83 | |
84 | - if (lLoggerFileconfiguration.empty()) { | |
85 | - /// Set up a simple configuration that logs on the console. | |
86 | - BasicConfigurator::configure(); | |
87 | - LOG4CXX_WARN(logger, | |
88 | - "No properties: 'app.log4cxx.configfile' found. log4cxx basic configuration set "); | |
89 | - } else { | |
90 | - PropertyConfigurator::configure( | |
91 | - lLoggerFileconfiguration.c_str()); | |
92 | - MDC::put("PID", AMDA::Helpers::Helper::getPID()); | |
93 | - } | |
84 | + if (lLoggerFileconfiguration.empty()) { | |
85 | + /// Set up a simple configuration that logs on the console. | |
86 | + BasicConfigurator::configure(); | |
87 | + LOG4CXX_WARN(logger, | |
88 | + "No properties: 'app.log4cxx.configfile' found. log4cxx basic configuration set "); | |
89 | + } else { | |
90 | + PropertyConfigurator::configure( | |
91 | + lLoggerFileconfiguration.c_str()); | |
92 | + MDC::put("PID", AMDA::Helpers::Helper::getPID()); | |
93 | + } | |
94 | 94 | |
95 | - ///Create ParameterManager | |
96 | - ServicesServer *servicesServer = ServicesServer::getInstance(); | |
97 | - ParameterConfiguratorSPtr configurator( new AMDA::XMLParameterConfigurator::XMLParameterConfigurator( lProperties["app.parameter.xsd"].c_str())); | |
98 | - configurator->setParamPath(lProperties["app.param.path"]); | |
99 | - servicesServer->setConfigurator(configurator); | |
95 | + ///Create ParameterManager | |
96 | + ServicesServer *servicesServer = ServicesServer::getInstance(); | |
97 | + ParameterConfiguratorSPtr configurator(new AMDA::XMLParameterConfigurator::XMLParameterConfigurator(lProperties["app.parameter.xsd"].c_str())); | |
98 | + configurator->setParamPath(lProperties["app.param.path"]); | |
99 | + servicesServer->setConfigurator(configurator); | |
100 | 100 | |
101 | - std::string lPluginPath = lProperties["app.plugin"]; | |
102 | - if (!lPluginPath.empty() && !skipPluginLoad) { | |
103 | - AMDA::Plugins::PluginManager::getInstance()->loadPluginFromPath( | |
104 | - lPluginPath); | |
105 | - } | |
101 | + std::string lPluginPath = lProperties["app.plugin"]; | |
102 | + if (!lPluginPath.empty() && !skipPluginLoad) { | |
103 | + if (lProperties["app.dynamicPluging"] == "false") { | |
104 | + AMDA::Plugins::PluginManager::getInstance()->loadPluginFromPath( | |
105 | + lPluginPath); | |
106 | + } else { | |
107 | + // tbd | |
108 | + } | |
109 | + } | |
106 | 110 | |
107 | - LOG4CXX_INFO(logger, "Entering application."); | |
108 | - result = exec(argc, argv, lProperties); | |
111 | + LOG4CXX_INFO(logger, "Entering application."); | |
112 | + result = exec(argc, argv, lProperties); | |
109 | 113 | |
110 | - } catch (AMDA::AMDA_exception & e) { | |
111 | - LOG4CXX_ERROR(logger, | |
112 | - "Error resume: " << AMDA::traitException(result,e)); | |
113 | - } | |
114 | + } catch (AMDA::AMDA_exception & e) { | |
115 | + LOG4CXX_ERROR(logger, | |
116 | + "Error resume: " << AMDA::traitException(result, e)); | |
117 | + } | |
114 | 118 | |
115 | - } catch (AMDA::AMDA_exception & e) { | |
116 | - std::cerr << "Error resume: " << AMDA::traitException(result, e); | |
117 | - } catch (...) { | |
118 | - result = AMDA_ERROR_UNKNOWN; | |
119 | - } | |
119 | + } catch (AMDA::AMDA_exception & e) { | |
120 | + std::cerr << "Error resume: " << AMDA::traitException(result, e); | |
121 | + } catch (...) { | |
122 | + result = AMDA_ERROR_UNKNOWN; | |
123 | + } | |
120 | 124 | |
121 | - ServicesServer::releaseInstance(); | |
125 | + ServicesServer::releaseInstance(); | |
122 | 126 | |
123 | 127 | |
124 | - AMDA::Info::ParamMgr::releaseInstance(); | |
128 | + AMDA::Info::ParamMgr::releaseInstance(); | |
125 | 129 | |
126 | - AMDA::Info::DataSetMgr::releaseInstance(); | |
130 | + AMDA::Info::DataSetMgr::releaseInstance(); | |
127 | 131 | |
128 | - AMDA::Info::InstrumentMgr::releaseInstance(); | |
132 | + AMDA::Info::InstrumentMgr::releaseInstance(); | |
129 | 133 | |
130 | - AMDA::Info::MissionMgr::releaseInstance(); | |
134 | + AMDA::Info::MissionMgr::releaseInstance(); | |
131 | 135 | |
132 | - AMDA::Plugins::PluginManager::getInstance()->releaseInstance(); | |
136 | + AMDA::Plugins::PluginManager::getInstance()->releaseInstance(); | |
133 | 137 | |
134 | - AMDA::SpiceKernel::SpiceKernelMgr::getInstance()->releaseInstance(); | |
138 | + AMDA::SpiceKernel::SpiceKernelMgr::getInstance()->releaseInstance(); | |
135 | 139 | |
136 | - if (result != 0) { | |
137 | - LOG4CXX_ERROR(logger, "Exception: " << getErrorMsg(result)); | |
138 | - } | |
139 | - LOG4CXX_INFO(logger, "Exiting application (" << result << ")"); | |
140 | + if (result != 0) { | |
141 | + LOG4CXX_ERROR(logger, "Exception: " << getErrorMsg(result)); | |
142 | + } | |
143 | + LOG4CXX_INFO(logger, "Exiting application (" << result << ")"); | |
140 | 144 | |
141 | - //release log4cxx | |
142 | - MDC::remove("PID"); | |
143 | - cout << "-----------------------------------------------------" << endl; | |
145 | + //release log4cxx | |
146 | + MDC::remove("PID"); | |
147 | + cout << "-----------------------------------------------------" << endl; | |
144 | 148 | |
145 | - return result; | |
146 | - } | |
149 | + return result; | |
150 | + } | |
147 | 151 | |
148 | - } /* namespace Common */ | |
152 | + } /* namespace Common */ | |
149 | 153 | } /* namespace AMDA */ | ... | ... |
src/ExternLib/Boxcar/AMDAPlugin.cc
1 | 1 | /* -*- Base: 10 ; Mode: C++ -*- */ |
2 | 2 | /*------------------------------------------------------------------------ |
3 | - ** | |
4 | - FOST project | |
5 | - ** | |
3 | + ** | |
4 | + FOST project | |
5 | + ** | |
6 | 6 | -------------------------------------------------------------------------- |
7 | 7 | -------------------------------------------------------------------------- |
8 | - FILE LOG | |
9 | - $Revision: 1.3 $ $Date: 2012-06-15 13:04:42 $ | |
8 | + FILE LOG | |
9 | + $Revision: 1.3 $ $Date: 2012-06-15 13:04:42 $ | |
10 | 10 | -------------------------------------------------------------------------- |
11 | 11 | CREATION |
12 | - V.SAC | |
12 | + V.SAC | |
13 | 13 | |
14 | 14 | SUMMARY |
15 | 15 | |
16 | 16 | DESCRIPTION |
17 | 17 | |
18 | - The main function performs the following actions : | |
19 | - <ul> | |
20 | - <li> | |
21 | - </ul> | |
18 | + The main function performs the following actions : | |
19 | + <ul> | |
20 | + <li> | |
21 | + </ul> | |
22 | 22 | |
23 | 23 | ------------------------------------------------------------------------*/ |
24 | 24 | |
... | ... | @@ -33,7 +33,7 @@ DESCRIPTION |
33 | 33 | |
34 | 34 | /** |
35 | 35 | |
36 | -*/ | |
36 | + */ | |
37 | 37 | //============================================================================= |
38 | 38 | // Include section |
39 | 39 | //============================================================================= |
... | ... | @@ -61,21 +61,18 @@ using namespace AMDA::Parameters; |
61 | 61 | // Methods of Class AMDAPlugin |
62 | 62 | //============================================================================= |
63 | 63 | |
64 | - | |
65 | - | |
66 | 64 | /** |
67 | 65 | Retrieve the Plugin version we're going to expect |
68 | -*/ | |
69 | -extern "C" const char* getPluginVersion() | |
70 | -{ | |
71 | - return "(Version)"; | |
66 | + */ | |
67 | +extern "C" const char* getPluginVersion() { | |
68 | + return "(Version)"; | |
72 | 69 | } |
73 | 70 | |
74 | 71 | /** |
75 | 72 | Tells us to register our functionality to an engine kernel |
76 | -*/ | |
77 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
78 | -{ | |
79 | - ProcessFactory factProcessBoxcarProcess = boost::factory<BoxcarProcess*>(); | |
80 | - ServicesServer::getInstance()->addProcessFactory("boxcar", factProcessBoxcarProcess); | |
73 | + */ | |
74 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) { | |
75 | + ProcessFactory factProcessBoxcarProcess = boost::factory<BoxcarProcess*>(); | |
76 | + ServicesServer::getInstance()->addProcessFactory("boxcar", factProcessBoxcarProcess); | |
77 | + ServicesServer::getInstance()->linkProcessWithPlugin("boxcar", plugingPath); | |
81 | 78 | } | ... | ... |
src/ExternLib/Deriv/AMDAPlugin.cc
... | ... | @@ -74,8 +74,10 @@ extern "C" const char* getPluginVersion() |
74 | 74 | /** |
75 | 75 | Tells us to register our functionality to an engine kernel |
76 | 76 | */ |
77 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
77 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) | |
78 | 78 | { |
79 | 79 | ProcessFactory factProcessDeriv = boost::factory<ProcessDeriv*>(); |
80 | 80 | ServicesServer::getInstance()->addProcessFactory("deriv", factProcessDeriv); |
81 | + ServicesServer::getInstance()->linkProcessWithPlugin("deriv", plugingPath); | |
82 | + | |
81 | 83 | } | ... | ... |
src/ExternLib/EnergyBounds/AMDAPlugin.cc
... | ... | @@ -101,7 +101,8 @@ extern "C" const char* getPluginVersion() |
101 | 101 | /** |
102 | 102 | Tells us to register our functionality to an engine kernel |
103 | 103 | */ |
104 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
104 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) | |
105 | 105 | { |
106 | 106 | ServicesServer::getInstance()->addServiceImpl<CalibrationInfoWriter::CalibrationInfoProcess>("energy_bounds",&energy_bounds); |
107 | + ServicesServer::getInstance()->linkProcessWithPlugin("energy_bounds", plugingPath); | |
107 | 108 | } | ... | ... |
src/ExternLib/FramesTransformation/AMDAPlugin.cc
... | ... | @@ -74,8 +74,9 @@ extern "C" const char* getPluginVersion() |
74 | 74 | /** |
75 | 75 | Tells us to register our functionality to an engine kernel |
76 | 76 | */ |
77 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
77 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) | |
78 | 78 | { |
79 | 79 | ProcessFactory factProcessFramesTransformation = boost::factory<ProcessFramesTransformation*>(); |
80 | 80 | ServicesServer::getInstance()->addProcessFactory("framesTransformation", factProcessFramesTransformation); |
81 | + ServicesServer::getInstance()->linkProcessWithPlugin("framesTransformation", plugingPath, std::string& plugingPath); | |
81 | 82 | } | ... | ... |
src/ExternLib/GetClbInfo/AMDAPlugin.cc
... | ... | @@ -74,8 +74,9 @@ extern "C" const char* getPluginVersion() |
74 | 74 | /** |
75 | 75 | Tells us to register our functionality to an engine kernel |
76 | 76 | */ |
77 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
77 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) | |
78 | 78 | { |
79 | 79 | ProcessFactory factProcessGetClbInfo = boost::factory<AMDA::GetClbInfo::GetClbInfoProcess*>(); |
80 | 80 | ServicesServer::getInstance()->addProcessFactory("getClbInfo", factProcessGetClbInfo); |
81 | + ServicesServer::getInstance()->linkProcessWithPlugin("getClbInfo", plugingPath); | |
81 | 82 | } | ... | ... |
src/ExternLib/GetClbInfoByIndex/AMDAPlugin.cc
... | ... | @@ -74,8 +74,9 @@ extern "C" const char* getPluginVersion() |
74 | 74 | /** |
75 | 75 | Tells us to register our functionality to an engine kernel |
76 | 76 | */ |
77 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
77 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) | |
78 | 78 | { |
79 | 79 | ProcessFactory factProcessGetClbInfoByIndex = boost::factory<AMDA::GetClbInfoByIndex::GetClbInfoByIndexProcess*>(); |
80 | 80 | ServicesServer::getInstance()->addProcessFactory("getClbInfoByIndex", factProcessGetClbInfoByIndex); |
81 | + ServicesServer::getInstance()->linkProcessWithPlugin("getClbInfoByIndex", plugingPath); | |
81 | 82 | } | ... | ... |
src/ExternLib/GetJunoJediEnergy/AMDAPlugin.cc
... | ... | @@ -74,7 +74,7 @@ extern "C" const char* getPluginVersion() |
74 | 74 | /** |
75 | 75 | Tells us to register our functionality to an engine kernel |
76 | 76 | */ |
77 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
77 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) | |
78 | 78 | { |
79 | 79 | ProcessFactory factProcessGetJunoJediLowerEnergy = boost::factory<AMDA::JunoJedi::GetJunoJediLowerEnergyProcess*>(); |
80 | 80 | ServicesServer::getInstance()->addProcessFactory("getJunoJediLowerEnergy", factProcessGetJunoJediLowerEnergy); |
... | ... | @@ -82,4 +82,6 @@ extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) |
82 | 82 | ProcessFactory factProcessGetJunoJediUpperEnergy = boost::factory<AMDA::JunoJedi::GetJunoJediUpperEnergyProcess*>(); |
83 | 83 | |
84 | 84 | ServicesServer::getInstance()->addProcessFactory("getJunoJediUpperEnergy", factProcessGetJunoJediUpperEnergy); |
85 | + | |
86 | + ServicesServer::getInstance()->linkProcessWithPlugin("getJunoJediUpperEnergy", plugingPath); | |
85 | 87 | } | ... | ... |
src/ExternLib/GetMavenStaticEnergy/AMDAPlugin.cc
... | ... | @@ -74,8 +74,10 @@ extern "C" const char* getPluginVersion() |
74 | 74 | /** |
75 | 75 | Tells us to register our functionality to an engine kernel |
76 | 76 | */ |
77 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
77 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) | |
78 | 78 | { |
79 | 79 | ProcessFactory factProcessGetMavenStaticEnergy = boost::factory<AMDA::MavenStatic::GetMavenStaticEnergyProcess*>(); |
80 | 80 | ServicesServer::getInstance()->addProcessFactory("getMavenStaticEnergy", factProcessGetMavenStaticEnergy); |
81 | + ServicesServer::getInstance()->linkProcessWithPlugin("getMavenStaticEnergy", plugingPath); | |
82 | + | |
81 | 83 | } | ... | ... |
src/ExternLib/Merge/AMDAPlugin.cc
... | ... | @@ -74,8 +74,9 @@ extern "C" const char* getPluginVersion() |
74 | 74 | /** |
75 | 75 | Tells us to register our functionality to an engine kernel |
76 | 76 | */ |
77 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
77 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) | |
78 | 78 | { |
79 | 79 | ProcessFactory factProcessMerge = boost::factory<AMDA::Merge::MergeProcess*>(); |
80 | 80 | ServicesServer::getInstance()->addProcessFactory("merge", factProcessMerge); |
81 | + ServicesServer::getInstance()->linkProcessWithPlugin("merge", plugingPath); | |
81 | 82 | } | ... | ... |
src/ExternLib/Morschhauser/AMDAPlugin.cc
... | ... | @@ -75,11 +75,13 @@ extern "C" const char* getPluginVersion() |
75 | 75 | /** |
76 | 76 | Tells us to register our functionality to an engine kernel |
77 | 77 | */ |
78 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
78 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) | |
79 | 79 | { |
80 | 80 | ProcessFactory factProcessMorschhauserBFieldProcess = boost::factory<MorschhauserBfieldProcess*>(); |
81 | 81 | ServicesServer::getInstance()->addProcessFactory("morschhauser_bfield", factProcessMorschhauserBFieldProcess); |
82 | + ServicesServer::getInstance()->linkProcessWithPlugin("morschhauser_bfield", plugingPath); | |
82 | 83 | |
83 | 84 | ProcessFactory factProcessMorschhauserBMagProcess = boost::factory<MorschhauserBmagProcess*>(); |
84 | 85 | ServicesServer::getInstance()->addProcessFactory("morschhauser_bmag", factProcessMorschhauserBMagProcess); |
86 | + ServicesServer::getInstance()->linkProcessWithPlugin("morschhauser_bmag", plugingPath); | |
85 | 87 | } | ... | ... |
src/ExternLib/PlotCurves/AMDAPlugin.cc
... | ... | @@ -92,7 +92,7 @@ extern "C" const char* getPluginVersion() |
92 | 92 | /** |
93 | 93 | Tells us to register our functionality to an engine kernel |
94 | 94 | */ |
95 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
95 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, , std::string& /*plugingPath*/) | |
96 | 96 | { |
97 | 97 | ServicesServer::getInstance()->addServiceImpl<CurveFunctionWriter::CurveFunctionProcess>("bowshock",&bowshock); |
98 | 98 | ServicesServer::getInstance()->addServiceImpl<CurveFunctionWriter::CurveFunctionProcess>("bowshock_farris",&bowshock_farris); | ... | ... |
src/ExternLib/SlidingAverage/AMDAPlugin.cc
... | ... | @@ -74,8 +74,9 @@ extern "C" const char* getPluginVersion() |
74 | 74 | /** |
75 | 75 | Tells us to register our functionality to an engine kernel |
76 | 76 | */ |
77 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
77 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) | |
78 | 78 | { |
79 | 79 | ProcessFactory factProcessSlidingAverageProcess = boost::factory<SlidingAverageProcess*>(); |
80 | 80 | ServicesServer::getInstance()->addProcessFactory("sliding_average", factProcessSlidingAverageProcess); |
81 | + ServicesServer::getInstance()->linkProcessWithPlugin("sliding_average", plugingPath); | |
81 | 82 | } | ... | ... |
src/ExternLib/StatisticFunctions/AMDAPlugin.cc
... | ... | @@ -19,47 +19,56 @@ using namespace AMDA::Parameters; |
19 | 19 | |
20 | 20 | /** |
21 | 21 | Retrieve the Plugin version we're going to expect |
22 | -*/ | |
23 | -extern "C" const char* getPluginVersion() | |
24 | -{ | |
25 | - return "(Version)"; | |
22 | + */ | |
23 | +extern "C" const char* getPluginVersion() { | |
24 | + return "(Version)"; | |
26 | 25 | } |
27 | 26 | |
28 | 27 | /** |
29 | 28 | Tells us to register our functionality to an engine kernel |
30 | -*/ | |
31 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
32 | -{ | |
33 | - ProcessFactory factProcessMinFunc = boost::factory<ProcessMinFunc*>(); | |
34 | - ServicesServer::getInstance()->addProcessFactory("min", factProcessMinFunc); | |
35 | - | |
36 | - ProcessFactory factProcessMinSmFunc = boost::factory<ProcessMinSmFunc*>(); | |
37 | - ServicesServer::getInstance()->addProcessFactory("min_sm", factProcessMinSmFunc); | |
38 | - | |
39 | - ProcessFactory factProcessMaxFunc = boost::factory<ProcessMaxFunc*>(); | |
40 | - ServicesServer::getInstance()->addProcessFactory("max", factProcessMaxFunc); | |
41 | - | |
42 | - ProcessFactory factProcessMaxSmFunc = boost::factory<ProcessMaxSmFunc*>(); | |
43 | - ServicesServer::getInstance()->addProcessFactory("max_sm", factProcessMaxSmFunc); | |
44 | - | |
45 | - ProcessFactory factProcessVarFunc = boost::factory<ProcessVarFunc*>(); | |
46 | - ServicesServer::getInstance()->addProcessFactory("var", factProcessVarFunc); | |
47 | - | |
48 | - ProcessFactory factProcessVarSmFunc = boost::factory<ProcessVarSmFunc*>(); | |
49 | - ServicesServer::getInstance()->addProcessFactory("var_sm", factProcessVarSmFunc); | |
50 | - | |
51 | - ProcessFactory factProcessRmsFunc = boost::factory<ProcessRmsFunc*>(); | |
52 | - ServicesServer::getInstance()->addProcessFactory("rms", factProcessRmsFunc); | |
53 | - | |
54 | - ProcessFactory factProcessRmsSmFunc = boost::factory<ProcessRmsSmFunc*>(); | |
55 | - ServicesServer::getInstance()->addProcessFactory("rms_sm", factProcessRmsSmFunc); | |
56 | - | |
57 | - ProcessFactory factProcessSkewFunc = boost::factory<ProcessSkewFunc*>(); | |
58 | - ServicesServer::getInstance()->addProcessFactory("skew", factProcessSkewFunc); | |
59 | - | |
60 | - ProcessFactory factProcessSkewSmFunc = boost::factory<ProcessSkewSmFunc*>(); | |
61 | - ServicesServer::getInstance()->addProcessFactory("skew_sm", factProcessSkewSmFunc); | |
62 | - | |
63 | - ProcessFactory factProcessMedianFunc = boost::factory<ProcessMedianFunc*>(); | |
64 | - ServicesServer::getInstance()->addProcessFactory("median", factProcessMedianFunc); | |
29 | + */ | |
30 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) { | |
31 | + ProcessFactory factProcessMinFunc = boost::factory<ProcessMinFunc*>(); | |
32 | + ServicesServer::getInstance()->addProcessFactory("min", factProcessMinFunc); | |
33 | + ServicesServer::getInstance()->linkProcessWithPlugin("min", plugingPath); | |
34 | + | |
35 | + ProcessFactory factProcessMinSmFunc = boost::factory<ProcessMinSmFunc*>(); | |
36 | + ServicesServer::getInstance()->addProcessFactory("min_sm", factProcessMinSmFunc); | |
37 | + ServicesServer::getInstance()->linkProcessWithPlugin("min_sm", plugingPath); | |
38 | + | |
39 | + ProcessFactory factProcessMaxFunc = boost::factory<ProcessMaxFunc*>(); | |
40 | + ServicesServer::getInstance()->addProcessFactory("max", factProcessMaxFunc); | |
41 | + ServicesServer::getInstance()->linkProcessWithPlugin("max", plugingPath); | |
42 | + | |
43 | + ProcessFactory factProcessMaxSmFunc = boost::factory<ProcessMaxSmFunc*>(); | |
44 | + ServicesServer::getInstance()->addProcessFactory("max_sm", factProcessMaxSmFunc); | |
45 | + ServicesServer::getInstance()->linkProcessWithPlugin("max_sm", plugingPath); | |
46 | + | |
47 | + ProcessFactory factProcessVarFunc = boost::factory<ProcessVarFunc*>(); | |
48 | + ServicesServer::getInstance()->addProcessFactory("var", factProcessVarFunc); | |
49 | + ServicesServer::getInstance()->linkProcessWithPlugin("var", plugingPath); | |
50 | + | |
51 | + ProcessFactory factProcessVarSmFunc = boost::factory<ProcessVarSmFunc*>(); | |
52 | + ServicesServer::getInstance()->addProcessFactory("var_sm", factProcessVarSmFunc); | |
53 | + ServicesServer::getInstance()->linkProcessWithPlugin("var_sm", plugingPath); | |
54 | + | |
55 | + ProcessFactory factProcessRmsFunc = boost::factory<ProcessRmsFunc*>(); | |
56 | + ServicesServer::getInstance()->addProcessFactory("rms", factProcessRmsFunc); | |
57 | + ServicesServer::getInstance()->linkProcessWithPlugin("rms", plugingPath); | |
58 | + | |
59 | + ProcessFactory factProcessRmsSmFunc = boost::factory<ProcessRmsSmFunc*>(); | |
60 | + ServicesServer::getInstance()->addProcessFactory("rms_sm", factProcessRmsSmFunc); | |
61 | + ServicesServer::getInstance()->linkProcessWithPlugin("rms_sm", plugingPath); | |
62 | + | |
63 | + ProcessFactory factProcessSkewFunc = boost::factory<ProcessSkewFunc*>(); | |
64 | + ServicesServer::getInstance()->addProcessFactory("skew", factProcessSkewFunc); | |
65 | + ServicesServer::getInstance()->linkProcessWithPlugin("skew", plugingPath); | |
66 | + | |
67 | + ProcessFactory factProcessSkewSmFunc = boost::factory<ProcessSkewSmFunc*>(); | |
68 | + ServicesServer::getInstance()->addProcessFactory("skew_sm", factProcessSkewSmFunc); | |
69 | + ServicesServer::getInstance()->linkProcessWithPlugin("skew_sm", plugingPath); | |
70 | + | |
71 | + ProcessFactory factProcessMedianFunc = boost::factory<ProcessMedianFunc*>(); | |
72 | + ServicesServer::getInstance()->addProcessFactory("median", factProcessMedianFunc); | |
73 | + ServicesServer::getInstance()->linkProcessWithPlugin("median", plugingPath); | |
65 | 74 | } | ... | ... |
src/ExternLib/StatisticProcesses/AMDAPlugin.cc
1 | 1 | /* -*- Base: 10 ; Mode: C++ -*- */ |
2 | 2 | /*------------------------------------------------------------------------ |
3 | - ** | |
4 | - FOST project | |
5 | - ** | |
3 | + ** | |
4 | + FOST project | |
5 | + ** | |
6 | 6 | -------------------------------------------------------------------------- |
7 | 7 | -------------------------------------------------------------------------- |
8 | - FILE LOG | |
9 | - $Revision: 1.3 $ $Date: 2012-06-15 13:04:42 $ | |
8 | + FILE LOG | |
9 | + $Revision: 1.3 $ $Date: 2012-06-15 13:04:42 $ | |
10 | 10 | -------------------------------------------------------------------------- |
11 | 11 | CREATION |
12 | - V.SAC | |
12 | + V.SAC | |
13 | 13 | |
14 | 14 | SUMMARY |
15 | 15 | |
16 | 16 | DESCRIPTION |
17 | 17 | |
18 | - The main function performs the following actions : | |
19 | - <ul> | |
20 | - <li> | |
21 | - </ul> | |
18 | + The main function performs the following actions : | |
19 | + <ul> | |
20 | + <li> | |
21 | + </ul> | |
22 | 22 | |
23 | 23 | ------------------------------------------------------------------------*/ |
24 | 24 | |
... | ... | @@ -33,7 +33,7 @@ DESCRIPTION |
33 | 33 | |
34 | 34 | /** |
35 | 35 | |
36 | -*/ | |
36 | + */ | |
37 | 37 | //============================================================================= |
38 | 38 | // Include section |
39 | 39 | //============================================================================= |
... | ... | @@ -68,54 +68,62 @@ using namespace AMDA::Parameters; |
68 | 68 | // Methods of Class AMDAPlugin |
69 | 69 | //============================================================================= |
70 | 70 | |
71 | - | |
72 | - | |
73 | 71 | /** |
74 | 72 | Retrieve the Plugin version we're going to expect |
75 | -*/ | |
76 | -extern "C" const char* getPluginVersion() | |
77 | -{ | |
78 | - return "(Version)"; | |
73 | + */ | |
74 | +extern "C" const char* getPluginVersion() { | |
75 | + return "(Version)"; | |
79 | 76 | } |
80 | 77 | |
81 | 78 | /** |
82 | 79 | Tells us to register our functionality to an engine kernel |
83 | -*/ | |
84 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
85 | -{ | |
86 | - StatisticProcessFactory factMinProcess = boost::factory<AMDA::Statistic::MinMaxMean::MinStatisticProcess*>(); | |
87 | - ServicesServer::getInstance()->addStatisticProcessFactory("min", factMinProcess); | |
88 | - | |
89 | - StatisticProcessFactory factMaxProcess = boost::factory<AMDA::Statistic::MinMaxMean::MaxStatisticProcess*>(); | |
90 | - ServicesServer::getInstance()->addStatisticProcessFactory("max", factMaxProcess); | |
91 | - | |
92 | - StatisticProcessFactory factMeanProcess = boost::factory<AMDA::Statistic::MinMaxMean::MeanStatisticProcess*>(); | |
93 | - ServicesServer::getInstance()->addStatisticProcessFactory("mean", factMeanProcess); | |
94 | - | |
95 | - StatisticProcessFactory factRMSProcess = boost::factory<AMDA::Statistic::MinMaxMean::RMSStatisticProcess*>(); | |
96 | - ServicesServer::getInstance()->addStatisticProcessFactory("RMS", factRMSProcess); | |
97 | - | |
98 | - StatisticProcessFactory factMinVarProcess = boost::factory<AMDA::Statistic::MinVar::MinVarStatisticProcess*>(); | |
99 | - ServicesServer::getInstance()->addStatisticProcessFactory("minvar", factMinVarProcess); | |
100 | - | |
101 | - StatisticProcessFactory factMedianProcess = boost::factory<AMDA::Statistic::MinMaxMean::MedianStatisticProcess*>(); | |
102 | - ServicesServer::getInstance()->addStatisticProcessFactory("median", factMedianProcess); | |
103 | - | |
104 | - StatisticProcessFactory factVarianceProcess = boost::factory<AMDA::Statistic::MinMaxMean::VarianceStatisticProcess*>(); | |
105 | - ServicesServer::getInstance()->addStatisticProcessFactory("variance", factVarianceProcess); | |
106 | - | |
107 | - StatisticProcessFactory factSkewnessProcess = boost::factory<AMDA::Statistic::MinMaxMean::SkewnessStatisticProcess*>(); | |
108 | - ServicesServer::getInstance()->addStatisticProcessFactory("skewness", factSkewnessProcess); | |
109 | - | |
110 | - StatisticProcessFactory factKurtosisProcess = boost::factory<AMDA::Statistic::MinMaxMean::KurtosisStatisticProcess*>(); | |
111 | - ServicesServer::getInstance()->addStatisticProcessFactory("kurtosis", factKurtosisProcess); | |
112 | - | |
113 | - StatisticProcessFactory factCountProcess = boost::factory<AMDA::Statistic::Count::CountStatisticProcess*>(); | |
114 | - ServicesServer::getInstance()->addStatisticProcessFactory("count", factCountProcess); | |
115 | - | |
116 | - StatisticProcessFactory factCountNotNanProcess = boost::factory<AMDA::Statistic::Count::CountNotNanStatisticProcess*>(); | |
117 | - ServicesServer::getInstance()->addStatisticProcessFactory("countNotNan", factCountNotNanProcess); | |
118 | - | |
119 | - StatisticProcessFactory factBoolProcess = boost::factory<AMDA::Statistic::CountBool::CountBoolStatisticProcess*>(); | |
120 | - ServicesServer::getInstance()->addStatisticProcessFactory("countTrue", factBoolProcess); | |
80 | + */ | |
81 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) { | |
82 | + StatisticProcessFactory factMinProcess = boost::factory<AMDA::Statistic::MinMaxMean::MinStatisticProcess*>(); | |
83 | + ServicesServer::getInstance()->addStatisticProcessFactory("min", factMinProcess); | |
84 | + ServicesServer::getInstance()->linkStatisticProcessWithPlugin("min", plugingPath); | |
85 | + | |
86 | + StatisticProcessFactory factMaxProcess = boost::factory<AMDA::Statistic::MinMaxMean::MaxStatisticProcess*>(); | |
87 | + ServicesServer::getInstance()->addStatisticProcessFactory("max", factMaxProcess); | |
88 | + ServicesServer::getInstance()->linkStatisticProcessWithPlugin("max", plugingPath); | |
89 | + | |
90 | + StatisticProcessFactory factMeanProcess = boost::factory<AMDA::Statistic::MinMaxMean::MeanStatisticProcess*>(); | |
91 | + ServicesServer::getInstance()->addStatisticProcessFactory("mean", factMeanProcess); | |
92 | + ServicesServer::getInstance()->linkStatisticProcessWithPlugin("mean", plugingPath); | |
93 | + | |
94 | + StatisticProcessFactory factRMSProcess = boost::factory<AMDA::Statistic::MinMaxMean::RMSStatisticProcess*>(); | |
95 | + ServicesServer::getInstance()->addStatisticProcessFactory("RMS", factRMSProcess); | |
96 | + ServicesServer::getInstance()->linkStatisticProcessWithPlugin("RMS", plugingPath); | |
97 | + | |
98 | + StatisticProcessFactory factMinVarProcess = boost::factory<AMDA::Statistic::MinVar::MinVarStatisticProcess*>(); | |
99 | + ServicesServer::getInstance()->addStatisticProcessFactory("minvar", factMinVarProcess); | |
100 | + ServicesServer::getInstance()->linkStatisticProcessWithPlugin("minvar", plugingPath); | |
101 | + | |
102 | + StatisticProcessFactory factMedianProcess = boost::factory<AMDA::Statistic::MinMaxMean::MedianStatisticProcess*>(); | |
103 | + ServicesServer::getInstance()->addStatisticProcessFactory("median", factMedianProcess); | |
104 | + ServicesServer::getInstance()->linkStatisticProcessWithPlugin("median", plugingPath); | |
105 | + | |
106 | + StatisticProcessFactory factVarianceProcess = boost::factory<AMDA::Statistic::MinMaxMean::VarianceStatisticProcess*>(); | |
107 | + ServicesServer::getInstance()->addStatisticProcessFactory("variance", factVarianceProcess); | |
108 | + ServicesServer::getInstance()->linkStatisticProcessWithPlugin("variance", plugingPath); | |
109 | + | |
110 | + StatisticProcessFactory factSkewnessProcess = boost::factory<AMDA::Statistic::MinMaxMean::SkewnessStatisticProcess*>(); | |
111 | + ServicesServer::getInstance()->addStatisticProcessFactory("skewness", factSkewnessProcess); | |
112 | + ServicesServer::getInstance()->linkStatisticProcessWithPlugin("skewness", plugingPath); | |
113 | + | |
114 | + StatisticProcessFactory factKurtosisProcess = boost::factory<AMDA::Statistic::MinMaxMean::KurtosisStatisticProcess*>(); | |
115 | + ServicesServer::getInstance()->addStatisticProcessFactory("kurtosis", factKurtosisProcess); | |
116 | + ServicesServer::getInstance()->linkStatisticProcessWithPlugin("kurtosis", plugingPath); | |
117 | + | |
118 | + StatisticProcessFactory factCountProcess = boost::factory<AMDA::Statistic::Count::CountStatisticProcess*>(); | |
119 | + ServicesServer::getInstance()->addStatisticProcessFactory("count", factCountProcess); | |
120 | + ServicesServer::getInstance()->linkStatisticProcessWithPlugin("count", plugingPath); | |
121 | + | |
122 | + StatisticProcessFactory factCountNotNanProcess = boost::factory<AMDA::Statistic::Count::CountNotNanStatisticProcess*>(); | |
123 | + ServicesServer::getInstance()->addStatisticProcessFactory("countNotNan", factCountNotNanProcess); | |
124 | + ServicesServer::getInstance()->linkStatisticProcessWithPlugin("countNotNan", plugingPath); | |
125 | + | |
126 | + StatisticProcessFactory factBoolProcess = boost::factory<AMDA::Statistic::CountBool::CountBoolStatisticProcess*>(); | |
127 | + ServicesServer::getInstance()->addStatisticProcessFactory("countTrue", factBoolProcess); | |
128 | + ServicesServer::getInstance()->linkStatisticProcessWithPlugin("countTrue", plugingPath); | |
121 | 129 | } | ... | ... |
src/ExternLib/TimeShifted/AMDAPlugin.cc
... | ... | @@ -74,8 +74,9 @@ extern "C" const char* getPluginVersion() |
74 | 74 | /** |
75 | 75 | Tells us to register our functionality to an engine kernel |
76 | 76 | */ |
77 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
77 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) | |
78 | 78 | { |
79 | 79 | ProcessFactory factProcessTimeShifted = boost::factory<ProcessTimeShifted*>(); |
80 | 80 | ServicesServer::getInstance()->addProcessFactory("timeShift", factProcessTimeShifted); |
81 | + ServicesServer::getInstance()->linkProcessWithPlugin("timeShift", plugingPath); | |
81 | 82 | } | ... | ... |
src/ExternLib/Tsyganenko96/AMDAPlugin.cc
... | ... | @@ -19,19 +19,20 @@ using namespace AMDA::Parameters; |
19 | 19 | |
20 | 20 | /** |
21 | 21 | Retrieve the Plugin version we're going to expect |
22 | -*/ | |
23 | -extern "C" const char* getPluginVersion() | |
24 | -{ | |
25 | - return "(Version)"; | |
22 | + */ | |
23 | +extern "C" const char* getPluginVersion() { | |
24 | + return "(Version)"; | |
26 | 25 | } |
27 | 26 | |
28 | 27 | /** |
29 | 28 | Tells us to register our functionality to an engine kernel |
30 | -*/ | |
31 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
32 | -{ | |
33 | - ProcessFactory factProcessTsyganenko96GSM = boost::factory<ProcessTsyganenko96GSM*>(); | |
34 | - ServicesServer::getInstance()->addProcessFactory("tsyganenko_96", factProcessTsyganenko96GSM); | |
35 | - ProcessFactory factProcessTsyganenko96GSE = boost::factory<ProcessTsyganenko96GSE*>(); | |
36 | - ServicesServer::getInstance()->addProcessFactory("tsyganenko_96_gse", factProcessTsyganenko96GSE); | |
29 | + */ | |
30 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) { | |
31 | + ProcessFactory factProcessTsyganenko96GSM = boost::factory<ProcessTsyganenko96GSM*>(); | |
32 | + ServicesServer::getInstance()->addProcessFactory("tsyganenko_96", factProcessTsyganenko96GSM); | |
33 | + ServicesServer::getInstance()->linkProcessWithPlugin("tsyganenko_96", plugingPath); | |
34 | + | |
35 | + ProcessFactory factProcessTsyganenko96GSE = boost::factory<ProcessTsyganenko96GSE*>(); | |
36 | + ServicesServer::getInstance()->addProcessFactory("tsyganenko_96_gse", factProcessTsyganenko96GSE); | |
37 | + ServicesServer::getInstance()->linkProcessWithPlugin("tsyganenko_96_gse", plugingPath); | |
37 | 38 | } | ... | ... |
src/ExternLib/mexvex_els_decode/AMDAPlugin.cc
... | ... | @@ -28,11 +28,13 @@ extern "C" const char* getPluginVersion() |
28 | 28 | /** |
29 | 29 | Tells us to register our functionality to an engine kernel |
30 | 30 | */ |
31 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
31 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/ , std::string& plugingPath) | |
32 | 32 | { |
33 | 33 | ProcessFactory factProcessMexElsDecode = boost::factory<ProcessMexVexElsDecode*>(); |
34 | 34 | ServicesServer::getInstance()->addProcessFactory("mex_els_decode", factProcessMexElsDecode); |
35 | + ServicesServer::getInstance()->linkProcessWithPlugin("mex_els_decode", plugingPath); | |
35 | 36 | |
36 | 37 | ProcessFactory factProcessVexElsDecode = boost::factory<ProcessMexVexElsDecode*>(); |
37 | 38 | ServicesServer::getInstance()->addProcessFactory("vex_els_decode", factProcessVexElsDecode); |
39 | + ServicesServer::getInstance()->linkProcessWithPlugin("vex_els_decode", plugingPath); | |
38 | 40 | } | ... | ... |
src/ExternLib/sum_into_table_indexes/AMDAPlugin.cc
... | ... | @@ -74,8 +74,9 @@ extern "C" const char* getPluginVersion() |
74 | 74 | /** |
75 | 75 | Tells us to register our functionality to an engine kernel |
76 | 76 | */ |
77 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
77 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/ , std::string& plugingPath) | |
78 | 78 | { |
79 | 79 | ProcessFactory factProcessSumIntoTableIndexes = boost::factory<ProcessSumIntoTableIndexes*>(); |
80 | 80 | ServicesServer::getInstance()->addProcessFactory("sum_into_table_indexes", factProcessSumIntoTableIndexes); |
81 | + ServicesServer::getInstance()->linkProcessWithPlugin("sum_into_table_indexes", plugingPath); | |
81 | 82 | } | ... | ... |
src/ExternLib/sum_into_table_range/AMDAPlugin.cc
... | ... | @@ -74,8 +74,9 @@ extern "C" const char* getPluginVersion() |
74 | 74 | /** |
75 | 75 | Tells us to register our functionality to an engine kernel |
76 | 76 | */ |
77 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
77 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/ , std::string& plugingPath) | |
78 | 78 | { |
79 | 79 | ProcessFactory factProcessSumIntoTableRange = boost::factory<ProcessSumIntoTableRange*>(); |
80 | 80 | ServicesServer::getInstance()->addProcessFactory("sum_into_table_range", factProcessSumIntoTableRange); |
81 | + ServicesServer::getInstance()->linkProcessWithPlugin("sum_into_table_range", plugingPath); | |
81 | 82 | } | ... | ... |
src/ExternLib/ttcat_to_param/AMDAPlugin.cc
... | ... | @@ -74,8 +74,9 @@ extern "C" const char* getPluginVersion() |
74 | 74 | /** |
75 | 75 | Tells us to register our functionality to an engine kernel |
76 | 76 | */ |
77 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
77 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) | |
78 | 78 | { |
79 | 79 | ProcessFactory factProcessTTCatToParam = boost::factory<ProcessTTCatToParam*>(); |
80 | 80 | ServicesServer::getInstance()->addProcessFactory("ttcat_to_param", factProcessTTCatToParam); |
81 | + ServicesServer::getInstance()->linkProcessWithPlugin("ttcat_to_param", plugingPath); | |
81 | 82 | } | ... | ... |
src/InternLib/AMDAPlugin.cc
1 | 1 | /* -*- Base: 10 ; Mode: C++ -*- */ |
2 | 2 | /*------------------------------------------------------------------------ |
3 | - ** | |
4 | - FOST project | |
5 | - ** | |
3 | + ** | |
4 | + FOST project | |
5 | + ** | |
6 | 6 | -------------------------------------------------------------------------- |
7 | 7 | -------------------------------------------------------------------------- |
8 | - FILE LOG | |
9 | - $Revision: 1.3 $ $Date: 2012-06-15 13:04:42 $ | |
8 | + FILE LOG | |
9 | + $Revision: 1.3 $ $Date: 2012-06-15 13:04:42 $ | |
10 | 10 | -------------------------------------------------------------------------- |
11 | 11 | CREATION |
12 | - V.SAC | |
12 | + V.SAC | |
13 | 13 | |
14 | 14 | SUMMARY |
15 | 15 | |
16 | 16 | DESCRIPTION |
17 | 17 | |
18 | - The main function performs the following actions : | |
19 | - <ul> | |
20 | - <li> | |
21 | - </ul> | |
18 | + The main function performs the following actions : | |
19 | + <ul> | |
20 | + <li> | |
21 | + </ul> | |
22 | 22 | |
23 | 23 | ------------------------------------------------------------------------*/ |
24 | 24 | |
... | ... | @@ -33,7 +33,7 @@ DESCRIPTION |
33 | 33 | |
34 | 34 | /** |
35 | 35 | |
36 | -*/ | |
36 | + */ | |
37 | 37 | //============================================================================= |
38 | 38 | // Include section |
39 | 39 | //============================================================================= |
... | ... | @@ -64,26 +64,27 @@ using namespace AMDA::Parameters; |
64 | 64 | // Methods of Class AMDAPlugin |
65 | 65 | //============================================================================= |
66 | 66 | |
67 | - | |
68 | - | |
69 | 67 | /** |
70 | 68 | Retrieve the Plugin version we're going to expect |
71 | -*/ | |
72 | -extern "C" const char* getPluginVersion() | |
73 | -{ | |
74 | - return "(Version)"; | |
69 | + */ | |
70 | +extern "C" const char* getPluginVersion() { | |
71 | + return "(Version)"; | |
75 | 72 | } |
76 | 73 | |
77 | 74 | /** |
78 | 75 | Tells us to register our functionality to an engine kernel |
79 | -*/ | |
80 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
81 | -{ | |
82 | - ProcessFactory factProcessStandard = boost::factory<ProcessStandard*>(); | |
83 | - ProcessFactory factProcessSamplingClassic = boost::factory<ProcessSamplingClassic*>(); | |
84 | - ProcessFactory factProcessSamplingUnderRefParam = boost::factory<ProcessSamplingUnderRefParam*>(); | |
85 | - | |
86 | - ServicesServer::getInstance()->addProcessFactory("standard", factProcessStandard); | |
87 | - ServicesServer::getInstance()->addProcessFactory("sampling_classic", factProcessSamplingClassic); | |
88 | - ServicesServer::getInstance()->addProcessFactory("sampling_under_refparam", factProcessSamplingUnderRefParam); | |
76 | + */ | |
77 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) { | |
78 | + ProcessFactory factProcessStandard = boost::factory<ProcessStandard*>(); | |
79 | + ProcessFactory factProcessSamplingClassic = boost::factory<ProcessSamplingClassic*>(); | |
80 | + ProcessFactory factProcessSamplingUnderRefParam = boost::factory<ProcessSamplingUnderRefParam*>(); | |
81 | + | |
82 | + ServicesServer::getInstance()->addProcessFactory("standard", factProcessStandard); | |
83 | + ServicesServer::getInstance()->linkProcessWithPlugin("standard", plugingPath); | |
84 | + | |
85 | + ServicesServer::getInstance()->addProcessFactory("sampling_classic", factProcessSamplingClassic); | |
86 | + ServicesServer::getInstance()->linkProcessWithPlugin("sampling_classic", plugingPath); | |
87 | + | |
88 | + ServicesServer::getInstance()->addProcessFactory("sampling_under_refparam", factProcessSamplingUnderRefParam); | |
89 | + ServicesServer::getInstance()->linkProcessWithPlugin("sampling_under_refparam", plugingPath); | |
89 | 90 | } | ... | ... |
src/ParamGetImpl/ConstantInterface/AMDAPlugin.cc
... | ... | @@ -48,11 +48,12 @@ extern "C" const char* getPluginVersion() |
48 | 48 | /** |
49 | 49 | * Tells us to register our functionality to an engine kernel |
50 | 50 | */ |
51 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
51 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) | |
52 | 52 | { |
53 | 53 | ParamGetFactory fact = boost::factory<AMDA::ConstantInterface::ParamGetConstant*>(); |
54 | 54 | ServicesServer *servicesServer = ServicesServer::getInstance(); |
55 | 55 | servicesServer->addParamGetFactory("CONSTANT", fact); |
56 | + servicesServer->linkParamGetWithPlugin("CONSTANT", plugingPath); | |
56 | 57 | XMLParameterConfigurator* lXMLConf = dynamic_cast<XMLParameterConfigurator*>(servicesServer->getConfigurator().get()); |
57 | 58 | lXMLConf->addNodeParser("param/get/constant",AMDA::XMLConfigurator::NodeCfgSPtr(new AMDA::XMLParameterConfigurator::GetConstantNode)); |
58 | 59 | } | ... | ... |
src/ParamGetImpl/DDServerInterface/AMDAPlugin.cc
... | ... | @@ -49,11 +49,12 @@ extern "C" const char* getPluginVersion() |
49 | 49 | /** |
50 | 50 | * Tells us to register our functionality to an engine kernel |
51 | 51 | */ |
52 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
52 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) | |
53 | 53 | { |
54 | 54 | ParamGetFactory fact = boost::factory<ParamGetDDBase*>(); |
55 | 55 | ServicesServer *servicesServer = ServicesServer::getInstance(); |
56 | 56 | servicesServer->addParamGetFactory("DDBASE", fact); |
57 | + servicesServer->linkParamGetWithPlugin("DDBASE", plugingPath); | |
57 | 58 | XMLParameterConfigurator* lXMLConf = dynamic_cast<XMLParameterConfigurator*>(servicesServer->getConfigurator().get()); |
58 | 59 | lXMLConf->addNodeParser("param/get/vi",AMDA::XMLConfigurator::NodeCfgSPtr(new GetDDBaseNode)); |
59 | 60 | } | ... | ... |
src/ParamGetImpl/LocalFileInterface/AMDAPlugin.cc
... | ... | @@ -49,11 +49,12 @@ extern "C" const char* getPluginVersion() |
49 | 49 | /** |
50 | 50 | * Tells us to register our functionality to an engine kernel |
51 | 51 | */ |
52 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
52 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) | |
53 | 53 | { |
54 | 54 | ParamGetFactory fact = boost::factory<AMDA::LocalFileInterface::ParamGetLocalFile*>(); |
55 | 55 | ServicesServer *servicesServer = ServicesServer::getInstance(); |
56 | 56 | servicesServer->addParamGetFactory("LOCALFILE", fact); |
57 | + servicesServer->linkParamGetWithPlugin("LOCALFILE", plugingPath); | |
57 | 58 | XMLParameterConfigurator* lXMLConf = dynamic_cast<XMLParameterConfigurator*>(servicesServer->getConfigurator().get()); |
58 | 59 | lXMLConf->addNodeParser("param/get/localvi",AMDA::XMLConfigurator::NodeCfgSPtr(new AMDA::XMLParameterConfigurator::GetLocalFileNode)); |
59 | 60 | } | ... | ... |
src/ParamOutputImpl/DataMining/AMDAPlugin.cc
... | ... | @@ -51,7 +51,7 @@ extern "C" const char* getPluginVersion() |
51 | 51 | /** |
52 | 52 | Tells us to register our functionality to an engine kernel |
53 | 53 | */ |
54 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
54 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) | |
55 | 55 | { |
56 | 56 | AMDA::XMLRequest::XMLRequestParser* lXMLRequestParser = ServicesServer::getInstance()->getService<AMDA::XMLRequest::XMLRequestParser*>(); |
57 | 57 | if (lXMLRequestParser) { |
... | ... | @@ -60,6 +60,7 @@ extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) |
60 | 60 | |
61 | 61 | XMLParameterConfigurator* lXMLConf = dynamic_cast<XMLParameterConfigurator*>(ServicesServer::getInstance()->getConfigurator().get()); |
62 | 62 | lXMLConf->addNodeParser("param/output/dataMining",AMDA::XMLConfigurator::NodeCfgSPtr(new DataMiningNode(ParamOutputDataMining::PRIORITY::PARAM))); |
63 | + ServicesServer::getInstance()->linkParamOutputsWithPlugin("dataMining", plugingPath); | |
63 | 64 | } |
64 | 65 | |
65 | 66 | /** | ... | ... |
src/ParamOutputImpl/Download/AMDAPlugin.cc
... | ... | @@ -81,7 +81,7 @@ extern "C" const char* getPluginVersion() |
81 | 81 | /** |
82 | 82 | Tells us to register our functionality to an engine kernel |
83 | 83 | */ |
84 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
84 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/ , std::string& plugingPath) | |
85 | 85 | { |
86 | 86 | //ParamOutputFactory fact = boost::factory<ParamOutputASCIIFile*>(); |
87 | 87 | //ServicesServer::getInstance()->addParamOutputFactory(std::string("ASCII_FILE"),boost::bind(boost::value_factory<ParamOutputASCIIFile>(),_1)); |
... | ... | @@ -89,6 +89,8 @@ extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) |
89 | 89 | if (lXMLRequestParser) { |
90 | 90 | lXMLRequestParser->addNodeParser("request/outputs/download",AMDA::XMLConfigurator::NodeCfgSPtr(new AMDA::ParamOutputImpl::Download::DownloadNode)); |
91 | 91 | } |
92 | + ServicesServer::getInstance()->linkParamOutputsWithPlugin("download",plugingPath); | |
93 | + | |
92 | 94 | } |
93 | 95 | |
94 | 96 | /** | ... | ... |
src/ParamOutputImpl/IntervalTrue/AMDAPlugin.cc
... | ... | @@ -82,12 +82,13 @@ extern "C" const char* getPluginVersion() |
82 | 82 | /** |
83 | 83 | Tells us to register our functionality to an engine kernel |
84 | 84 | */ |
85 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
85 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) | |
86 | 86 | { |
87 | 87 | AMDA::XMLRequest::XMLRequestParser* lXMLRequestParser = ServicesServer::getInstance()->getService<AMDA::XMLRequest::XMLRequestParser*>(); |
88 | 88 | if (lXMLRequestParser) { |
89 | 89 | lXMLRequestParser->addNodeParser("request/outputs/intervalTrue",AMDA::XMLConfigurator::NodeCfgSPtr(new OutputIntervalTrueNode)); |
90 | 90 | } |
91 | + ServicesServer::getInstance()->linkParamOutputsWithPlugin("intervalTrue", plugingPath); | |
91 | 92 | } |
92 | 93 | |
93 | 94 | /** | ... | ... |
src/ParamOutputImpl/Plot/AMDAPlugin.cc
... | ... | @@ -81,12 +81,14 @@ extern "C" const char* getPluginVersion() |
81 | 81 | /** |
82 | 82 | Tells us to register our functionality to an engine kernel |
83 | 83 | */ |
84 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
84 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) | |
85 | 85 | { |
86 | 86 | AMDA::XMLRequest::XMLRequestParser* lXMLRequestParser = ServicesServer::getInstance()->getService<AMDA::XMLRequest::XMLRequestParser*>(); |
87 | 87 | if (lXMLRequestParser) { |
88 | 88 | lXMLRequestParser->addNodeParser("request/outputs/plot",AMDA::XMLConfigurator::NodeCfgSPtr(new plot::PlotNode)); |
89 | 89 | } |
90 | + ServicesServer::getInstance()->linkParamOutputsWithPlugin("plot", plugingPath); | |
91 | + | |
90 | 92 | } |
91 | 93 | |
92 | 94 | /** | ... | ... |
src/ParamOutputImpl/Statistic/AMDAPlugin.cc
... | ... | @@ -51,12 +51,13 @@ extern "C" const char* getPluginVersion() |
51 | 51 | /** |
52 | 52 | Tells us to register our functionality to an engine kernel |
53 | 53 | */ |
54 | -extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) | |
54 | +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/, std::string& plugingPath) | |
55 | 55 | { |
56 | 56 | AMDA::XMLRequest::XMLRequestParser* lXMLRequestParser = ServicesServer::getInstance()->getService<AMDA::XMLRequest::XMLRequestParser*>(); |
57 | 57 | if (lXMLRequestParser) { |
58 | 58 | lXMLRequestParser->addNodeParser("request/outputs/statistic",AMDA::XMLConfigurator::NodeCfgSPtr(new StatisticNode())); |
59 | 59 | } |
60 | + ServicesServer::getInstance()->linkParamOutputsWithPlugin("statistic", plugingPath); | |
60 | 61 | } |
61 | 62 | |
62 | 63 | /** | ... | ... |
src/Parameters/ServicesServer.hh
... | ... | @@ -26,212 +26,252 @@ |
26 | 26 | #include "AMDA_exception.hh" |
27 | 27 | |
28 | 28 | namespace AMDA { |
29 | -namespace Parameters { | |
30 | - | |
31 | -//use class | |
32 | -class ServicesServer; | |
33 | -class ParamGet; | |
34 | -class Process; | |
35 | -class ParamOutput; | |
36 | -class Parameter; | |
37 | -class StatisticProcess; | |
38 | - | |
39 | -typedef boost::shared_ptr<ServicesServer> ServicesServerSPtr; | |
40 | - | |
41 | -// ParamGet factory definition | |
42 | -typedef boost::function < ParamGet*(Parameter &) > ParamGetFactory; | |
43 | -typedef std::map<std::string, ParamGetFactory> ParamGetFactories; | |
44 | - | |
45 | -// Process factory definition | |
46 | -typedef boost::function < Process*(Parameter &) > ProcessFactory; | |
47 | -typedef std::map<std::string, ProcessFactory> ProcessFactories; | |
48 | - | |
49 | -// ParamOutput factory definition | |
50 | -typedef boost::function < ParamOutput*() > ParamOutputFactory; | |
51 | -typedef std::map<std::string, ParamOutputFactory> ParamOutputFactories; | |
52 | - | |
53 | -// StatisticProcess factory definition | |
54 | -typedef boost::function < StatisticProcess*(Parameter &, const int&) > StatisticProcessFactory; | |
55 | -typedef std::map<std::string, StatisticProcessFactory> StatisticProcessFactories; | |
56 | - | |
57 | -class FileConfigurator; | |
58 | -typedef boost::shared_ptr<FileConfigurator> ParameterConfiguratorSPtr; | |
59 | - | |
60 | -/** | |
61 | - * @class ServicesServer | |
62 | - * @brief To call to register needed Services or to notify implemented Services | |
63 | - * @details This Singleton class is frequently called into the registerPlugin method to notify one or more Services implementation as Process, ParamGet and ParamOutput. | |
64 | - */ | |
65 | -class ServicesServer : public ::Singleton<ServicesServer>{ | |
66 | -public: | |
67 | - // Design pattern | |
68 | - friend class Singleton<ServicesServer>; | |
69 | - typedef std::list<boost::any> ServiceList; | |
70 | - struct exception: virtual AMDA_exception { }; | |
71 | - | |
72 | - /** | |
73 | - * @brief Add a Service implementation | |
74 | - */ | |
75 | - template<typename T> | |
76 | - void addService(T v) { | |
77 | - _serviceList.push_back(v); | |
78 | - } | |
79 | - | |
80 | - /** | |
81 | - * @brief Add a Service implementation | |
82 | - */ | |
83 | - template<typename T> | |
84 | - void declareService() { | |
85 | - typedef typename std::map<std::string,T> TServiceImpList; | |
86 | - for ( ServiceList::const_reverse_iterator rit = _serviceList.rbegin(); rit != _serviceList.rend(); ++rit ) { | |
87 | - if ( (*rit).type() == typeid(TServiceImpList)) { | |
88 | - std::stringstream oss; | |
89 | - oss << "Service already declared: " << Helpers::Demangle(typeid(T).name()); | |
90 | - BOOST_THROW_EXCEPTION(exception() << AMDA::ex_msg(oss.str())); | |
91 | - } | |
92 | - } | |
93 | - _serviceList.push_back(TServiceImpList()); | |
94 | - } | |
95 | - | |
96 | - /** | |
97 | - * @brief Add a Service implementation | |
98 | - */ | |
99 | - template<typename T> | |
100 | - void addServiceImpl(std::string name, T t) { | |
101 | - typedef typename std::map<std::string,T> TServiceImpList; | |
102 | - ServiceList::iterator it = _serviceList.begin(); | |
103 | - for ( ; it != _serviceList.end(); ++it ) { | |
104 | - if ( (*it).type() == typeid(TServiceImpList)) { | |
105 | - TServiceImpList& list = boost::any_cast<TServiceImpList&>(*it); | |
106 | - list.insert(make_pair(name,t)); | |
107 | - break; | |
108 | - } | |
109 | - } | |
110 | - if( it == _serviceList.end()) { | |
111 | - _serviceList.push_back(TServiceImpList()); | |
112 | - ServiceList::iterator it =_serviceList.end(); | |
113 | - TServiceImpList& list = boost::any_cast<TServiceImpList&>(*(--it)); | |
114 | - list.insert(make_pair(name,t)); | |
115 | - } | |
116 | - } | |
117 | - | |
118 | - /** | |
119 | - * @brief Search a Service implementation by this type. | |
120 | - * @return Service or NULL if not found. | |
121 | - */ | |
122 | - template<typename T> | |
123 | - T getService() const { | |
124 | - for ( ServiceList::const_reverse_iterator rit = _serviceList.rbegin(); rit != _serviceList.rend(); ++rit ) { | |
125 | - if ( (*rit).type() == typeid(T)) { | |
126 | - return boost::any_cast<T>(*rit); | |
127 | - } | |
128 | - } | |
129 | - return NULL; | |
130 | - } | |
131 | - | |
132 | - /** | |
133 | - * @brief Search a Service implementation by this type. | |
134 | - * @return Service or NULL if not found. | |
135 | - */ | |
136 | - template<typename T> | |
137 | - T getService(const std::string& pImplName) const { | |
138 | - typedef typename std::map<std::string,T> TServiceImpList; | |
139 | - for ( ServiceList::const_reverse_iterator rit = _serviceList.rbegin(); rit != _serviceList.rend(); ++rit ) { | |
140 | - if ( (*rit).type() == typeid(TServiceImpList)) { | |
141 | - TServiceImpList list = boost::any_cast<TServiceImpList>(*rit); | |
142 | - typename TServiceImpList::iterator it = list.find(pImplName); | |
143 | - if ( it != list.end()) { | |
144 | - return it->second; | |
145 | - } else { | |
146 | - return NULL; | |
147 | - } | |
148 | - } | |
149 | - } | |
150 | - return NULL; | |
151 | - } | |
152 | - | |
153 | - ParamOutput* getParamOutput(std::string paramOutputId) { | |
154 | - return _paramOutputFactory[paramOutputId](); | |
155 | - } | |
156 | - | |
157 | - void addParamOutputFactory(std::string paramOutputId, ParamOutputFactory paramOutputFactory) { | |
158 | - _paramOutputFactory[paramOutputId] = paramOutputFactory; | |
159 | - } | |
160 | - | |
161 | - StatisticProcess* getStatisticProcess(std::string processId, Parameter ¶meter, int index) { | |
162 | - return _statisticProcessFactory[processId](parameter,index); | |
163 | - } | |
164 | - | |
165 | - void addStatisticProcessFactory(std::string processId, StatisticProcessFactory statisticProcessFactory) { | |
166 | - _statisticProcessFactory[processId] = statisticProcessFactory; | |
167 | - } | |
168 | - | |
169 | - ParamGet* getParamGet(std::string paramGetId, Parameter ¶meter) { | |
170 | - return _paramGetFactory[paramGetId](parameter); | |
171 | - } | |
172 | - | |
173 | - void addParamGetFactory(std::string paramGetId, ParamGetFactory paramGetFactory) { | |
174 | - _paramGetFactory[paramGetId] = paramGetFactory; | |
175 | - } | |
176 | - | |
177 | - Process* getProcess(std::string processId, Parameter ¶meter) { | |
178 | - auto lIt = _processFactory.find(processId); | |
179 | - return (lIt==_processFactory.end())?nullptr:lIt->second(parameter); | |
180 | - } | |
181 | - | |
182 | - void addProcessFactory(std::string processId, ProcessFactory processFactory) { | |
183 | - _processFactory[processId] = processFactory; | |
184 | - } | |
185 | - | |
186 | - // Get methods | |
187 | - ParameterConfiguratorSPtr& getConfigurator() { | |
188 | - return _configurator; | |
189 | - } | |
190 | - | |
191 | - // Set methods | |
192 | - void setConfigurator(ParameterConfiguratorSPtr &configurator){ | |
193 | - _configurator = configurator; | |
194 | - } | |
195 | - | |
196 | -private: | |
197 | - | |
198 | - ServicesServer(); | |
199 | - virtual ~ServicesServer(); | |
200 | - | |
201 | - /** | |
202 | - * Factory of ParamGet | |
203 | - * for a string are a sourceParmGet, use | |
204 | - * @code ParamGet p = _paramGetFactory[souceParamGet]() | |
205 | - */ | |
206 | - ParamGetFactories _paramGetFactory; | |
207 | - | |
208 | - /** | |
209 | - * Factory of Process | |
210 | - * for a string are a sourceProcess, use | |
211 | - * @code Process p = _processFactory[souceProcess]() | |
212 | - */ | |
213 | - ProcessFactories _processFactory; | |
214 | - | |
215 | - /** | |
216 | - * Factory of ParamOutput | |
217 | - * for a string are a sourceParmOutput, use | |
218 | - * @code ParamOutput p = _paramOutputFactory[souceParamGet]() | |
219 | - */ | |
220 | - ParamOutputFactories _paramOutputFactory; | |
221 | - | |
222 | - /** | |
223 | - * Factory of StatisticProcess | |
224 | - */ | |
225 | - StatisticProcessFactories _statisticProcessFactory; | |
226 | - | |
227 | - ParameterConfiguratorSPtr _configurator; | |
228 | - | |
229 | - /** | |
230 | - * List of services. | |
231 | - */ | |
232 | - ServiceList _serviceList; | |
233 | -}; | |
234 | - | |
235 | -} /* namespace Parameters */ | |
29 | + namespace Parameters { | |
30 | + | |
31 | + //use class | |
32 | + class ServicesServer; | |
33 | + class ParamGet; | |
34 | + class Process; | |
35 | + class ParamOutput; | |
36 | + class Parameter; | |
37 | + class StatisticProcess; | |
38 | + | |
39 | + typedef boost::shared_ptr<ServicesServer> ServicesServerSPtr; | |
40 | + | |
41 | + // ParamGet factory definition | |
42 | + typedef boost::function < ParamGet*(Parameter &) > ParamGetFactory; | |
43 | + typedef std::map<std::string, ParamGetFactory> ParamGetFactories; | |
44 | + | |
45 | + // Process factory definition | |
46 | + typedef boost::function < Process*(Parameter &) > ProcessFactory; | |
47 | + typedef std::map<std::string, ProcessFactory> ProcessFactories; | |
48 | + | |
49 | + // ParamOutput factory definition | |
50 | + typedef boost::function < ParamOutput*() > ParamOutputFactory; | |
51 | + typedef std::map<std::string, ParamOutputFactory> ParamOutputFactories; | |
52 | + | |
53 | + // StatisticProcess factory definition | |
54 | + typedef boost::function < StatisticProcess*(Parameter &, const int&) > StatisticProcessFactory; | |
55 | + typedef std::map<std::string, StatisticProcessFactory> StatisticProcessFactories; | |
56 | + | |
57 | + class FileConfigurator; | |
58 | + typedef boost::shared_ptr<FileConfigurator> ParameterConfiguratorSPtr; | |
59 | + | |
60 | + /** | |
61 | + * @class ServicesServer | |
62 | + * @brief To call to register needed Services or to notify implemented Services | |
63 | + * @details This Singleton class is frequently called into the registerPlugin method to notify one or more Services implementation as Process, ParamGet and ParamOutput. | |
64 | + */ | |
65 | + class ServicesServer : public ::Singleton<ServicesServer> { | |
66 | + public: | |
67 | + // Design pattern | |
68 | + friend class Singleton<ServicesServer>; | |
69 | + typedef std::list<boost::any> ServiceList; | |
70 | + | |
71 | + struct exception : virtual AMDA_exception { | |
72 | + }; | |
73 | + | |
74 | + /** | |
75 | + * @brief Add a Service implementation | |
76 | + */ | |
77 | + template<typename T> | |
78 | + void addService(T v) { | |
79 | + _serviceList.push_back(v); | |
80 | + } | |
81 | + | |
82 | + /** | |
83 | + * @brief Add a Service implementation | |
84 | + */ | |
85 | + template<typename T> | |
86 | + void declareService() { | |
87 | + typedef typename std::map<std::string, T> TServiceImpList; | |
88 | + for (ServiceList::const_reverse_iterator rit = _serviceList.rbegin(); rit != _serviceList.rend(); ++rit) { | |
89 | + if ((*rit).type() == typeid (TServiceImpList)) { | |
90 | + std::stringstream oss; | |
91 | + oss << "Service already declared: " << Helpers::Demangle(typeid (T).name()); | |
92 | + BOOST_THROW_EXCEPTION(exception() << AMDA::ex_msg(oss.str())); | |
93 | + } | |
94 | + } | |
95 | + _serviceList.push_back(TServiceImpList()); | |
96 | + } | |
97 | + | |
98 | + /** | |
99 | + * @brief Add a Service implementation | |
100 | + */ | |
101 | + template<typename T> | |
102 | + void addServiceImpl(std::string name, T t) { | |
103 | + typedef typename std::map<std::string, T> TServiceImpList; | |
104 | + ServiceList::iterator it = _serviceList.begin(); | |
105 | + for (; it != _serviceList.end(); ++it) { | |
106 | + if ((*it).type() == typeid (TServiceImpList)) { | |
107 | + TServiceImpList& list = boost::any_cast<TServiceImpList&>(*it); | |
108 | + list.insert(make_pair(name, t)); | |
109 | + break; | |
110 | + } | |
111 | + } | |
112 | + if (it == _serviceList.end()) { | |
113 | + _serviceList.push_back(TServiceImpList()); | |
114 | + ServiceList::iterator it = _serviceList.end(); | |
115 | + TServiceImpList& list = boost::any_cast<TServiceImpList&>(*(--it)); | |
116 | + list.insert(make_pair(name, t)); | |
117 | + } | |
118 | + } | |
119 | + | |
120 | + /** | |
121 | + * @brief Search a Service implementation by this type. | |
122 | + * @return Service or NULL if not found. | |
123 | + */ | |
124 | + template<typename T> | |
125 | + T getService() const { | |
126 | + for (ServiceList::const_reverse_iterator rit = _serviceList.rbegin(); rit != _serviceList.rend(); ++rit) { | |
127 | + if ((*rit).type() == typeid (T)) { | |
128 | + return boost::any_cast<T>(*rit); | |
129 | + } | |
130 | + } | |
131 | + return NULL; | |
132 | + } | |
133 | + | |
134 | + /** | |
135 | + * @brief Search a Service implementation by this type. | |
136 | + * @return Service or NULL if not found. | |
137 | + */ | |
138 | + template<typename T> | |
139 | + T getService(const std::string& pImplName) const { | |
140 | + typedef typename std::map<std::string, T> TServiceImpList; | |
141 | + for (ServiceList::const_reverse_iterator rit = _serviceList.rbegin(); rit != _serviceList.rend(); ++rit) { | |
142 | + if ((*rit).type() == typeid (TServiceImpList)) { | |
143 | + TServiceImpList list = boost::any_cast<TServiceImpList>(*rit); | |
144 | + typename TServiceImpList::iterator it = list.find(pImplName); | |
145 | + if (it != list.end()) { | |
146 | + return it->second; | |
147 | + } else { | |
148 | + return NULL; | |
149 | + } | |
150 | + } | |
151 | + } | |
152 | + return NULL; | |
153 | + } | |
154 | + | |
155 | + ParamOutput* getParamOutput(std::string paramOutputId) { | |
156 | + return _paramOutputFactory[paramOutputId](); | |
157 | + } | |
158 | + | |
159 | + void addParamOutputFactory(std::string paramOutputId, ParamOutputFactory paramOutputFactory) { | |
160 | + _paramOutputFactory[paramOutputId] = paramOutputFactory; | |
161 | + } | |
162 | + | |
163 | + StatisticProcess* getStatisticProcess(std::string processId, Parameter ¶meter, int index) { | |
164 | + return _statisticProcessFactory[processId](parameter, index); | |
165 | + } | |
166 | + | |
167 | + void addStatisticProcessFactory(std::string processId, StatisticProcessFactory statisticProcessFactory) { | |
168 | + _statisticProcessFactory[processId] = statisticProcessFactory; | |
169 | + } | |
170 | + | |
171 | + ParamGet* getParamGet(std::string paramGetId, Parameter ¶meter) { | |
172 | + return _paramGetFactory[paramGetId](parameter); | |
173 | + } | |
174 | + | |
175 | + void addParamGetFactory(std::string paramGetId, ParamGetFactory paramGetFactory) { | |
176 | + _paramGetFactory[paramGetId] = paramGetFactory; | |
177 | + } | |
178 | + | |
179 | + Process* getProcess(std::string processId, Parameter ¶meter) { | |
180 | + auto lIt = _processFactory.find(processId); | |
181 | + return (lIt == _processFactory.end()) ? nullptr : lIt->second(parameter); | |
182 | + } | |
183 | + | |
184 | + void addProcessFactory(std::string processId, ProcessFactory processFactory) { | |
185 | + _processFactory[processId] = processFactory; | |
186 | + } | |
187 | + | |
188 | + // Get methods | |
189 | + | |
190 | + ParameterConfiguratorSPtr& getConfigurator() { | |
191 | + return _configurator; | |
192 | + } | |
193 | + | |
194 | + // Set methods | |
195 | + | |
196 | + void setConfigurator(ParameterConfiguratorSPtr &configurator) { | |
197 | + _configurator = configurator; | |
198 | + } | |
199 | + | |
200 | + // link Process with the corresponding Pluging | |
201 | + | |
202 | + void linkProcessWithPlugin(std::string &process, std::string&pluginPath) { | |
203 | + _processPlugingMap[process] = pluginPath; | |
204 | + } | |
205 | + | |
206 | + void linkStatisticProcessWithPlugin(std::string &process, std::string &pluginPath) { | |
207 | + _StatisticProcessPlugingMap[process] =pluginPath; | |
208 | + } | |
209 | + | |
210 | + void linkParamOutputsWithPlugin(std::string &process, std::string &pluginPath) { | |
211 | + _paramOutputPlugingMap[process] = pluginPath; | |
212 | + } | |
213 | + | |
214 | + void linkParamGetWithPlugin(std::string &process, std::string &pluginPath) { | |
215 | + _paramGetPlugingMap[process] = pluginPath; | |
216 | + } | |
217 | + | |
218 | + private: | |
219 | + | |
220 | + ServicesServer(); | |
221 | + virtual ~ServicesServer(); | |
222 | + | |
223 | + /** | |
224 | + * Factory of ParamGet | |
225 | + * for a string are a sourceParmGet, use | |
226 | + * @code ParamGet p = _paramGetFactory[souceParamGet]() | |
227 | + */ | |
228 | + ParamGetFactories _paramGetFactory; | |
229 | + /** | |
230 | + * Map of paramGet and corresponding plugings | |
231 | + */ | |
232 | + std::map<std::string, std::string> _paramGetPlugingMap; | |
233 | + | |
234 | + /** | |
235 | + * Factory of Process | |
236 | + * for a string are a sourceProcess, use | |
237 | + * @code Process p = _processFactory[souceProcess]() | |
238 | + */ | |
239 | + ProcessFactories _processFactory; | |
240 | + /** | |
241 | + * Map of process and corresponding plugings | |
242 | + */ | |
243 | + std::map<std::string, std::string> _processPlugingMap; | |
244 | + | |
245 | + /** | |
246 | + * Factory of ParamOutput | |
247 | + * for a string are a sourceParmOutput, use | |
248 | + * @code ParamOutput p = _paramOutputFactory[souceParamGet]() | |
249 | + */ | |
250 | + ParamOutputFactories _paramOutputFactory; | |
251 | + /** | |
252 | + * Map of process and corresponding plugings | |
253 | + */ | |
254 | + std::map<std::string, std::string> _paramOutputPlugingMap; | |
255 | + | |
256 | + /** | |
257 | + * Factory of StatisticProcess | |
258 | + */ | |
259 | + StatisticProcessFactories _statisticProcessFactory; | |
260 | + /** | |
261 | + * Map of StatisticProcess and corresponding plugings | |
262 | + */ | |
263 | + std::map<std::string, std::string> _StatisticProcessPlugingMap; | |
264 | + | |
265 | + ParameterConfiguratorSPtr _configurator; | |
266 | + | |
267 | + /** | |
268 | + * List of services. | |
269 | + */ | |
270 | + ServiceList _serviceList; | |
271 | + | |
272 | + | |
273 | + }; | |
274 | + | |
275 | + } /* namespace Parameters */ | |
236 | 276 | } /* namespace AMDA */ |
237 | 277 | #endif /* SERVICESSERVER_H_ */ | ... | ... |
src/Plugins/Plugin.hh
... | ... | @@ -43,8 +43,8 @@ class Plugin { |
43 | 43 | } |
44 | 44 | |
45 | 45 | /// Register the plugin to a kernel |
46 | - void registerPlugin(PluginManager &K) { | |
47 | - m_pfnRegisterPlugin(K); | |
46 | + void registerPlugin(PluginManager &K, std::string& pluginPath) { | |
47 | + m_pfnRegisterPlugin(K, pluginPath); | |
48 | 48 | } |
49 | 49 | |
50 | 50 | private: | ... | ... |
src/Plugins/PluginManager.cc
... | ... | @@ -80,7 +80,7 @@ void PluginManager::registerPlugin( const std::string &pluginName, const std::st |
80 | 80 | |
81 | 81 | Plugin plugin( pluginPath+"/"+pluginName); |
82 | 82 | |
83 | - _loadedPlugins.insert(PluginMap::value_type( pluginName, plugin)).first->second.registerPlugin(*this); | |
83 | + _loadedPlugins.insert(PluginMap::value_type( pluginName, plugin)).first->second.registerPlugin(*this, pluginPath+"/"+pluginName); | |
84 | 84 | |
85 | 85 | //PluginWatcher::getInstance()->addPluginToWatch(pluginPath); |
86 | 86 | |
... | ... | @@ -130,7 +130,16 @@ void PluginManager::loadPluginFromPath(const std::string& pluginPath) { |
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | - | |
133 | +/** | |
134 | +void PluginManager::loadNeededPlugins(std::list<std::string>pluginList , const std::string& pluginsPath){ | |
135 | + for (auto pluginName : lPlungList){ | |
136 | + if(_loadedPlugins.find(pluginName) == _loadedPlugins.end()) | |
137 | + { | |
138 | + registerPlugin(pluginsPath, pluginName); | |
139 | + } | |
140 | + } | |
141 | +} | |
142 | +*/ | |
134 | 143 | |
135 | 144 | |
136 | 145 | } // namespace Plugins | ... | ... |
src/Plugins/PluginManager.hh
... | ... | @@ -46,6 +46,8 @@ public: |
46 | 46 | Attempt to load all libraries which match with this pattern '.so' |
47 | 47 | */ |
48 | 48 | void loadPluginFromPath(const std::string& pluginsPath); |
49 | + | |
50 | + //void loadNeededPlugins(std::list<std::string>pluginList , const std::string& pluginsPath); | |
49 | 51 | |
50 | 52 | void loadPluginFromConfigFile(const char* fileName); |
51 | 53 | ... | ... |