CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StateMachineMonitorCollection.cc
Go to the documentation of this file.
1 // $Id: StateMachineMonitorCollection.cc,v 1.8.10.1 2011/03/07 11:33:05 mommsen Exp $
3 
6 
7 
8 namespace stor {
9 
11  MonitorCollection(updateInterval),
12  externallyVisibleState_( "unknown" ),
13  stateName_( "unknown" )
14  {}
15 
16 
18  {
19  boost::mutex::scoped_lock sl( stateMutex_ );
20  history_.push_back( tr );
21  }
22 
23 
25  {
26  boost::mutex::scoped_lock sl( stateMutex_ );
27  history = history_;
28  }
29 
30 
31  void StateMachineMonitorCollection::dumpHistory( std::ostream& os ) const
32  {
33  boost::mutex::scoped_lock sl( stateMutex_ );
34 
35  os << "**** Begin transition history ****" << std::endl;
36 
37  for( History::const_iterator j = history_.begin();
38  j != history_.end(); ++j )
39  {
40  os << " " << *j << std::endl;
41  }
42 
43  os << "**** End transition history ****" << std::endl;
44 
45  }
46 
47 
49  {
50  boost::mutex::scoped_lock sl( stateMutex_ );
52  }
53 
54 
56  {
57  boost::mutex::scoped_lock sl( stateMutex_ );
59  }
60 
61 
63  {
64  boost::mutex::scoped_lock sl( stateMutex_ );
65  if ( statusMessage_.empty() )
66  statusMessage_ = m;
67  }
68 
69 
71  {
72  boost::mutex::scoped_lock sl( stateMutex_ );
73  statusMessage_.clear();
74  }
75 
76 
78  {
79  boost::mutex::scoped_lock sl( stateMutex_ );
80  m = statusMessage_;
81  return ( ! statusMessage_.empty() );
82  }
83 
84 
86  {
87  boost::mutex::scoped_lock sl( stateMutex_ );
88  TransitionRecord tr = history_.back();
89  return tr.stateName();;
90  }
91 
92 
94  {
95  // nothing to do
96  }
97 
98 
100  {
101  // we shall not reset the state name
102  boost::mutex::scoped_lock sl( stateMutex_ );
103  history_.clear();
104  }
105 
106 
108  (
109  InfoSpaceItems& infoSpaceItems
110  )
111  {
112  infoSpaceItems.push_back(std::make_pair("stateName", &stateName_));
113  }
114 
115 
117  {
118  boost::mutex::scoped_lock sl( stateMutex_ );
119 
120  stateName_ = static_cast<xdata::String>( externallyVisibleState_ );
121  }
122 
123 } // namespace stor
124 
const std::string & stateName() const
StateMachineMonitorCollection(const utils::Duration_t &updateInterval)
boost::posix_time::time_duration Duration_t
Definition: Utils.h:41
virtual void do_appendInfoSpaceItems(InfoSpaceItems &)
int j
Definition: DBlmapReader.cc:9
const std::string & externallyVisibleState() const
std::vector< std::pair< std::string, xdata::Serializable * > > InfoSpaceItems