]> git.stg.codes - stg.git/commitdiff
First stage of ticket 10
authorNaffanya <naffanya@naffanya.(none)>
Fri, 24 May 2013 23:18:54 +0000 (02:18 +0300)
committerNaffanya <naffanya@naffanya.(none)>
Fri, 24 May 2013 23:18:54 +0000 (02:18 +0300)
include/stg/settings.h
projects/stargazer/main.cpp
projects/stargazer/settings_impl.cpp
projects/stargazer/settings_impl.h

index d23494bc5edd1aa91edd25ed3a7f4a864d76b52d..385439881a5f194b0f453775556f7d335065673a 100644 (file)
 class SETTINGS {
 public:
     virtual ~SETTINGS() {}
 class SETTINGS {
 public:
     virtual ~SETTINGS() {}
-    virtual const std::string & GetDirName(size_t num) const = 0;
-    virtual const std::string & GetScriptsDir() const = 0;
-    virtual unsigned            GetDetailStatWritePeriod() const = 0;
-    virtual unsigned            GetStatWritePeriod() const = 0;
-    virtual unsigned            GetDayFee() const = 0;
-    virtual bool                GetFullFee() const = 0;
-    virtual unsigned            GetDayResetTraff() const = 0;
-    virtual bool                GetSpreadFee() const = 0;
-    virtual bool                GetFreeMbAllowInet() const = 0;
-    virtual bool                GetDayFeeIsLastDay() const = 0;
-    virtual bool                GetWriteFreeMbTraffCost() const = 0;
-    virtual bool                GetShowFeeInCash() const = 0;
-    virtual unsigned            GetMessageTimeout() const = 0;
-    virtual unsigned            GetFeeChargeType() const = 0;
-    virtual bool                GetReconnectOnTariffChange() const = 0;
-    virtual const std::string & GetMonitorDir() const = 0;
-    virtual bool                GetMonitoring() const = 0;
+    virtual const            std::string & GetDirName(size_t num) const = 0;
+    virtual const            std::string & GetScriptsDir() const = 0;
+    virtual unsigned                       GetDetailStatWritePeriod() const = 0;
+    virtual unsigned                       GetStatWritePeriod() const = 0;
+    virtual unsigned                       GetDayFee() const = 0;
+    virtual bool                           GetFullFee() const = 0;
+    virtual unsigned                       GetDayResetTraff() const = 0;
+    virtual bool                           GetSpreadFee() const = 0;
+    virtual bool                           GetFreeMbAllowInet() const = 0;
+    virtual bool                           GetDayFeeIsLastDay() const = 0;
+    virtual bool                           GetWriteFreeMbTraffCost() const = 0;
+    virtual bool                           GetShowFeeInCash() const = 0;
+    virtual unsigned                       GetMessageTimeout() const = 0;
+    virtual unsigned                       GetFeeChargeType() const = 0;
+    virtual bool                           GetReconnectOnTariffChange() const = 0;
+    virtual const            std::string & GetMonitorDir() const = 0;
+    virtual bool                           GetMonitoring() const = 0;
+    virtual const std::vector<std::string> & GetScriptParams() const = 0;
 };
 //-----------------------------------------------------------------------------
 
 };
 //-----------------------------------------------------------------------------
 
index eb61e2d5d5d31975f50db3d0670acd3765b3ab2f..c7bfb4aaa1756ad4d1b3a2a0bc780e45a39b6e46 100644 (file)
@@ -264,14 +264,24 @@ else
 if (settings->ReadSettings())
     {
     STG_LOGGER & WriteServLog = GetStgLogger();
 if (settings->ReadSettings())
     {
     STG_LOGGER & WriteServLog = GetStgLogger();
-
     if (settings->GetLogFileName() != "")
         WriteServLog.SetLogFileName(settings->GetLogFileName());
 
     WriteServLog("ReadSettings error. %s", settings->GetStrError().c_str());
     exit(1);
     }
     if (settings->GetLogFileName() != "")
         WriteServLog.SetLogFileName(settings->GetLogFileName());
 
     WriteServLog("ReadSettings error. %s", settings->GetStrError().c_str());
     exit(1);
     }
-
+/*************************************************************************************************/
+//вывод scriptParams
+    printfd(__FILE__, "--- Script params dump ---\n");
+    std::vector<std::string>::const_iterator it(settings->GetScriptParams().begin());
+    while (it != settings->GetScriptParams().end())
+    {
+        printfd(__FILE__, "%s\n", it->c_str());
+        it++;
+    }
+    printfd(__FILE__, "--- End dump ---\n"); 
+/*************************************************************************************************/
+    
 #ifndef NO_DAEMON
 std::string startFile(settings->GetConfDir() + START_FILE);
 #endif
 #ifndef NO_DAEMON
 std::string startFile(settings->GetConfDir() + START_FILE);
 #endif
index 16a2ac47130f1497fdb47ec1ee33e923989c5e42..8e4acceeb033b6f84c4cdfd744fe9225947ebd32 100644 (file)
@@ -243,7 +243,7 @@ while (node)
         {
         rules = node->getValue(0);
         }
         {
         rules = node->getValue(0);
         }
-
+       
     if (strcasecmp(node->getName(), "DetailStatWritePeriod") == 0)
         {
         if (ParseDetailStatWritePeriod(node->getValue(0)) != 0)
     if (strcasecmp(node->getName(), "DetailStatWritePeriod") == 0)
         {
         if (ParseDetailStatWritePeriod(node->getValue(0)) != 0)
@@ -457,6 +457,16 @@ while (node)
             }
         }
 
             }
         }
 
+        if (strcasecmp(node->getName(), "ScriptParams") == 0)
+        {
+            int i;
+            i=0;
+            while (node->getValue(i)!=NULL)
+            {
+                scriptParams.push_back(node->getValue(i));
+                i++;
+            }
+        }
     node = node->getNextNode();
     }
 
     node = node->getNextNode();
     }
 
@@ -488,4 +498,4 @@ else if (detailStatPeriodStr == "1/6")
 
 return -1;
 }
 
 return -1;
 }
-//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
\ No newline at end of file
index 4a048333a4a5049ead5a6a19b19e10b77f797dd0..3bee15471d5db602108d07d75ee44a7853b6495f 100644 (file)
@@ -98,6 +98,8 @@ public:
         { return storeModuleSettings; }
     const std::vector<MODULE_SETTINGS> & GetModulesSettings() const
         { return modulesSettings; }
         { return storeModuleSettings; }
     const std::vector<MODULE_SETTINGS> & GetModulesSettings() const
         { return modulesSettings; }
+                
+    const std::vector<std::string> & GetScriptParams() const {return scriptParams; }
 
 private:
 
 
 private:
 
@@ -117,6 +119,9 @@ private:
     std::string logFile;
     std::string pidFile;
     std::string monitorDir;
     std::string logFile;
     std::string pidFile;
     std::string monitorDir;
+        
+    std::vector<std::string> scriptParams;
+    
     bool        monitoring;
     unsigned    detailStatWritePeriod;
     unsigned    statWritePeriod;
     bool        monitoring;
     unsigned    detailStatWritePeriod;
     unsigned    statWritePeriod;
@@ -136,7 +141,7 @@ private:
 
     std::vector<MODULE_SETTINGS> modulesSettings;
     MODULE_SETTINGS storeModuleSettings;
 
     std::vector<MODULE_SETTINGS> modulesSettings;
     MODULE_SETTINGS storeModuleSettings;
-
+    
     STG_LOGGER & logger;
 };
 //-----------------------------------------------------------------------------
     STG_LOGGER & logger;
 };
 //-----------------------------------------------------------------------------