Changeset 11063


Ignore:
Timestamp:
06/18/11 18:12:11 (13 years ago)
Author:
tbretz
Message:
INtroduced a new class DimLog which ensures that the MessageDimTX is initialized _before_ the DimErrorRedirecter, otherwise a very early error could be emitted to the MessageDimTX even before it was instantiated.
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/StateMachineDim.cc

    r10873 r11063  
    11// **************************************************************************
    22/** @class StateMachineDim
    3 
    4 @brief Class for a state machine implementation within a DIM network
    53
    64This class implements a StateMachine within a Dim network. It redirects
     
    6765//
    6866StateMachineDim::StateMachineDim(ostream &out, const std::string &name)
    69     : StateMachine(out, name), DimStart(name, *this), fLog(name, out),
     67    : StateMachine(out, name), DimLog(out, name), DimStart(name, DimLog::fLog),
    7068    fDescriptionStates((name+"/STATE_LIST").c_str(), const_cast<char*>(""),
    7169                       "Provides a list with descriptions for each service."
     
    178176int StateMachineDim::Write(const Time &time, const string &txt, int qos)
    179177{
    180     return fLog.Write(time, txt, qos);
     178    return DimLog::fLog.Write(time, txt, qos);
    181179}
    182180
     
    193191void StateMachineDim::exitHandler(int code)
    194192{
    195     Out() << " -- " << Time().GetAsStr() << ": EXIT(" << code << ") command received." << endl;
     193    Out() << " -- " << Time().GetAsStr() << " - EXIT(" << code << ") command received." << endl;
    196194    if (code<0) // negative values reserved for internal use
    197195    {
  • trunk/FACT++/src/StateMachineDim.h

    r10510 r11063  
    22#define FACT_StateMachineDim
    33
     4// ***************************************************************************
     5/**
     6 @class DimLog
     7
     8 @brief Ensures that the MessageDimTX is initialized before errors could be redirected to it
     9
     10**/
     11// ***************************************************************************
    412#include "MessageDim.h"       // MessageDimTX
    5 #include "StateMachine.h"     // StateMachien
     13
     14class DimLog
     15{
     16    friend class StateMachineDim;
     17
     18    MessageDimTX fLog;
     19    DimLog(std::ostream &out, const std::string &name) : fLog(name, out) { }
     20};
    621
    722// ***************************************************************************
     
    2843};
    2944
    30 class StateMachineDim : public DimCommandHandler, public StateMachine, public DimStart
     45// ***************************************************************************
     46/**
     47 @class StateMachineDim
     48
     49 @brief Class for a state machine implementation within a DIM network
     50
     51**/
     52// ***************************************************************************
     53#include "StateMachine.h"     // StateMachien
     54
     55class StateMachineDim : public DimCommandHandler, public StateMachine, public DimLog, public DimStart
    3156{
    3257private:
    33     MessageDimTX fLog;           /// Logging to the Dim network
    34 
    3558    static const int fVersion;   /// Version number
    3659
Note: See TracChangeset for help on using the changeset viewer.