CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions
evf::rb_statemachine::Configuring Class Reference

#include <RBStateMachine.h>

Inheritance diagram for evf::rb_statemachine::Configuring:
evf::rb_statemachine::BaseState

Public Types

typedef bsc::transition
< ConfigureDone, Ready
CR
 
typedef boost::mpl::list< CRreactions
 

Public Member Functions

 Configuring (my_context)
 
virtual void do_stateAction () const
 
virtual void do_stateNotify ()
 
virtual int stateID () const
 
virtual ~Configuring ()
 
- Public Member Functions inherited from evf::rb_statemachine::BaseState
 BaseState ()
 
virtual bool discardDataEvent (MemRef_t *bufRef) const
 
virtual bool discardDqmEvent (MemRef_t *bufRef) const
 
void moveToFailedState (xcept::Exception &exception) const
 
std::string stateName () const
 
virtual ~BaseState ()=0
 

Private Member Functions

void connectToBUandSM () const throw (evf::Exception)
 
virtual void do_entryActionWork ()
 
virtual void do_exitActionWork ()
 
virtual void do_moveToFailedState (xcept::Exception &exception) const
 
virtual std::string do_stateName () const
 

Additional Inherited Members

- Protected Member Functions inherited from evf::rb_statemachine::BaseState
void fail ()
 
void safeEntryAction ()
 
void safeExitAction ()
 

Detailed Description

Configuring state

Definition at line 395 of file RBStateMachine.h.

Member Typedef Documentation

Definition at line 399 of file RBStateMachine.h.

Definition at line 400 of file RBStateMachine.h.

Constructor & Destructor Documentation

Configuring::Configuring ( my_context  c)

Definition at line 67 of file Configuring.cc.

References evf::rb_statemachine::BaseState::safeEntryAction().

67  :
68  my_base(c) {
70 }
Configuring::~Configuring ( )
virtual

Definition at line 72 of file Configuring.cc.

References evf::rb_statemachine::BaseState::safeExitAction().

72  {
74 }

Member Function Documentation

void Configuring::connectToBUandSM ( ) const
throw (evf::Exception
)
private

Connection to BuilderUnit bu_ and StorageManager sm_

Definition at line 96 of file Configuring.cc.

References lumiQueryAPI::msg.

96  {
97 
98  SharedResourcesPtr_t res = outermost_context().getSharedResources();
99  xdaq::Application* app = outermost_context().getApp();
100 
101  typedef set<xdaq::ApplicationDescriptor*> AppDescSet_t;
102  typedef AppDescSet_t::iterator AppDescIter_t;
103 
104  // locate input BU
105  AppDescSet_t
106  setOfBUs =
107  app->getApplicationContext()->getDefaultZone()-> getApplicationDescriptors(
108  res->buClassName_.toString());
109 
110  if (0 != res->bu_) {
111  delete res->bu_;
112  res->bu_ = 0;
113  }
114 
115  for (AppDescIter_t it = setOfBUs.begin(); it != setOfBUs.end(); ++it)
116 
117  if ((*it)->getInstance() == res->buInstance_)
118 
119  res->bu_ = new BUProxy(app->getApplicationDescriptor(), *it,
120  app->getApplicationContext(), res->i2oPool_);
121 
122  if (0 == res->bu_) {
123  string msg = res->sourceId_ + " failed to locate input BU!";
124  XCEPT_RAISE(evf::Exception, msg);
125  }
126 
127  // locate output SM
128  AppDescSet_t
129  setOfSMs =
130  app->getApplicationContext()->getDefaultZone()-> getApplicationDescriptors(
131  res->smClassName_.toString());
132 
133  if (0 != res->sm_) {
134  delete res->sm_;
135  res->sm_ = 0;
136  }
137 
138  for (AppDescIter_t it = setOfSMs.begin(); it != setOfSMs.end(); ++it)
139  if ((*it)->getInstance() == res->smInstance_)
140  res->sm_ = new SMProxy(app->getApplicationDescriptor(), *it,
141  app->getApplicationContext(), res->i2oPool_);
142 
143  if (0 == res->sm_)
144  LOG4CPLUS_WARN(res->log_,
145  res->sourceId_ << " failed to locate output SM!");
146 }
boost::shared_ptr< SharedResources > SharedResourcesPtr_t
void Configuring::do_entryActionWork ( )
privatevirtual

