CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

stor::StateMachineMonitorCollection Class Reference

#include <StateMachineMonitorCollection.h>

Inheritance diagram for stor::StateMachineMonitorCollection:
stor::MonitorCollection

List of all members.

Public Types

typedef std::vector
< TransitionRecord
History

Public Member Functions

void clearStatusMessage ()
void dumpHistory (std::ostream &) const
const std::string & externallyVisibleState () const
void getHistory (History &) const
std::string innerStateName () const
void setExternallyVisibleState (const std::string &)
void setStatusMessage (const std::string &)
 StateMachineMonitorCollection (const utils::Duration_t &updateInterval)
bool statusMessage (std::string &msg) const
void updateHistory (const TransitionRecord &)

Private Member Functions

virtual void do_appendInfoSpaceItems (InfoSpaceItems &)
virtual void do_calculateStatistics ()
virtual void do_reset ()
virtual void do_updateInfoSpaceItems ()
StateMachineMonitorCollectionoperator= (StateMachineMonitorCollection const &)
 StateMachineMonitorCollection (StateMachineMonitorCollection const &)

Private Attributes

std::string externallyVisibleState_
History history_
boost::mutex stateMutex_
xdata::String stateName_
std::string statusMessage_

Detailed Description

A collection of monitored quantities related to the state machine

Author:
mommsen
Revision:
1.8
Date:
2011/03/07 15:31:32

Definition at line 26 of file StateMachineMonitorCollection.h.


Member Typedef Documentation

Copy the state machine history in the given History vector

Definition at line 41 of file StateMachineMonitorCollection.h.


Constructor & Destructor Documentation

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]

Member Function Documentation

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_.

  {
    boost::mutex::scoped_lock sl( stateMutex_ );
    
    os << "**** Begin transition history ****" << std::endl;
    
    for( History::const_iterator j = history_.begin();
         j != history_.end(); ++j )
    {
      os << "  " << *j << std::endl;
    }
    
    os << "**** End transition history ****" << std::endl;
    
  }
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 );
  }

Member Data Documentation

Definition at line 96 of file StateMachineMonitorCollection.h.

Referenced by do_updateInfoSpaceItems().