OSDN Git Service

[dennco] re-work tick interval workflow. The re-work completed.
authortkawata <tkawata@users.sourceforge.jp>
Sat, 24 Nov 2012 03:23:42 +0000 (12:23 +0900)
committertkawata <tkawata@users.sourceforge.jp>
Sat, 24 Nov 2012 03:23:42 +0000 (12:23 +0900)
Following setting values are added in content's property.xml
- TickIntervalSec_FullScan
- TickIntervalSec_SignalScan
- TickIntervalSec_InputScan
- TickIntervalSec_OutputScan

Source/layer3/DNEngine.cpp

index c25f836..7d826be 100644 (file)
@@ -125,6 +125,11 @@ bool DNEngine::parseSettingFile(const char *contentRoot)
     DNXML *xml = DNXML::createXMLFromFile(contentRoot, "property.xml");
     if (xml)
     {
+        float tickIntervalFull = 1.0;
+        float tickIntervalSignal = 0;
+        float tickIntervalInput = 0;
+        float tickIntervalOutput = 0;
+
         valid = true;
         DNXMLElement *element = xml->getRoot();
         if (!element)
@@ -155,7 +160,7 @@ bool DNEngine::parseSettingFile(const char *contentRoot)
                     is >> t;
                     if (t>0)
                     {
-                        setTickIntervalSec(t, t/mNumUpdateScan,t,t);
+                        tickIntervalFull = t;
                     }
                     else
                     {
@@ -164,6 +169,72 @@ bool DNEngine::parseSettingFile(const char *contentRoot)
                         dnNotifyError("Initialization failed",message);
                     }
                 }
+                else if (pname == "TICKINTERVALSEC_FULLSCAN")
+                {
+                    std::istringstream is(e->text);
+                    float t = 0.0;
+                    is >> t;
+                    if (t>0)
+                    {
+                    }
+                    else
+                    {
+                        valid = false;
+                        std::string message = "Error in property.xml. TickIntervalSec_FullScan is not configured properly.";
+                        dnNotifyError("Initialization failed",message);
+                    }
+
+                }
+                else if (pname == "TICKINTERVALSEC_SIGNALSCAN")
+                {
+                    std::istringstream is(e->text);
+                    float t = 0.0;
+                    is >> t;
+                    if (t>0)
+                    {
+                        tickIntervalSignal = t;
+                    }
+                    else
+                    {
+                        valid = false;
+                        std::string message = "Error in property.xml. TickIntervalSec_SignalScan is not configured properly.";
+                        dnNotifyError("Initialization failed",message);
+                    }
+
+                }
+                else if (pname == "TICKINTERVALSEC_INPUTSCAN")
+                {
+                    std::istringstream is(e->text);
+                    float t = 0.0;
+                    is >> t;
+                    if (t>0)
+                    {
+                        tickIntervalInput = t;
+                    }
+                    else
+                    {
+                        valid = false;
+                        std::string message = "Error in property.xml. TickIntervalSec_InputScan is not configured properly.";
+                        dnNotifyError("Initialization failed",message);
+                    }
+
+                }
+                else if (pname == "TICKINTERVALSEC_OUTPUTSCAN")
+                {
+                    std::istringstream is(e->text);
+                    float t = 0.0;
+                    is >> t;
+                    if (t>0)
+                    {
+                        tickIntervalOutput = t;
+                    }
+                    else
+                    {
+                        valid = false;
+                        std::string message = "Error in property.xml. TickIntervalSec_OutputScan is not configured properly.";
+                        dnNotifyError("Initialization failed",message);
+                    }
+                }
                 else if (pname == "UIPATH")
                 {
                     mUIPath = e->text;
@@ -192,6 +263,21 @@ bool DNEngine::parseSettingFile(const char *contentRoot)
         }
 
         delete xml;
+
+        if (tickIntervalSignal <= 0)
+        {
+            tickIntervalSignal = tickIntervalFull / 5.0;
+        }
+        if (tickIntervalInput <= 0)
+        {
+            tickIntervalInput = tickIntervalFull;
+        }
+        if (tickIntervalOutput <= 0)
+        {
+            tickIntervalOutput = tickIntervalFull;
+        }
+
+        mTimeKeeper->setIntevalSec(tickIntervalFull, tickIntervalSignal, tickIntervalInput, tickIntervalOutput);
     }
     return valid;
 }