summaryrefslogtreecommitdiff
path: root/maximus/networkclock
diff options
context:
space:
mode:
authorburet2007-08-23 10:26:50 +0000
committerburet2007-08-23 10:26:50 +0000
commit66fb962d9e71ec356586fa51b1da1505f255da32 (patch)
treedf45173849e2b1f830fb5713ce4a2d394fe97208 /maximus/networkclock
parent70d576f13f8d9b150a38f6ad45c5637ab38681a9 (diff)
Maximus:
- solve segmentation fault problem - clean Maximus logs and unitary tests logs - remove SAR test files (they have been moved) git-svn-id: svn+ssh://pessac/svn/cesar/trunk@600 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'maximus/networkclock')
-rw-r--r--maximus/networkclock/inc/NetworkClockEvt.h8
-rw-r--r--maximus/networkclock/inc/NetworkClockEvtList.h12
-rw-r--r--maximus/networkclock/inc/NetworkClockEvtListTest.h6
-rw-r--r--maximus/networkclock/inc/NetworkClockEvtTest.h5
-rw-r--r--maximus/networkclock/inc/NetworkClockProcessorTest.h12
-rw-r--r--maximus/networkclock/src/ClockSciMsg.cpp98
-rw-r--r--maximus/networkclock/src/NetworkClockEvt.cpp83
-rw-r--r--maximus/networkclock/src/NetworkClockEvtList.cpp38
-rw-r--r--maximus/networkclock/src/NetworkClockEvtListTest.cpp53
-rw-r--r--maximus/networkclock/src/NetworkClockEvtTest.cpp18
-rw-r--r--maximus/networkclock/src/NetworkClockProcessor.cpp40
-rw-r--r--maximus/networkclock/src/NetworkClockProcessorTest.cpp75
12 files changed, 174 insertions, 274 deletions
diff --git a/maximus/networkclock/inc/NetworkClockEvt.h b/maximus/networkclock/inc/NetworkClockEvt.h
index 776aca8d39..11efcc9432 100644
--- a/maximus/networkclock/inc/NetworkClockEvt.h
+++ b/maximus/networkclock/inc/NetworkClockEvt.h
@@ -31,11 +31,12 @@ The original location of this file is /home/buret/eclipse/maximus/networkclock/i
#ifndef NETWORKCLOCKEVT_H
#define NETWORKCLOCKEVT_H
-#include <iostream>
-
#include "networkclock_types.h"
#include "sci_types.h"
+#include <iostream>
+#include <string>
+
/**
* class NetworkClockEvt
@@ -84,7 +85,6 @@ public:
* Copy Constructors
*/
NetworkClockEvt ( const NetworkClockEvt & evt );
- //NetworkClockEvt ( const NetworkClockEvt * evt );
/**
* Empty Destructor
@@ -155,7 +155,7 @@ private:
void initAttributes ( ) ;
- void displayNetworkClockType ( ) const;
+ std::string getType ( ) const;
protected:
diff --git a/maximus/networkclock/inc/NetworkClockEvtList.h b/maximus/networkclock/inc/NetworkClockEvtList.h
index a6a2c93a18..81c2b08433 100644
--- a/maximus/networkclock/inc/NetworkClockEvtList.h
+++ b/maximus/networkclock/inc/NetworkClockEvtList.h
@@ -31,13 +31,13 @@ The original location of this file is /home/buret/eclipse/maximus/networkclock/i
#ifndef NETWORKCLOCKEVTLIST_H
#define NETWORKCLOCKEVTLIST_H
-#include <map> // for 'multimap'
-
#include "networkclock_types.h"
+#include <map> // for 'multimap'
+
class NetworkClockEvt;
-typedef std::multimap<const Network_Clock_Tick, const NetworkClockEvt> Multimap;
+typedef std::multimap<const Network_Clock_Tick, const NetworkClockEvt> EvtsList;
/**
@@ -57,7 +57,7 @@ private:
// private attributes
//
- Multimap mListOfEvts;
+ EvtsList mListOfEvts;
protected:
@@ -126,13 +126,13 @@ public:
* Set the value of mListOfEvts
* @param list_of_evts the new value of mListOfEvts
*/
- bool setListOfEvts ( Multimap & list_of_evts );
+ bool setListOfEvts ( EvtsList & list_of_evts );
/**
* Get the value of mListOfEvts
* @return the value of mListOfEvts
*/
- Multimap & getListOfEvts ( );
+ EvtsList & getListOfEvts ( );
// protected attribute accessor methods
//
diff --git a/maximus/networkclock/inc/NetworkClockEvtListTest.h b/maximus/networkclock/inc/NetworkClockEvtListTest.h
index abbcb9d137..e8bea172e2 100644
--- a/maximus/networkclock/inc/NetworkClockEvtListTest.h
+++ b/maximus/networkclock/inc/NetworkClockEvtListTest.h
@@ -5,10 +5,8 @@
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
-#include "NetworkClockEvtList.h"
-#include "networkclock_types.h"
-
-using namespace std;
+class NetworkClockEvtList;
+class NetworkClockEvt;
class NetworkClockEvtListTest : public CPPUNIT_NS::TestFixture
diff --git a/maximus/networkclock/inc/NetworkClockEvtTest.h b/maximus/networkclock/inc/NetworkClockEvtTest.h
index 4978eba763..f56ab62781 100644
--- a/maximus/networkclock/inc/NetworkClockEvtTest.h
+++ b/maximus/networkclock/inc/NetworkClockEvtTest.h
@@ -5,10 +5,7 @@
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
-#include "NetworkClockEvt.h"
-#include "networkclock_types.h"
-
-using namespace std;
+class NetworkClockEvt;
class NetworkClockEvtTest : public CPPUNIT_NS::TestFixture
diff --git a/maximus/networkclock/inc/NetworkClockProcessorTest.h b/maximus/networkclock/inc/NetworkClockProcessorTest.h
index 4364a296b6..8b1801b575 100644
--- a/maximus/networkclock/inc/NetworkClockProcessorTest.h
+++ b/maximus/networkclock/inc/NetworkClockProcessorTest.h
@@ -5,13 +5,11 @@
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
-#include "NetworkClockProcessor.h"
-#include "SciServer.h"
-#include "SystemManager.h"
-#include "FunctionCallManager.h"
-#include "PhyProcessor.h"
-
-using namespace std;
+class NetworkClockProcessor;
+class SciServer;
+class SystemManager;
+class FunctionCallManager;
+class PhyProcessor;
class NetworkClockProcessorTest : public CPPUNIT_NS::TestFixture
diff --git a/maximus/networkclock/src/ClockSciMsg.cpp b/maximus/networkclock/src/ClockSciMsg.cpp
index 22d9a6c510..b26b29b050 100644
--- a/maximus/networkclock/src/ClockSciMsg.cpp
+++ b/maximus/networkclock/src/ClockSciMsg.cpp
@@ -29,13 +29,16 @@ The original location of this file is /home/buret/eclipse/maximus/networkclock/s
**************************************************************************/
#include "ClockSciMsg.h"
+
#include "NetworkClockProcessor.h"
#include "NetworkClockEvt.h"
+
+#include "Logger.h"
#include "Error.h"
-#include <iomanip> // for 'std::setfill' and 'std::setw'
+#include <iomanip> // for 'setfill()' and 'setw()'
#include <iostream> // for 'cout', 'clog' and 'cerr'
-#include <netinet/in.h> // for 'ntohl' and 'ntohs' functions
+#include <netinet/in.h> // for 'ntohl()' and 'ntohs()'
using namespace std;
@@ -50,7 +53,7 @@ mSpecializedSciMsgTick(0),
mpSpecializedSciMsgHeader(NULL),
mpNetworkClockProcessor(NULL)
{
- //clog << "ClockSciMsg()" << endl;
+ logFunction();
initAttributes();
}
@@ -63,7 +66,7 @@ mSpecializedSciMsgTick(0),
mpSpecializedSciMsgHeader(NULL),
mpNetworkClockProcessor(NULL)
{
- //clog << "ClockSciMsg(NetworkClockProcessor*)" << endl;
+ logFunction();
initAttributes();
if (NULL != p_network_clock_processor)
@@ -72,19 +75,19 @@ mpNetworkClockProcessor(NULL)
}
else
{
- throw Error("ClockSciMsg(NetworkClockProcessor*)", "Received NetworkClockProcessor pointer is NULL");
+ throw Error(__PRETTY_FUNCTION__, "Network clock processor pointer is NULL");
}
}
void ClockSciMsg::initAttributes ( )
{
- //clog << "ClockSciMsg::initAttributes" << endl;
+ logFunction();
mpSpecializedSciMsgHeader = new Network_Clock_Header;
if (NULL != mpSpecializedSciMsgHeader)
{
- mpSpecializedSciMsgHeader->version = NETWORK_CLOCK_VERSION;
+ mpSpecializedSciMsgHeader->version = 0x00;
mpSpecializedSciMsgHeader->type = 0x00;
mpSpecializedSciMsgHeader->id = 0x0000;
mpSpecializedSciMsgHeader->flags = 0x0000;
@@ -97,14 +100,13 @@ void ClockSciMsg::initAttributes ( )
ClockSciMsg::~ClockSciMsg ( )
{
- //clog << "~ClockSciMsg" << endl;
+ logFunction();
if (NULL != mpSpecializedSciMsgHeader)
{
delete (mpSpecializedSciMsgHeader);
mpSpecializedSciMsgHeader = NULL;
}
-
if (NULL != mpNetworkClockProcessor)
{
mpNetworkClockProcessor = NULL;
@@ -127,15 +129,15 @@ ClockSciMsg::~ClockSciMsg ( )
SciMsg * ClockSciMsg::create ( ) const
{
- //clog << "ClockSciMsg::create" << endl;
-
+ logFunction();
+
return new ClockSciMsg (mpNetworkClockProcessor);
}
bool ClockSciMsg::dispatchMsg ( )
{
- clog << "ClockSciMsg::dispatchMsg" << endl;
+ logFunction();
bool bDispatch = false;
if (NULL != mpNetworkClockProcessor)
@@ -160,13 +162,13 @@ bool ClockSciMsg::dispatchMsg ( )
}
else
{
- cerr << "\tdo nothing" << endl;
+ clog << logger(LOG_WARNING) << "bad event type => do nothing" << endl;
}
}
}
else
{
- throw Error("ClockSciMsg::dispatchMsg", "Initialized network clock processor pointer is NULL");
+ throw Error(__PRETTY_FUNCTION__, "Network clock processor pointer is NULL");
}
return bDispatch;
@@ -177,7 +179,7 @@ bool ClockSciMsg::dispatchMsg ( )
//
bool ClockSciMsg::identifySpecializedSciMsgHeader ( )
{
- //clog << "ClockSciMsg::identifySpecializedSciMsgHeader" << endl;
+ logFunction();
bool bIdentifyHeader = false;
if (NULL != SciMsg::getSciMsgData())
@@ -214,12 +216,12 @@ bool ClockSciMsg::identifySpecializedSciMsgHeader ( )
}
else
{
- throw Error("ClockSciMsg::identifySpecializedSciMsgHeader", "Not enough data to get the specialized SCI message header");
+ throw Error(__PRETTY_FUNCTION__, "Not enough data to get the specialized SCI message header");
}
}
else
{
- throw Error("ClockSciMsg::identifySpecializedSciMsgHeader", "SCI msg data pointer is NULL");
+ throw Error(__PRETTY_FUNCTION__, "SCI message data pointer is NULL");
}
return bIdentifyHeader;
@@ -230,7 +232,7 @@ bool ClockSciMsg::identifySpecializedSciMsgHeader ( )
//
bool ClockSciMsg::checkCompatibility ( ) const
{
- //clog << "ClockSciMsg::checkCompatibility" << endl;
+ logFunction();
bool bCheck = false;
if ( (NULL != getSpecializedSciMsgHeader()) && (NETWORK_CLOCK_VERSION == getSpecializedSciMsgHeader()->version) )
@@ -244,16 +246,16 @@ bool ClockSciMsg::checkCompatibility ( ) const
void ClockSciMsg::displaySpecializedSciMsgHeader( ) const
{
- clog << "\tclock SCI msg header = " << endl;
- clog << "\t\tversion = 0x" << setfill('0') << setw(2) << uppercase << hex << (unsigned short int)getSpecializedSciMsgHeader()->version << endl;
- clog << "\t\ttype = ";
+ logFunction();
+
+ clog << logger(LOG_INFO) << "clock SCI msg header = " << endl;
+ clog << logger(LOG_INFO) << "\tversion = 0x" << setfill('0') << setw(2) << uppercase << hex << static_cast<unsigned short int>(getSpecializedSciMsgHeader()->version) << endl;
displaySpecializedSciMsgType();
- clog << endl;
- clog << "\t\tid = 0x" << setfill('0') << setw(4) << uppercase << hex << getSpecializedSciMsgId() << endl;
- clog << "\t\tflags = 0x" << setfill('0') << setw(4) << uppercase << hex << getSpecializedSciMsgHeader()->flags << endl;
- clog << "\t\treserved = 0x" << setfill('0') << setw(4) << uppercase << hex << getSpecializedSciMsgHeader()->reserved << endl;
- clog << "\t\ttick = 0x" << setfill('0') << setw(8) << uppercase << hex << getSpecializedSciMsgHeader()->tick_high;
- clog << setfill('0') << setw(8) << uppercase << hex << getSpecializedSciMsgHeader()->tick_low << endl;
+ clog << logger(LOG_INFO) << "\tid = 0x" << setfill('0') << setw(4) << uppercase << hex << getSpecializedSciMsgHeader()->id << endl;
+ clog << logger(LOG_INFO) << "\tflags = 0x" << setfill('0') << setw(4) << uppercase << hex << getSpecializedSciMsgHeader()->flags << endl;
+ clog << logger(LOG_INFO) << "\treserved = 0x" << setfill('0') << setw(4) << uppercase << hex << getSpecializedSciMsgHeader()->reserved << endl;
+ clog << logger(LOG_INFO) << "\ttick = 0x" << setfill('0') << setw(8) << uppercase << hex << getSpecializedSciMsgHeader()->tick_high \
+ << setfill('0') << setw(8) << uppercase << hex << getSpecializedSciMsgHeader()->tick_low << dec << endl;
}
@@ -263,28 +265,30 @@ void ClockSciMsg::displaySpecializedSciMsgHeader( ) const
void ClockSciMsg::displaySpecializedSciMsgType ( ) const
{
- switch (getSpecializedSciMsgType())
+ logFunction();
+
+ switch (getSpecializedSciMsgHeader()->type)
{
case 0:
- clog << "NETWORK_CLOCK_TYPE_NONE";
+ clog << logger(LOG_INFO) << "\ttype = NETWORK_CLOCK_TYPE_NONE" << endl;
break;
case 1:
- clog << "NETWORK_CLOCK_TYPE_REMOVE";
+ clog << logger(LOG_INFO) << "\ttype = NETWORK_CLOCK_TYPE_REMOVE" << endl;
break;
case 2:
- clog << "NETWORK_CLOCK_TYPE_STATION";
+ clog << logger(LOG_INFO) << "\ttype = NETWORK_CLOCK_TYPE_STATION" << endl;
break;
case 3:
- clog << "NETWORK_CLOCK_TYPE_FUNCTION_CALL";
+ clog << logger(LOG_INFO) << "\ttype = NETWORK_CLOCK_TYPE_FUNCTION_CALL" << endl;
break;
case 4:
- clog << "NETWORK_CLOCK_TYPE_PHY";
+ clog << logger(LOG_INFO) << "\ttype = NETWORK_CLOCK_TYPE_PHY" << endl;
break;
case 5:
- clog << "NETWORK_CLOCK_TYPE_SYSTEM";
+ clog << logger(LOG_INFO) << "\ttype = NETWORK_CLOCK_TYPE_SYSTEM" << endl;
break;
default:
- clog << "unknown";
+ clog << logger(LOG_WARNING) << "\ttype = unknown!" << endl;
break;
}
}
@@ -314,15 +318,9 @@ Network_Clock_Type ClockSciMsg::getSpecializedSciMsgType ( ) const
bool ClockSciMsg::setSpecializedSciMsgType ( const Network_Clock_Type type )
{
- clog << "ClockSciMsg::setSpecializedSciMsgType" << endl;
- bool bSetType = true;
-
mSpecializedSciMsgType = type;
- //clog << "\tspecialized SCI msg type = ";
- //displaySpecializedSciMsgType();
- //clog << endl;
- return bSetType;
+ return true;
}
@@ -334,13 +332,9 @@ Network_Clock_Id ClockSciMsg::getSpecializedSciMsgId ( ) const
bool ClockSciMsg::setSpecializedSciMsgId ( const Network_Clock_Id id )
{
- //clog << "ClockSciMsg::setSpecializedSciMsgId" << endl;
- bool bSetId = true;
-
mSpecializedSciMsgId = id;
- //clog << "\tspecialized SCI msg id = " << dec << getSpecializedSciMsgId() << endl;
- return bSetId;
+ return true;
}
@@ -352,13 +346,9 @@ Network_Clock_Tick ClockSciMsg::getSpecializedSciMsgTick ( ) const
bool ClockSciMsg::setSpecializedSciMsgTick ( const Network_Clock_Tick tick )
{
- //clog << "ClockSciMsg::setSpecializedSciMsgTick" << endl;
- bool bSetTick = true;
-
mSpecializedSciMsgTick = tick;
- //clog << "\tspecialized SCI msg tick = " << getSpecializedSciMsgTick() << endl;
- return bSetTick;
+ return true;
}
@@ -376,7 +366,7 @@ Network_Clock_Header * ClockSciMsg::getSpecializedSciMsgHeader ( ) const
bool ClockSciMsg::setSpecializedSciMsgHeader ( const Network_Clock_Header * p_specialized_sci_msg_header )
{
- //clog << "ClockSciMsg::setSpecializedSciMsgHeader" << endl;
+ logFunction();
bool bSetHeader = false;
if ( (NULL != p_specialized_sci_msg_header) && (NULL != mpSpecializedSciMsgHeader) )
@@ -397,7 +387,7 @@ bool ClockSciMsg::setSpecializedSciMsgHeader ( const Network_Clock_Header * p_sp
}
else
{
- throw Error("ClockSciMsg::setSpecializedSciMsgHeader", "Received and/or initialized network clock header pointer is NULL");
+ throw Error(__PRETTY_FUNCTION__, "Network clock header pointer is NULL");
}
return bSetHeader;
diff --git a/maximus/networkclock/src/NetworkClockEvt.cpp b/maximus/networkclock/src/NetworkClockEvt.cpp
index 1acc9c37f2..4204c0fd0b 100644
--- a/maximus/networkclock/src/NetworkClockEvt.cpp
+++ b/maximus/networkclock/src/NetworkClockEvt.cpp
@@ -29,11 +29,14 @@ The original location of this file is /home/buret/eclipse/maximus/networkclock/s
**************************************************************************/
#include "NetworkClockEvt.h"
+
#include "Station.h"
+
#include "Error.h"
+#include "Logger.h"
-#include <cstring> // for 'strcpy' and 'strcmp'
-#include <iomanip> // for 'std::setfill' and 'std::setw'
+#include <cstring> // for 'strcpy()' and 'strcmp()'
+#include <iomanip> // for 'setfill()' and 'setw()'
#include <iostream> // for 'cout', 'clog' and 'cerr'
using namespace std;
@@ -47,7 +50,7 @@ mStationId(0),
mNetworkClockType(NETWORK_CLOCK_TYPE_NONE),
mNetworkClockId(0)
{
- //clog << "NetworkClockEvt()" << endl;
+ logFunction();
initAttributes();
}
@@ -56,7 +59,7 @@ NetworkClockEvt::NetworkClockEvt ( const Sci_Msg_Station_Id station_id,
const Network_Clock_Type type,
const Network_Clock_Id id )
{
- //clog << "NetworkClockEvt(...)" << endl;
+ logFunction();
setStationId (station_id);
setNetworkClockType (type);
@@ -68,7 +71,7 @@ NetworkClockEvt::NetworkClockEvt ( const Sci_Msg_Station_Id station_id,
NetworkClockEvt::NetworkClockEvt ( const NetworkClockEvt & evt )
{
- //clog << "NetworkClockEvt(NetworkClockEvt&)" << endl;
+ logFunction();
setStationId (evt.getStationId());
setNetworkClockType (evt.getNetworkClockType());
@@ -77,39 +80,19 @@ NetworkClockEvt::NetworkClockEvt ( const NetworkClockEvt & evt )
initAttributes();
}
-/*
-NetworkClockEvt::NetworkClockEvt ( const NetworkClockEvt * evt )
-{
- //clog << "NetworkClockEvt(NetworkClockEvt*)" << endl;
-
- if (NULL != evt)
- {
- setStationId (evt->getStationId());
- setNetworkClockType (evt->getNetworkClockType());
- setNetworkClockId (evt->getNetworkClockId());
- }
- else
- {
- throw Error("NetworkClockEvt(NetworkClockEvt*)", "Received event pointer is NULL");
- }
-
- initAttributes();
-}
-*/
void NetworkClockEvt::initAttributes ( )
{
- //clog << "NetworkClockEvt::initAttributes" << endl;
+ logFunction();
}
NetworkClockEvt::~NetworkClockEvt ( )
{
- //clog << "~NetworkClockEvt" << endl;
+ logFunction();
- //clog << "\tdelete event ";
- //displayEvt();
- //clog << endl;
+ clog << logger(LOG_INFO) << "delete event: " << endl;
+ displayEvt();
}
@@ -128,6 +111,7 @@ NetworkClockEvt::~NetworkClockEvt ( )
bool NetworkClockEvt::operator== ( const NetworkClockEvt & evt ) const
{
+ logFunction();
bool bOperator = false;
if ( (getStationId() == evt.getStationId())
@@ -143,6 +127,8 @@ bool NetworkClockEvt::operator== ( const NetworkClockEvt & evt ) const
NetworkClockEvt & NetworkClockEvt::operator= ( const NetworkClockEvt & evt )
{
+ logFunction();
+
setStationId (evt.getStationId());
setNetworkClockId (evt.getNetworkClockId());
setNetworkClockType (evt.getNetworkClockType());
@@ -153,9 +139,10 @@ NetworkClockEvt & NetworkClockEvt::operator= ( const NetworkClockEvt & evt )
void NetworkClockEvt::displayEvt ( ) const
{
- clog << "[station id = 0x" << setfill('0') << setw(4) << uppercase << hex << getStationId() << ", ";
- displayNetworkClockType();
- clog << ", network clock id = 0x" << setfill('0') << setw(4) << uppercase << hex << getNetworkClockId() << "]";
+ logFunction();
+
+ clog << logger(LOG_INFO) << "\t[station id = 0x" << setfill('0') << setw(4) << uppercase << hex << getStationId() \
+ << ", type = " << getType() << ", network clock id = 0x" << setfill('0') << setw(4) << uppercase << hex << getNetworkClockId() << "]" << dec << endl;
}
@@ -163,32 +150,37 @@ void NetworkClockEvt::displayEvt ( ) const
//
-void NetworkClockEvt::displayNetworkClockType ( ) const
+string NetworkClockEvt::getType ( ) const
{
+ logFunction();
+ string type;
+
switch (getNetworkClockType())
{
case 0:
- clog << "NETWORK_CLOCK_TYPE_NONE";
+ type.assign("NETWORK_CLOCK_TYPE_NONE");
break;
case 1:
- clog << "NETWORK_CLOCK_TYPE_REMOVE";
+ type.assign("NETWORK_CLOCK_TYPE_REMOVE");
break;
case 2:
- clog << "NETWORK_CLOCK_TYPE_STATION";
+ type.assign("NETWORK_CLOCK_TYPE_STATION");
break;
case 3:
- clog << "NETWORK_CLOCK_TYPE_FUNCTION_CALL";
+ type.assign("NETWORK_CLOCK_TYPE_FUNCTION_CALL");
break;
case 4:
- clog << "NETWORK_CLOCK_TYPE_PHY";
+ type.assign("NETWORK_CLOCK_TYPE_PHY");
break;
case 5:
- clog << "NETWORK_CLOCK_TYPE_SYSTEM";
+ type.assign("NETWORK_CLOCK_TYPE_SYSTEM");
break;
default:
- clog << "unknown";
+ type.assign("unknown");
break;
}
+
+ return type;
}
@@ -210,10 +202,7 @@ void NetworkClockEvt::displayNetworkClockType ( ) const
bool NetworkClockEvt::setStationId ( const Sci_Msg_Station_Id station_id )
{
- //clog << "NetworkClockEvt::setStationId" << endl;
-
mStationId = station_id;
- //clog << "\tstation id = 0x" << setfill('0') << setw(4) << uppercase << hex << getStationId() << endl;
return true;
}
@@ -227,12 +216,7 @@ Sci_Msg_Station_Id NetworkClockEvt::getStationId ( ) const
bool NetworkClockEvt::setNetworkClockType ( const Network_Clock_Type type )
{
- //clog << "NetworkClockEvt::setNetworkClockType" << endl;
-
mNetworkClockType = type;
- //clog << "\tnetwork clock type = ";
- //displayNetworkClockType();
- //clog << endl;
return true;
}
@@ -246,10 +230,7 @@ Network_Clock_Type NetworkClockEvt::getNetworkClockType ( ) const
bool NetworkClockEvt::setNetworkClockId ( const Network_Clock_Id id )
{
- //clog << "NetworkClockEvt::setNetworkClockId" << endl;
-
mNetworkClockId = id;
- //clog << "\tnetwork clock id = 0x" << setfill('0') << setw(4) << uppercase << hex << getNetworkClockId() << endl;
return true;
}
diff --git a/maximus/networkclock/src/NetworkClockEvtList.cpp b/maximus/networkclock/src/NetworkClockEvtList.cpp
index 352b244d85..79eea70a9d 100644
--- a/maximus/networkclock/src/NetworkClockEvtList.cpp
+++ b/maximus/networkclock/src/NetworkClockEvtList.cpp
@@ -93,7 +93,7 @@ bool NetworkClockEvtList::insertElement ( const Network_Clock_Tick tick_value, c
// 2. Insert the event at the required tick
//
- mListOfEvts.insert(Multimap::value_type(tick_value, evt_to_insert)); // return Multimap::iterator
+ mListOfEvts.insert(EvtsList::value_type(tick_value, evt_to_insert)); // return EvtsList::iterator
displayListOfEvts (tick_value);
bInsert = true;
@@ -107,13 +107,12 @@ bool NetworkClockEvtList::removeElement ( const NetworkClockEvt & evt_to_remove
logFunction();
bool bRemove = false;
- for (Multimap::iterator it = mListOfEvts.begin(); it != mListOfEvts.end(); ++it)
+ for (EvtsList::iterator it = mListOfEvts.begin(); it != mListOfEvts.end(); ++it)
{
if ( !bRemove && (evt_to_remove == it->second) )
{
- clog << logger(LOG_INFO) << "remove element ";
+ clog << logger(LOG_INFO) << "remove element at tick " << it->first << ": " << endl;
it->second.displayEvt();
- clog << " at tick " << it->first << endl;
mListOfEvts.erase(it);
bRemove = true;
}
@@ -129,15 +128,14 @@ bool NetworkClockEvtList::removeElement ( const Network_Clock_Tick tick_value, c
logFunction();
bool bRemove = false;
- pair<Multimap::iterator, Multimap::iterator> evtsToRemove = mListOfEvts.equal_range(tick_value);
+ pair<EvtsList::iterator, EvtsList::iterator> evtsToRemove = mListOfEvts.equal_range(tick_value);
- for (Multimap::iterator it = evtsToRemove.first; it != evtsToRemove.second; ++it)
+ for (EvtsList::iterator it = evtsToRemove.first; it != evtsToRemove.second; ++it)
{
if ( !bRemove && (evt_to_remove == it->second) )
{
- clog << logger(LOG_INFO) << "remove element ";
+ clog << logger(LOG_INFO) << "remove element at tick " << tick_value << ": " << endl;
it->second.displayEvt();
- clog << " at tick " << tick_value << endl;
mListOfEvts.erase(it);
bRemove = true;
}
@@ -158,9 +156,10 @@ bool NetworkClockEvtList::addElement ( const NetworkClockEvt & evt_to_add )
//
bool NetworkClockEvtList::getNextElement ( Network_Clock_Tick & tick_value, NetworkClockEvt & next_evt_to_process )
{
+ logFunction();
static Network_Clock_Tick currentTickValue = -1;
- static Multimap::const_iterator evtIterator;
- static pair<Multimap::const_iterator, Multimap::const_iterator> evtsToProcess;
+ static EvtsList::const_iterator evtIterator;
+ static pair<EvtsList::const_iterator, EvtsList::const_iterator> evtsToProcess;
bool bGet = false;
@@ -206,22 +205,19 @@ bool NetworkClockEvtList::getNextElement ( Network_Clock_Tick & tick_value, Netw
void NetworkClockEvtList::displayListOfEvts ( ) const
{
logFunction();
- clog << logger(LOG_INFO) << "list of events = ";
+ clog << logger(LOG_INFO) << "list of events = " << endl;
if (!mListOfEvts.empty())
{
- clog << endl;
- for (Multimap::const_iterator it = mListOfEvts.begin(); it != mListOfEvts.end(); ++it)
+ for (EvtsList::const_iterator it = mListOfEvts.begin(); it != mListOfEvts.end(); ++it)
{
- clog << "\t[" << it->first << ", ";
- const NetworkClockEvt evt = it->second;
- evt.displayEvt();
- clog << "]" << endl;
+ clog << logger(LOG_INFO) << "\tat tick " << it->first << ": " << endl;
+ const_cast<NetworkClockEvt&>(it->second).displayEvt();
}
}
else
{
- clog << "empty!" << endl;
+ clog << logger(LOG_INFO) << "\tempty!" << endl;
}
}
@@ -238,7 +234,7 @@ bool NetworkClockEvtList::removePreviousElements ( const Network_Clock_Tick tick
if (!mListOfEvts.empty())
{
mListOfEvts.erase(tick_value);
- Multimap::size_type numberOfEvts = mListOfEvts.erase(tick_value);
+ EvtsList::size_type numberOfEvts = mListOfEvts.erase(tick_value);
clog << logger(LOG_INFO) << "remove " << numberOfEvts << " element(s)" << endl;
displayListOfEvts();
@@ -288,7 +284,7 @@ void NetworkClockEvtList::displayListOfEvts ( const Network_Clock_Tick tick_valu
//
-bool NetworkClockEvtList::setListOfEvts ( Multimap & list_of_evts )
+bool NetworkClockEvtList::setListOfEvts ( EvtsList & list_of_evts )
{
logFunction();
@@ -299,7 +295,7 @@ bool NetworkClockEvtList::setListOfEvts ( Multimap & list_of_evts )
}
-Multimap & NetworkClockEvtList::getListOfEvts ( )
+EvtsList & NetworkClockEvtList::getListOfEvts ( )
{
return mListOfEvts;
}
diff --git a/maximus/networkclock/src/NetworkClockEvtListTest.cpp b/maximus/networkclock/src/NetworkClockEvtListTest.cpp
index 2b64a4d409..950b013000 100644
--- a/maximus/networkclock/src/NetworkClockEvtListTest.cpp
+++ b/maximus/networkclock/src/NetworkClockEvtListTest.cpp
@@ -1,6 +1,12 @@
#include "NetworkClockEvtListTest.h"
+
#include "NetworkClockEvt.h"
+#include "NetworkClockEvtList.h"
+
+#include "networkclock_types.h"
+
+#include "Logger.h"
#include <string>
#include <iostream>
@@ -11,20 +17,18 @@ CPPUNIT_TEST_SUITE_REGISTRATION (NetworkClockEvtListTest);
void NetworkClockEvtListTest::setUp (void)
{
- clog << "NetworkClockEvtListTest::setUp" << endl;
+ logTest();
- clog << "\tNetworkClockEvtListTest -> NetworkClockEvtList()" << endl;
mpNetworkClockEvtList = new NetworkClockEvtList ();
}
void NetworkClockEvtListTest::tearDown (void)
{
- clog << "NetworkClockEvtListTest::tearDown" << endl;
+ logTest();
if (NULL != mpNetworkClockEvtList)
{
- clog << "\tNetworkClockEvtListTest -> ~NetworkClockEvtList" << endl;
delete (mpNetworkClockEvtList);
mpNetworkClockEvtList = NULL;
}
@@ -33,42 +37,31 @@ void NetworkClockEvtListTest::tearDown (void)
void NetworkClockEvtListTest::insertElementTest (void)
{
- clog << endl;
- clog << "-------------------------------------------------------------------------------------" << endl;
- clog << "*** UNITARY TEST OF NetworkClockEvtList::insertElement ***" << endl;
+ logTest();
- clog << "\tNetworkClockEvtListTest -> NetworkClockEvt()" << endl;
NetworkClockEvt evt;
- clog << "\tNetworkClockEvtListTest -> NetworkClockEvtList::setId" << endl;
CPPUNIT_ASSERT_MESSAGE ( "setNetworkClockId failed",
evt.setNetworkClockId(123) );
- clog << "\tNetworkClockEvtListTest -> NetworkClockEvtList::insertElement" << endl;
CPPUNIT_ASSERT_MESSAGE ( "insertElement failed",
mpNetworkClockEvtList->insertElement (1, evt) );
mpNetworkClockEvtList->displayListOfEvts();
-
- clog << "-------------------------------------------------------------------------------------" << endl;
- clog << endl;
}
void NetworkClockEvtListTest::removeElementTest (void)
{
- clog << endl;
- clog << "-------------------------------------------------------------------------------------" << endl;
- clog << "*** UNITARY TEST OF NetworkClockEvtList::removeElement ***" << endl;
+ logTest();
// Insert Event 1
//
- clog << "\tNetworkClockEvtListTest -> NetworkClockEvt()" << endl;
NetworkClockEvt evt1;
- clog << "\tNetworkClockEvtListTest -> NetworkClockEvtList::setId" << endl;
+
CPPUNIT_ASSERT_MESSAGE ( "setNetworkClockId failed",
evt1.setNetworkClockId(1) );
- clog << "\tNetworkClockEvtListTest -> NetworkClockEvtList::insertElement" << endl;
+
CPPUNIT_ASSERT_MESSAGE ( "insertElement failed",
mpNetworkClockEvtList->insertElement (2, evt1) );
@@ -131,30 +124,22 @@ void NetworkClockEvtListTest::removeElementTest (void)
NetworkClockEvt evt7bis (evt7);
mpNetworkClockEvtList->insertElement (7, evt7bis);
- clog << "\tNetworkClockEvtListTest -> NetworkClockEvtList::removeElement" << endl;
CPPUNIT_ASSERT_MESSAGE ( "removeElement failed",
mpNetworkClockEvtList->removeElement (2, evt1) );
mpNetworkClockEvtList->displayListOfEvts();
-
- clog << "-------------------------------------------------------------------------------------" << endl;
- clog << endl;
}
void NetworkClockEvtListTest::getNextElementTest (void)
{
- clog << endl;
- clog << "-------------------------------------------------------------------------------------" << endl;
- clog << "*** UNITARY TEST OF NetworkClockEvtList::getNextElement ***" << endl;
+ logTest();
// Insert Event 1
//
- clog << "\tNetworkClockEvtListTest -> NetworkClockEvt()" << endl;
NetworkClockEvt evt1;
- clog << "\tNetworkClockEvtListTest -> NetworkClockEvtList::setName" << endl;
evt1.setNetworkClockId(1);
- clog << "\tNetworkClockEvtListTest -> NetworkClockEvtList::insertElement" << endl;
+
CPPUNIT_ASSERT_MESSAGE ( "insertElement failed",
mpNetworkClockEvtList->insertElement (0, evt1) );
@@ -178,18 +163,10 @@ void NetworkClockEvtListTest::getNextElementTest (void)
mpNetworkClockEvtList->displayListOfEvts();
- clog << "\tNetworkClockEvtListTest -> NetworkClockEvt()" << endl;
Network_Clock_Tick tickValue = 0;
NetworkClockEvt evt (0, NETWORK_CLOCK_TYPE_STATION, 0);
- clog << "\tNetworkClockEvtListTest -> NetworkClockEvtList::getNextElement" << endl;
+
CPPUNIT_ASSERT_MESSAGE ( "getNextElement failed",
mpNetworkClockEvtList->getNextElement (tickValue, evt) );
-
- clog << "\tget element is ";
- evt.displayEvt();
- clog << endl;
-
- clog << "-------------------------------------------------------------------------------------" << endl;
- clog << endl;
}
diff --git a/maximus/networkclock/src/NetworkClockEvtTest.cpp b/maximus/networkclock/src/NetworkClockEvtTest.cpp
index 160d13bb67..c3f88ba25a 100644
--- a/maximus/networkclock/src/NetworkClockEvtTest.cpp
+++ b/maximus/networkclock/src/NetworkClockEvtTest.cpp
@@ -1,7 +1,12 @@
#include "NetworkClockEvtTest.h"
+
#include "NetworkClockEvt.h"
+#include "networkclock_types.h"
+
+#include "Logger.h"
+
#include <iostream>
using namespace std;
@@ -10,20 +15,18 @@ CPPUNIT_TEST_SUITE_REGISTRATION (NetworkClockEvtTest);
void NetworkClockEvtTest::setUp (void)
{
- clog << "NetworkClockEvtTest::setUp" << endl;
+ logTest();
- clog << "\tNetworkClockEvtTest -> NetworkClockEvt()" << endl;
mpNetworkClockEvt = new NetworkClockEvt ();
}
void NetworkClockEvtTest::tearDown (void)
{
- clog << "NetworkClockEvtTest::tearDown" << endl;
+ logTest();
if (NULL != mpNetworkClockEvt)
{
- clog << "\tNetworkClockEvtTest -> ~NetworkClockEvt" << endl;
delete (mpNetworkClockEvt);
mpNetworkClockEvt = NULL;
}
@@ -32,16 +35,11 @@ void NetworkClockEvtTest::tearDown (void)
void NetworkClockEvtTest::simpleTest (void)
{
- clog << endl;
- clog << "-------------------------------------------------------------------------------------" << endl;
- clog << "NetworkClockEvtTest::simpleTest" << endl;
+ logTest();
if (NULL == mpNetworkClockEvt)
{
CPPUNIT_FAIL ( "Initialized NetworkClockEvt pointer is NULL" );
}
-
- clog << "-------------------------------------------------------------------------------------" << endl;
- clog << endl;
}
diff --git a/maximus/networkclock/src/NetworkClockProcessor.cpp b/maximus/networkclock/src/NetworkClockProcessor.cpp
index b845b18513..e08c3977d6 100644
--- a/maximus/networkclock/src/NetworkClockProcessor.cpp
+++ b/maximus/networkclock/src/NetworkClockProcessor.cpp
@@ -101,7 +101,7 @@ mpNetworkClockEvtList(NULL)
}
else
{
- throw Error(__PRETTY_FUNCTION__, "At least one of the received pointers is NULL");
+ throw Error(__PRETTY_FUNCTION__, "A pointer is NULL");
}
initAttributes ();
}
@@ -114,7 +114,7 @@ void NetworkClockProcessor::initAttributes ( )
mpNetworkClockEvtList = new NetworkClockEvtList ();
if (NULL == mpNetworkClockEvtList)
{
- throw Error(__PRETTY_FUNCTION__, "Initialized NetworkClockEvtList pointer is NULL");
+ throw Error(__PRETTY_FUNCTION__, "Network clock event list pointer is NULL");
}
}
@@ -166,7 +166,7 @@ void NetworkClockProcessor::createEvt ( const Network_Clock_Tick tick_value, con
if ( !insertEvt (tick_value, evt_to_send) )
{
- throw Error(__PRETTY_FUNCTION__, "cannot insert event");
+ clog << logger(LOG_ERROR) << "cannot insert event!" << endl;
}
}
@@ -187,7 +187,7 @@ bool NetworkClockProcessor::insertEvt ( const Network_Clock_Tick tick_value, con
}
else
{
- throw Error(__PRETTY_FUNCTION__, "NULL pointer");
+ throw Error(__PRETTY_FUNCTION__, "Network clock event list pointer is NULL");
}
return bInsert;
@@ -208,7 +208,7 @@ bool NetworkClockProcessor::removeEvt ( const Network_Clock_Tick tick_value, con
}
else
{
- throw Error(__PRETTY_FUNCTION__, "NULL pointer");
+ throw Error(__PRETTY_FUNCTION__, "Network clock event list pointer is NULL");
}
return bRemove;
@@ -240,7 +240,7 @@ bool NetworkClockProcessor::processNextEvt ( )
if (bGetNext)
{
bProcess = setCurrentTickValue(currentTickValue);
- clog << logger(LOG_INFO) << "processing evt at tick " << dec << getCurrentTickValue() << "..." << endl;
+ clog << logger(LOG_INFO) << "processing event at tick " << dec << getCurrentTickValue() << "..." << endl;
bProcess &= callMemberFunction (*this, arrayProcess[evtToProcess.getNetworkClockType()]) (evtToProcess);
}
}
@@ -248,7 +248,7 @@ bool NetworkClockProcessor::processNextEvt ( )
}
else
{
- throw Error(__PRETTY_FUNCTION__, "NULL pointer");
+ throw Error(__PRETTY_FUNCTION__, "A pointer is NULL");
}
return bProcess;
@@ -260,7 +260,7 @@ bool NetworkClockProcessor::processEvtNone ( NetworkClockEvt & evt_to_process )
logFunction();
bool bProcessNone = false;
- throw Error(__PRETTY_FUNCTION__, "Event cannot be sent because type is not set");
+ clog << logger(LOG_ERROR) << "event cannot be sent because type is not set!" << endl;
return bProcessNone;
}
@@ -271,7 +271,7 @@ bool NetworkClockProcessor::processEvtRemove ( NetworkClockEvt & evt_to_process
logFunction();
bool bProcessRemove = false;
- throw Error(__PRETTY_FUNCTION__, "Event cannot be processed because type is set to REMOVE");
+ clog << logger(LOG_ERROR) << "event cannot be sent because type is set to REMOVE!" << endl;
return bProcessRemove;
}
@@ -284,6 +284,8 @@ bool NetworkClockProcessor::processEvtStation ( NetworkClockEvt & evt_to_process
logFunction();
bool bProcessStation = false;
+ clog << logger(LOG_COM) << "sending network clock SCI message..." << endl;
+
ClockSciMsg clockSciMsgToSend;
// Decompose current tick value into two uint32_t values
@@ -302,16 +304,16 @@ bool NetworkClockProcessor::processEvtStation ( NetworkClockEvt & evt_to_process
netclockHigh,
netclockLow };
- // As specialized SCI msg header will be sent on an output pipe, 'hton' functions have to be called
- //
- clockSciMsgHeader.id = htons(clockSciMsgHeader.id);
- clockSciMsgHeader.tick_high = htonl(clockSciMsgHeader.tick_high);
- clockSciMsgHeader.tick_low = htonl(clockSciMsgHeader.tick_low);
-
// Set specialized SCI msg header
//
bProcessStation = clockSciMsgToSend.setSpecializedSciMsgHeader(&clockSciMsgHeader);
-
+
+ // As specialized SCI msg header will be sent on an output pipe, 'hton' functions have to be called
+ //
+ clockSciMsgToSend.getSpecializedSciMsgHeader()->id = htons(clockSciMsgToSend.getSpecializedSciMsgHeader()->id);
+ clockSciMsgToSend.getSpecializedSciMsgHeader()->tick_high = htonl(clockSciMsgToSend.getSpecializedSciMsgHeader()->tick_high);
+ clockSciMsgToSend.getSpecializedSciMsgHeader()->tick_low = htonl(clockSciMsgToSend.getSpecializedSciMsgHeader()->tick_low);
+
// Fill specialized SCI msg attributes:
// - header size
//
@@ -341,7 +343,7 @@ bool NetworkClockProcessor::processEvtStation ( NetworkClockEvt & evt_to_process
}
else
{
- throw Error(__PRETTY_FUNCTION__, "Event cannot be sent because it is not correctly filled in");
+ clog << logger(LOG_ERROR) << "event cannot be sent because it is not correctly filled in!" << endl;
}
return bProcessStation;
@@ -353,7 +355,7 @@ bool NetworkClockProcessor::processEvtFunctionCall ( NetworkClockEvt & evt_to_pr
logFunction();
bool bProcessFunction = false;
- throw Error(__PRETTY_FUNCTION__, "Event cannot be processed because type is set to FUNCTION_CALL");
+ clog << logger(LOG_ERROR) << "event cannot be processed because type is set to FUNCTION_CALL!" << endl;
return bProcessFunction;
}
@@ -397,7 +399,7 @@ bool NetworkClockProcessor::sendEvtMsg ( ClockSciMsg & clock_sci_msg_to_send )
}
else
{
- throw Error(__PRETTY_FUNCTION__, "NULL pointer");
+ throw Error(__PRETTY_FUNCTION__, "SCI server pointer is NULL");
}
return bSend;
diff --git a/maximus/networkclock/src/NetworkClockProcessorTest.cpp b/maximus/networkclock/src/NetworkClockProcessorTest.cpp
index 99d70464f7..c6aaaf3c9e 100644
--- a/maximus/networkclock/src/NetworkClockProcessorTest.cpp
+++ b/maximus/networkclock/src/NetworkClockProcessorTest.cpp
@@ -1,10 +1,18 @@
#include "NetworkClockProcessorTest.h"
+
#include "NetworkClockEvtList.h"
#include "NetworkClockEvt.h"
-#include "Error.h"
+#include "NetworkClockProcessor.h"
+#include "SciServer.h"
+#include "SystemManager.h"
+#include "FunctionCallManager.h"
+#include "PhyProcessor.h"
#include "Station.h"
+#include "Error.h"
+#include "Logger.h"
+
#include <iostream>
using namespace std;
@@ -13,25 +21,20 @@ CPPUNIT_TEST_SUITE_REGISTRATION (NetworkClockProcessorTest);
void NetworkClockProcessorTest::setUp (void)
{
- clog << "NetworkClockProcessorTest::setUp" << endl;
+ logTest();
try
{
- clog << "\tNetworkClockProcessorTest -> SciServer()" << endl;
mpSciServer = new SciServer();
if (NULL != mpSciServer)
{
- clog << "\tNetworkClockProcessorTest -> FunctionCallManager(SciServer)" << endl;
mpFunctionCallManager = new FunctionCallManager(mpSciServer);
- clog << "\tNetworkClockProcessorTest -> SystemManager(SciServer)" << endl;
mpSystemManager = new SystemManager(mpSciServer);
- clog << "\tNetworkClockProcessorTest -> PhyProcessor(SciServer)" << endl;
mpPhyProcessor = new PhyProcessor(mpSciServer);
if ( (NULL != mpFunctionCallManager)
&& (NULL != mpSystemManager)
&& (NULL != mpPhyProcessor) )
{
- clog << "\tNetworkClockProcessorTest -> NetworkClockProcessor(...)" << endl;
mpNetworkClockProcessor = new NetworkClockProcessor(mpSciServer, mpSystemManager, mpFunctionCallManager, mpPhyProcessor);
}
}
@@ -45,35 +48,30 @@ void NetworkClockProcessorTest::setUp (void)
void NetworkClockProcessorTest::tearDown (void)
{
- clog << "NetworkClockProcessorTest::tearDown" << endl;
+ logTest();
if (NULL != mpNetworkClockProcessor)
{
- clog << "\tNetworkClockProcessorTest -> ~NetworkClockProcessor" << endl;
delete (mpNetworkClockProcessor);
mpNetworkClockProcessor = NULL;
}
if (NULL != mpFunctionCallManager)
{
- clog << "\tNetworkClockProcessorTest -> ~FunctionCallManager" << endl;
delete (mpFunctionCallManager);
mpFunctionCallManager = NULL;
}
if (NULL != mpSystemManager)
{
- clog << "\tNetworkClockProcessorTest -> ~SystemManager" << endl;
delete (mpSystemManager);
mpSystemManager = NULL;
}
if (NULL != mpPhyProcessor)
{
- clog << "\tNetworkClockProcessorTest -> ~PhyProcessor" << endl;
delete (mpPhyProcessor);
mpPhyProcessor = NULL;
}
if (NULL != mpSciServer)
{
- clog << "\tNetworkClockProcessorTest -> ~PhyProcessor" << endl;
delete (mpSciServer);
mpSciServer = NULL;
}
@@ -82,17 +80,13 @@ void NetworkClockProcessorTest::tearDown (void)
void NetworkClockProcessorTest::createEvtTest (void)
{
- clog << endl;
- clog << "-------------------------------------------------------------------------------------" << endl;
- clog << "*** UNITARY TEST OF NetworkClockProcessor::createEvt ***" << endl;
+ logTest();
if ( NULL != mpNetworkClockProcessor )
{
try
{
- clog << "\tNetworkClockProcessorTest -> NetworkClockEvt(...)" << endl;
NetworkClockEvt evt (123, NETWORK_CLOCK_TYPE_NONE, 456);
- clog << "\tNetworkClockProcessorTest -> NetworkClockProcessor::createEvt" << endl;
mpNetworkClockProcessor->createEvt(555, evt);
}
catch ( Error &e )
@@ -104,34 +98,25 @@ void NetworkClockProcessorTest::createEvtTest (void)
{
CPPUNIT_FAIL ( "Initialized NetworkClockProcessor pointer is NULL" );
}
-
- clog << "-------------------------------------------------------------------------------------" << endl;
- clog << endl;
}
void NetworkClockProcessorTest::removeEvtTest (void)
{
- clog << endl;
- clog << "-------------------------------------------------------------------------------------" << endl;
- clog << "*** UNITARY TEST OF NetworkClockProcessor::removeEvt ***" << endl;
+ logTest();
if ( NULL != mpNetworkClockProcessor )
{
try
{
- clog << "\tNetworkClockProcessorTest -> NetworkClockEvt(...)" << endl;
NetworkClockEvt evt (789, NETWORK_CLOCK_TYPE_NONE, 1011);
- clog << "\tNetworkClockProcessorTest -> NetworkClockProcessor::removeEvt" << endl;
CPPUNIT_ASSERT_MESSAGE ( "removeEvt failed",
!mpNetworkClockProcessor->removeEvt(555, evt) );
- clog << "\tNetworkClockProcessorTest -> NetworkClockProcessor::insertEvt" << endl;
CPPUNIT_ASSERT_MESSAGE ( "insertEvt failed",
mpNetworkClockProcessor->insertEvt(555, evt) );
- clog << "\tNetworkClockProcessorTest -> NetworkClockProcessor::removeEvt" << endl;
CPPUNIT_ASSERT_MESSAGE ( "removeEvt failed",
mpNetworkClockProcessor->removeEvt(555, evt) );
}
@@ -144,17 +129,12 @@ void NetworkClockProcessorTest::removeEvtTest (void)
{
CPPUNIT_FAIL ( "Initialized NetworkClockProcessor pointer is NULL" );
}
-
- clog << "-------------------------------------------------------------------------------------" << endl;
- clog << endl;
}
void NetworkClockProcessorTest::processNextEvtTest (void)
{
- clog << endl;
- clog << "-------------------------------------------------------------------------------------" << endl;
- clog << "*** UNITARY TEST OF NetworkClockProcessor::processNextEvt ***" << endl;
+ logTest();
if ( NULL != mpNetworkClockProcessor )
{
@@ -162,38 +142,32 @@ void NetworkClockProcessorTest::processNextEvtTest (void)
{
Sci_Msg_Station_Id stationId = 0;
stationId = mpSystemManager->createStation();
-
- clog << "\tNetworkClockProcessorTest -> NetworkClockEvt(...)" << endl;
NetworkClockEvt evt (stationId, NETWORK_CLOCK_TYPE_STATION, 0);
- clog << "\tNetworkClockProcessorTest -> NetworkClockProcessor::insertEvt" << endl;
CPPUNIT_ASSERT_MESSAGE ( "insertEvt failed",
mpNetworkClockProcessor->insertEvt(0, evt) );
mpSystemManager->updateStationStatus(stationId, MAXIMUS_STATION_STATUS_IDLE);
- clog << "\tNetworkClockProcessorTest -> NetworkClockProcessor::processNextEvt" << endl;
+
CPPUNIT_ASSERT_MESSAGE ( "processNextEvt failed",
mpNetworkClockProcessor->processNextEvt() );
- clog << "\tNetworkClockProcessorTest -> NetworkClockProcessor::insertEvt" << endl;
CPPUNIT_ASSERT_MESSAGE ( "insertEvt failed",
mpNetworkClockProcessor->insertEvt(1, evt) );
mpSystemManager->updateStationStatus(stationId, MAXIMUS_STATION_STATUS_IDLE);
- clog << "\tNetworkClockProcessorTest -> NetworkClockProcessor::processNextEvt" << endl;
+
CPPUNIT_ASSERT_MESSAGE ( "processNextEvt failed",
mpNetworkClockProcessor->processNextEvt() );
- clog << "\tNetworkClockProcessorTest -> NetworkClockEvt(...)" << endl;
NetworkClockEvt evtToProcess (stationId, NETWORK_CLOCK_TYPE_STATION, 0);
- clog << "\tNetworkClockProcessorTest -> NetworkClockProcessor::insertEvt" << endl;
CPPUNIT_ASSERT_MESSAGE ( "insertEvt failed",
mpNetworkClockProcessor->insertEvt(4, evtToProcess) );
mpNetworkClockProcessor->getNetworkClockEvtList()->displayListOfEvts();
mpSystemManager->updateStationStatus(stationId, MAXIMUS_STATION_STATUS_IDLE);
- clog << "\tNetworkClockProcessorTest -> NetworkClockProcessor::processNextEvt" << endl;
+
CPPUNIT_ASSERT_MESSAGE ( "processNextEvt failed",
mpNetworkClockProcessor->processNextEvt() );
}
@@ -206,17 +180,12 @@ void NetworkClockProcessorTest::processNextEvtTest (void)
{
CPPUNIT_FAIL ( "Initialized NetworkClockProcessor pointer is NULL" );
}
-
- clog << "-------------------------------------------------------------------------------------" << endl;
- clog << endl;
}
void NetworkClockProcessorTest::processEvtStationTest (void)
{
- clog << endl;
- clog << "-------------------------------------------------------------------------------------" << endl;
- clog << "*** UNITARY TEST OF NetworkClockProcessor::processEvtStation ***" << endl;
+ logTest();
if ( NULL != mpNetworkClockProcessor )
{
@@ -224,13 +193,10 @@ void NetworkClockProcessorTest::processEvtStationTest (void)
{
// Create a station
//
- clog << "\tNetworkClockProcessorTest -> SystemManager::createStation" << endl;
Sci_Msg_Station_Id stationId = mpSystemManager->createStation();
- clog << "\tNetworkClockProcessorTest -> NetworkClockEvt(...)" << endl;
NetworkClockEvt evt (stationId, NETWORK_CLOCK_TYPE_STATION, 2324);
- clog << "\tNetworkClockProcessorTest -> SystemManager::updateStationStatus" << endl;
mpSystemManager->updateStationStatus ( stationId, MAXIMUS_STATION_STATUS_IDLE );
- clog << "\tNetworkClockProcessorTest -> NetworkClockProcessor::processEvtStation" << endl;
+
CPPUNIT_ASSERT_MESSAGE ( "processEvtStation failed",
mpNetworkClockProcessor->processEvtStation(evt) );
}
@@ -243,8 +209,5 @@ void NetworkClockProcessorTest::processEvtStationTest (void)
{
CPPUNIT_FAIL ( "Initialized NetworkClockProcessor pointer is NULL" );
}
-
- clog << "-------------------------------------------------------------------------------------" << endl;
- clog << endl;
}