#include <StateMachineMonitorCollection.h>
A collection of monitored quantities related to the state machine
Definition at line 26 of file StateMachineMonitorCollection.h.
typedef std::vector<TransitionRecord> stor::StateMachineMonitorCollection::History |
Copy the state machine history in the given History vector
Definition at line 41 of file StateMachineMonitorCollection.h.
stor::StateMachineMonitorCollection::StateMachineMonitorCollection | ( | const utils::Duration_t & | updateInterval | ) | [explicit] |
Definition at line 10 of file StateMachineMonitorCollection.cc.
: MonitorCollection(updateInterval), externallyVisibleState_( "unknown" ), stateName_( "unknown" ) {}
stor::StateMachineMonitorCollection::StateMachineMonitorCollection | ( | StateMachineMonitorCollection const & | ) | [private] |
void stor::StateMachineMonitorCollection::clearStatusMessage | ( | ) |
Clear status message
Definition at line 70 of file StateMachineMonitorCollection.cc.
References stateMutex_, and statusMessage_.
{ boost::mutex::scoped_lock sl( stateMutex_ ); statusMessage_.clear(); }
void stor::StateMachineMonitorCollection::do_appendInfoSpaceItems | ( | InfoSpaceItems & | infoSpaceItems | ) | [private, virtual] |
Reimplemented from stor::MonitorCollection.
Definition at line 108 of file StateMachineMonitorCollection.cc.
{ infoSpaceItems.push_back(std::make_pair("stateName", &stateName_)); }
void stor::StateMachineMonitorCollection::do_calculateStatistics | ( | ) | [private, virtual] |
Implements stor::MonitorCollection.
Definition at line 93 of file StateMachineMonitorCollection.cc.
{
// nothing to do
}
void stor::StateMachineMonitorCollection::do_reset | ( | ) | [private, virtual] |
Implements stor::MonitorCollection.
Definition at line 99 of file StateMachineMonitorCollection.cc.
References history_, and stateMutex_.
{ // we shall not reset the state name boost::mutex::scoped_lock sl( stateMutex_ ); history_.clear(); }
void stor::StateMachineMonitorCollection::do_updateInfoSpaceItems | ( | ) | [private, virtual] |
Reimplemented from stor::MonitorCollection.
Definition at line 116 of file StateMachineMonitorCollection.cc.
References externallyVisibleState_, stateMutex_, and stateName_.
{ boost::mutex::scoped_lock sl( stateMutex_ ); stateName_ = static_cast<xdata::String>( externallyVisibleState_ ); }
void stor::StateMachineMonitorCollection::dumpHistory | ( | std::ostream & | os | ) | const |
Dump the state machine history into the stream
Definition at line 31 of file StateMachineMonitorCollection.cc.
References history_, j, and stateMutex_.
const std::string & stor::StateMachineMonitorCollection::externallyVisibleState | ( | ) | const |
Retrieve the externally visible state name
Definition at line 55 of file StateMachineMonitorCollection.cc.
References externallyVisibleState_, and stateMutex_.
Referenced by stor::SMWebPageHelper::consumerStatistics(), and stor::SMWebPageHelper::createWebPageBody().
{ boost::mutex::scoped_lock sl( stateMutex_ ); return externallyVisibleState_; }
void stor::StateMachineMonitorCollection::getHistory | ( | History & | history | ) | const |
Definition at line 24 of file StateMachineMonitorCollection.cc.
References history_, and stateMutex_.
{ boost::mutex::scoped_lock sl( stateMutex_ ); history = history_; }
std::string stor::StateMachineMonitorCollection::innerStateName | ( | ) | const |
Retrieve the current internal state name
Definition at line 85 of file StateMachineMonitorCollection.cc.
References history_, stateMutex_, and stor::TransitionRecord::stateName().
Referenced by stor::SMWebPageHelper::consumerStatistics(), and stor::SMWebPageHelper::createWebPageBody().
{ boost::mutex::scoped_lock sl( stateMutex_ ); TransitionRecord tr = history_.back(); return tr.stateName();; }
StateMachineMonitorCollection& stor::StateMachineMonitorCollection::operator= | ( | StateMachineMonitorCollection const & | ) | [private] |
void stor::StateMachineMonitorCollection::setExternallyVisibleState | ( | const std::string & | n | ) |
Set the externally visible state name
Definition at line 48 of file StateMachineMonitorCollection.cc.
References externallyVisibleState_, n, and stateMutex_.
{ boost::mutex::scoped_lock sl( stateMutex_ ); externallyVisibleState_ = n; }
void stor::StateMachineMonitorCollection::setStatusMessage | ( | const std::string & | m | ) |
Set status message
Definition at line 62 of file StateMachineMonitorCollection.cc.
References stateMutex_, and statusMessage_.
{ boost::mutex::scoped_lock sl( stateMutex_ ); if ( statusMessage_.empty() ) statusMessage_ = m; }
bool stor::StateMachineMonitorCollection::statusMessage | ( | std::string & | msg | ) | const |
Get status message
Definition at line 77 of file StateMachineMonitorCollection.cc.
References stateMutex_, and statusMessage_.
Referenced by stor::SMWebPageHelper::consumerStatistics(), and stor::SMWebPageHelper::createWebPageBody().
{ boost::mutex::scoped_lock sl( stateMutex_ ); m = statusMessage_; return ( ! statusMessage_.empty() ); }
void stor::StateMachineMonitorCollection::updateHistory | ( | const TransitionRecord & | tr | ) |
Add the TransitionRecord to the state machine history
Definition at line 17 of file StateMachineMonitorCollection.cc.
References history_, and stateMutex_.
{ boost::mutex::scoped_lock sl( stateMutex_ ); history_.push_back( tr ); }
std::string stor::StateMachineMonitorCollection::externallyVisibleState_ [private] |
Definition at line 91 of file StateMachineMonitorCollection.h.
Referenced by do_updateInfoSpaceItems(), externallyVisibleState(), and setExternallyVisibleState().
Definition at line 90 of file StateMachineMonitorCollection.h.
Referenced by do_reset(), dumpHistory(), getHistory(), innerStateName(), and updateHistory().
boost::mutex stor::StateMachineMonitorCollection::stateMutex_ [mutable, private] |
Definition at line 92 of file StateMachineMonitorCollection.h.
Referenced by clearStatusMessage(), do_reset(), do_updateInfoSpaceItems(), dumpHistory(), externallyVisibleState(), getHistory(), innerStateName(), setExternallyVisibleState(), setStatusMessage(), statusMessage(), and updateHistory().
xdata::String stor::StateMachineMonitorCollection::stateName_ [private] |
Definition at line 96 of file StateMachineMonitorCollection.h.
Referenced by do_updateInfoSpaceItems().
std::string stor::StateMachineMonitorCollection::statusMessage_ [private] |
Definition at line 94 of file StateMachineMonitorCollection.h.
Referenced by clearStatusMessage(), setStatusMessage(), and statusMessage().