Implements evf::rb_statemachine::BaseState.

Definition at line 18 of file Configuring.cc.

18  {
19 }
void Configuring::do_exitActionWork ( )
privatevirtual

Implements evf::rb_statemachine::BaseState.

Definition at line 78 of file Configuring.cc.

78  {
79 }
void Configuring::do_moveToFailedState ( xcept::Exception &  exception) const
privatevirtual

Implements evf::rb_statemachine::BaseState.

Definition at line 85 of file Configuring.cc.

References edm::hlt::Fail, and evf::rb_statemachine::BaseState::fail().

85  {
86  SharedResourcesPtr_t res = outermost_context().getSharedResources();
87  res->reasonForFailed_ = exception.what();
88  LOG4CPLUS_FATAL(res->log_,
89  "Moving to FAILED state! Reason: " << exception.what());
90  EventPtr fail(new Fail());
91  res->commands_.enqEvent(fail);
92 }
boost::shared_ptr< SharedResources > SharedResourcesPtr_t
reject
Definition: HLTenums.h:23
boost::shared_ptr< boost::statechart::event_base > EventPtr
Definition: CommandQueue.h:23
void Configuring::do_stateAction ( ) const
virtual

State-dependent actions

Reimplemented from evf::rb_statemachine::BaseState.

Definition at line 31 of file Configuring.cc.

References alignCSCRings::e, and edm::hlt::Exception.

31  {
32  SharedResourcesPtr_t res = outermost_context().getSharedResources();
33 
34  try {
35  LOG4CPLUS_INFO(res->log_, "Start configuring ...");
36 
38 
39  res->frb_ = new EvffedFillerRB(
40  (FUResourceBroker*) outermost_context().getApp());
41  // IPC choice & init
42  res->configureResources(outermost_context().getApp());
43 
44  if (res->shmInconsistent_) {
45  std::ostringstream ost;
46  ost
47  << "configuring FAILED: Inconsistency in ResourceTable - nbRaw="
48  << res->nbRawCells_.value_ << " but nbResources="
49  << res->resourceStructure_->nbResources()
50  << " and nbFreeSlots="
51  << res->resourceStructure_->nbFreeSlots();
52  XCEPT_RAISE(evf::Exception, ost.str());
53  }
54 
55  LOG4CPLUS_INFO(res->log_, "Finished configuring!");
56 
57  EventPtr configureDone(new ConfigureDone());
58  res->commands_.enqEvent(configureDone);
59 
60  } catch (xcept::Exception &e) {
62  }
63 }
boost::shared_ptr< SharedResources > SharedResourcesPtr_t
boost::shared_ptr< boost::statechart::event_base > EventPtr
Definition: CommandQueue.h:23
void moveToFailedState(xcept::Exception &exception) const
Definition: BaseState.cc:35
string Configuring::do_stateName ( ) const
privatevirtual

Implements evf::rb_statemachine::BaseState.

Definition at line 81 of file Configuring.cc.

81  {
82  return string("Configuring");
83 }
void Configuring::do_stateNotify ( )
virtual

State entry notifications

Implements evf::rb_statemachine::BaseState.

Definition at line 21 of file Configuring.cc.

21  {
22  SharedResourcesPtr_t res = outermost_context().getSharedResources();
23  LOG4CPLUS_INFO(res->log_, "--> ResourceBroker: NEW STATE: " << stateName());
24  outermost_context().setExternallyVisibleState(stateName());
25  outermost_context().setInternalStateName(stateName());
26  // RCMS notification no longer required here
27  // this is done in FUResourceBroker in SOAP reply
28  //outermost_context().rcmsStateChangeNotify();
29 }
boost::shared_ptr< SharedResources > SharedResourcesPtr_t
std::string stateName() const
Definition: BaseState.cc:31
virtual int evf::rb_statemachine::Configuring::stateID ( ) const
inlinevirtual

Return the current state ID

Implements evf::rb_statemachine::BaseState.

Definition at line 407 of file RBStateMachine.h.

References evf::rb_statemachine::CONFIGURING.