CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/EventFilter/ResourceBroker/src/BaseState.cc

Go to the documentation of this file.
00001 
00002 //
00003 // BaseState
00004 // -------
00005 //
00006 // Superclass of all FSM states.
00007 //
00008 //            20/01/2012 Andrei Spataru <aspataru@cern.ch>
00010 
00011 #include "EventFilter/ResourceBroker/interface/RBStateMachine.h"
00012 #include "EventFilter/ResourceBroker/interface/SharedResources.h"
00013 #include "EventFilter/Utilities/interface/Exception.h"
00014 
00015 #include <boost/statechart/event_base.hpp>
00016 
00017 #include <iostream>
00018 
00019 using std::string;
00020 using std::cout;
00021 using std::endl;
00022 using namespace boost::statechart;
00023 using namespace evf::rb_statemachine;
00024 
00025 BaseState::BaseState() {
00026 }
00027 
00028 BaseState::~BaseState() {
00029 }
00030 
00031 string BaseState::stateName() const {
00032         return do_stateName();
00033 }
00034 
00035 void BaseState::moveToFailedState(xcept::Exception& exception) const {
00036         do_moveToFailedState(exception);
00037 }
00038 
00040 // Default implementation for entry / exit action virtual functions.
00042 
00043 void BaseState::safeEntryAction() {
00044         string errmsg = "Error going into requested state!";
00045         try {
00046                 do_entryActionWork();
00047         } catch (xcept::Exception& e) {
00048                 XCEPT_RETHROW(evf::Exception, errmsg, e);
00049         }
00050 }
00051 
00052 void BaseState::safeExitAction() {
00053         string errmsg = "Error leaving current state!";
00054         try {
00055                 do_exitActionWork();
00056         } catch (xcept::Exception& e) {
00057                 XCEPT_RETHROW(evf::Exception, errmsg, e);
00058         }
00059 }