]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/configuration/sgconfig/stgconfig.cpp
Add missing CMakeLists.txt
[stg.git] / projects / stargazer / plugins / configuration / sgconfig / stgconfig.cpp
index ca2dd4405e8594bbcff11abe20eb53143cc14524..3f47f24b87bb0f5e7ef30ae35e473e9c43cd472f 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "stgconfig.h"
 
 
 #include "stgconfig.h"
 
-#include "stg/plugin_creator.h"
 #include "stg/common.h"
 
 #include <algorithm>
 #include "stg/common.h"
 
 #include <algorithm>
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-static PLUGIN_CREATOR<STG_CONFIG> stgc;
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-bool STG_CONFIG_SETTINGS::ParseSettings(const MODULE_SETTINGS & s)
+bool STG_CONFIG_SETTINGS::ParseSettings(const STG::ModuleSettings & s)
 {
 {
-    PARAM_VALUE pv;
-    std::vector<PARAM_VALUE>::const_iterator pvi;
+    STG::ParamValue pv;
+    std::vector<STG::ParamValue>::const_iterator pvi;
     ///////////////////////////
     pv.param = "Port";
     pvi = std::find(s.moduleParams.begin(), s.moduleParams.end(), pv);
     ///////////////////////////
     pv.param = "Port";
     pvi = std::find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-    if (pvi == s.moduleParams.end())
+    if (pvi == s.moduleParams.end() || pvi->value.empty())
         {
         errorStr = "Parameter \'Port\' is not found.";
         printfd(__FILE__, "%s\n", errorStr.c_str());
         {
         errorStr = "Parameter \'Port\' is not found.";
         printfd(__FILE__, "%s\n", errorStr.c_str());
@@ -59,7 +54,7 @@ bool STG_CONFIG_SETTINGS::ParseSettings(const MODULE_SETTINGS & s)
 
     pv.param = "BindAddress";
     pvi = std::find(s.moduleParams.begin(), s.moduleParams.end(), pv);
 
     pv.param = "BindAddress";
     pvi = std::find(s.moduleParams.begin(), s.moduleParams.end(), pv);
-    if (pvi != s.moduleParams.end())
+    if (pvi != s.moduleParams.end() && !pvi->value.empty())
         m_bindAddress = pvi->value[0];
 
     return true;
         m_bindAddress = pvi->value[0];
 
     return true;
@@ -67,9 +62,10 @@ bool STG_CONFIG_SETTINGS::ParseSettings(const MODULE_SETTINGS & s)
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
-extern "C" PLUGIN * GetPlugin()
+extern "C" STG::Plugin * GetPlugin()
 {
 {
-return stgc.GetPlugin();
+    static STG_CONFIG plugin;
+    return &plugin;
 }
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 }
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
@@ -77,7 +73,7 @@ return stgc.GetPlugin();
 STG_CONFIG::STG_CONFIG()
     : nonstop(false),
       isRunning(false),
 STG_CONFIG::STG_CONFIG()
     : nonstop(false),
       isRunning(false),
-      logger(GetPluginLogger(GetStgLogger(), "conf_sg")),
+      logger(STG::PluginLogger::get("conf_sg")),
       config(logger)
 {
 }
       config(logger)
 {
 }