summaryrefslogtreecommitdiff
path: root/maximus/coreengine
diff options
context:
space:
mode:
authorburet2007-08-24 16:33:22 +0000
committerburet2007-08-24 16:33:22 +0000
commit2d0367195a370bbfe9fdd7e137553e9139b9bd59 (patch)
tree00497b10b245d9a098c6b2f9b6e8423bb3c1e607 /maximus/coreengine
parentcf2c54e56c561e17f7915fac7078fe1d7c94d39f (diff)
Maximus:
- get network clock events enhancement - debugger option bug correction git-svn-id: svn+ssh://pessac/svn/cesar/trunk@612 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'maximus/coreengine')
-rw-r--r--maximus/coreengine/inc/CoreEngine.h2
-rw-r--r--maximus/coreengine/src/CoreEngine.cpp8
-rw-r--r--maximus/coreengine/src/Maximus.cpp68
-rw-r--r--maximus/coreengine/src/MaximusTest.cpp4
4 files changed, 54 insertions, 28 deletions
diff --git a/maximus/coreengine/inc/CoreEngine.h b/maximus/coreengine/inc/CoreEngine.h
index 884c00a675..a914c21d26 100644
--- a/maximus/coreengine/inc/CoreEngine.h
+++ b/maximus/coreengine/inc/CoreEngine.h
@@ -94,7 +94,7 @@ public:
const std::string station_log,
const std::string debugger );
- bool process ( );
+ bool process ( const Network_Clock_Tick max_tick_value = 0 );
// public attribute accessor methods
//
diff --git a/maximus/coreengine/src/CoreEngine.cpp b/maximus/coreengine/src/CoreEngine.cpp
index dc5ff4e703..e725e51e33 100644
--- a/maximus/coreengine/src/CoreEngine.cpp
+++ b/maximus/coreengine/src/CoreEngine.cpp
@@ -149,15 +149,17 @@ bool CoreEngine::init ( const std::string station_executable,
}
-bool CoreEngine::process ( )
+bool CoreEngine::process ( const Network_Clock_Tick max_tick_value )
{
logFunction();
bool bProcess = false;
try
{
- bProcess = getNetworkClockProcessor()->processNextEvt();
- bProcess &= getSciServer()->process();
+ if(getNetworkClockProcessor()->processNextEvt(max_tick_value))
+ {
+ bProcess = getSciServer()->process();
+ }
}
catch ( Error &e )
{
diff --git a/maximus/coreengine/src/Maximus.cpp b/maximus/coreengine/src/Maximus.cpp
index 579b20070f..044b2cc882 100644
--- a/maximus/coreengine/src/Maximus.cpp
+++ b/maximus/coreengine/src/Maximus.cpp
@@ -47,6 +47,7 @@ The original location of this file is /home/buret/eclipse/maximus/coreengine/src
#include <fstream> // for 'ofstream'
#include <getopt.h> // for 'getopt_long()'
#include <signal.h> // for 'signal()' and 'SIGINT'
+#include <algorithm> // for 'min()'
using namespace std;
// For unitary tests
@@ -67,7 +68,8 @@ Maximus * pMaximus;
Maximus::Maximus ( ):
mpCoreEngine(NULL),
mMaximusLogFile(0),
-mMaxTickValue(0)
+mMaxTickValue(0),
+mWaitTickValue(0)
{
logFunction();
@@ -162,7 +164,7 @@ void Maximus::init ( int argc, char * argv[] )
while (EOF != optionChar)
{
- optionChar = getopt_long(argc, argv, "e:s:m:l:t:d", longOptions, &optionIndex);
+ optionChar = getopt_long(argc, argv, "e:s:m:l:t:d:", longOptions, &optionIndex);
switch (optionChar)
{
@@ -244,17 +246,22 @@ void Maximus::process ( )
try
{
+ Network_Clock_Tick tickValue = 0; // tick value until which to process
+
if (0 == getMaxTickValue())
{
- getCoreEngine()->process();
+ tickValue = getWaitTickValue();
}
- else
+ else if (0 != getWaitTickValue())
{
- if (getNetworkClockProcessor()->getCurrentTickValue() < getMaxTickValue())
- {
- getCoreEngine()->process();
- }
- else
+ tickValue = min(getMaxTickValue(), getWaitTickValue());
+ }
+
+ getCoreEngine()->process(tickValue);
+
+ if (0 != getMaxTickValue())
+ {
+ if (getMaxTickValue() <= getNetworkClockProcessor()->getCurrentTickValue())
{
stop();
}
@@ -265,7 +272,6 @@ void Maximus::process ( )
e.display();
stop();
}
-
}
@@ -332,10 +338,12 @@ void Maximus::wait ( const tick_t value )
try
{
- while(getNetworkClockProcessor()->getCurrentTickValue() > value)
+ setWaitTickValue(getNetworkClockProcessor()->getCurrentTickValue() + value);
+ while (getWaitTickValue() > getNetworkClockProcessor()->getCurrentTickValue())
{
process();
}
+ setWaitTickValue(0);
}
catch ( Error &e )
{
@@ -493,6 +501,32 @@ SciServer * Maximus::getSciServer ( )
}
+Network_Clock_Tick Maximus::getMaxTickValue ( ) const
+{
+ return mMaxTickValue;
+}
+
+
+bool Maximus::setMaxTickValue ( const Network_Clock_Tick max_tick_value )
+{
+ mMaxTickValue = max_tick_value;
+ return true;
+}
+
+
+Network_Clock_Tick Maximus::getWaitTickValue ( ) const
+{
+ return mWaitTickValue;
+}
+
+
+bool Maximus::setWaitTickValue ( const Network_Clock_Tick wait_tick_value )
+{
+ mWaitTickValue = wait_tick_value;
+ return true;
+}
+
+
// public methods
//
@@ -541,15 +575,3 @@ void Maximus::stop ( )
}
}
-Network_Clock_Tick Maximus::getMaxTickValue ( ) const
-{
- return mMaxTickValue;
-}
-
-
-bool Maximus::setMaxTickValue ( const Network_Clock_Tick max_tick_value )
-{
- mMaxTickValue = max_tick_value;
- return true;
-}
-
diff --git a/maximus/coreengine/src/MaximusTest.cpp b/maximus/coreengine/src/MaximusTest.cpp
index dddc64a8c7..cb64809bb2 100644
--- a/maximus/coreengine/src/MaximusTest.cpp
+++ b/maximus/coreengine/src/MaximusTest.cpp
@@ -110,7 +110,9 @@ void MaximusTest::wait_test (void)
if (NULL != mpMaximus)
{
- mpMaximus->wait(0);
+ Sta sta = mpMaximus->create_sta();
+ mpMaximus->wait(10);
+ mpMaximus->process();
mpMaximus->wait();
}
else