CMS 3D CMS Logo

Public Member Functions | Protected Member Functions

stor::Operations Class Reference

#include <StateMachine.h>

Inheritance diagram for stor::Operations:
stor::Constructed stor::DrainingQueues stor::Enabled stor::Failed stor::FinishingDQM stor::Halted stor::Halting stor::Normal stor::Processing stor::Ready stor::Running stor::Starting stor::Stopped stor::Stopping

List of all members.

Public Member Functions

void moveToFailedState (xcept::Exception &exception) const
void noFragmentToProcess () const
 Operations ()
void processI2OFragment (I2OChain &frag) const
std::string stateName () const
virtual ~Operations ()=0

Protected Member Functions

virtual void do_entryActionWork ()=0
virtual void do_exitActionWork ()=0
virtual void do_moveToFailedState (xcept::Exception &exception) const =0
virtual void do_noFragmentToProcess () const
virtual void do_processI2OFragment (I2OChain &frag) const
virtual std::string do_stateName () const =0
void safeEntryAction ()
void safeExitAction ()

Detailed Description

Abstract base for state classes

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

Definition at line 85 of file StateMachine.h.


Constructor & Destructor Documentation

Operations::Operations ( )

Definition at line 17 of file Operations.cc.

{
  //TransitionRecord tr( stateName(), true );
  //outermost_context().updateHistory( tr );
}
Operations::~Operations ( ) [pure virtual]

Definition at line 23 of file Operations.cc.

{
  //TransitionRecord tr( stateName(), false );
  //outermost_context().updateHistory( tr );
}

Member Function Documentation

virtual void stor::Operations::do_entryActionWork ( ) [protected, pure virtual]
virtual void stor::Operations::do_exitActionWork ( ) [protected, pure virtual]
virtual void stor::Operations::do_moveToFailedState ( xcept::Exception exception) const [protected, pure virtual]
void Operations::do_noFragmentToProcess ( ) const [protected, virtual]

Reimplemented in stor::Starting, stor::Stopping, stor::Halting, stor::Processing, stor::DrainingQueues, and stor::FinishingDQM.

Definition at line 140 of file Operations.cc.

{
  //std::cout << stateName() << "::noFragmentToProcess()" << std::endl;
}
void Operations::do_processI2OFragment ( I2OChain frag) const [protected, virtual]

Reimplemented in stor::Processing.

Definition at line 55 of file Operations.cc.

{
  //std::cout << stateName() << "::processI2OFragment()" << std::endl;

  // 20-Mar-2009, KAB: if we get a fragment when we are not supposed to get
  // one, should we still send a discard message to the resource broker?
  // If we don't, couldn't that cause problems upstream?  If we do, though,
  // we could end up sending duplicate discard messages (one per fragment).
  // At a minimum, we should make sure that we don't try to use the discard
  // manager before it is available.
  // Of course, if we want to do this, we need to implement a way to get
  // a handle to the discard manager since outermost_context() doesn't
  // actually work here.
  //
  //if ( outermost_context().getSharedResources().get() != 0 &&
  //     outermost_context().getSharedResources()->discardManager_.get() != 0)
  //  {
  //    outermost_context().getSharedResources()->discardManager_->sendDiscardMessage(frag);
  //  }
}
virtual std::string stor::Operations::do_stateName ( ) const [protected, pure virtual]
void Operations::moveToFailedState ( xcept::Exception exception) const

Definition at line 44 of file Operations.cc.

void Operations::noFragmentToProcess ( ) const

Definition at line 34 of file Operations.cc.

Referenced by stor::Processing::do_processI2OFragment().

void Operations::processI2OFragment ( I2OChain frag) const

Definition at line 29 of file Operations.cc.

{
  do_processI2OFragment( frag );
}
void Operations::safeEntryAction ( ) [protected]

Definition at line 77 of file Operations.cc.

References alignCSCRings::e, exception, Exception, lumiQueryAPI::msg, and susybsm::HSCParticleType::unknown.

Referenced by stor::Constructed::Constructed(), stor::DrainingQueues::DrainingQueues(), stor::Enabled::Enabled(), stor::Failed::Failed(), stor::FinishingDQM::FinishingDQM(), stor::Halted::Halted(), stor::Halting::Halting(), stor::Normal::Normal(), stor::Processing::Processing(), stor::Ready::Ready(), stor::Running::Running(), stor::Starting::Starting(), stor::Stopped::Stopped(), and stor::Stopping::Stopping().

{
  const std::string unknown = "unknown exception";
  std::string msg = "Error going into " + stateName() + " state: ";
  try
  {
    do_entryActionWork();
  }
  catch( xcept::Exception& e )
  {
    XCEPT_DECLARE_NESTED( stor::exception::StateTransition,
      sentinelException, msg, e );
    moveToFailedState( sentinelException );
  }
  catch( std::exception& e )
  {
    msg += e.what();
    XCEPT_DECLARE( stor::exception::StateTransition,
      sentinelException, msg );
    moveToFailedState( sentinelException );
  }
  catch(...)
  {
    msg += "unknown exception";
    XCEPT_DECLARE( stor::exception::StateTransition,
      sentinelException, msg );
    moveToFailedState( sentinelException );
  }
}
void Operations::safeExitAction ( ) [protected]

Definition at line 108 of file Operations.cc.

References alignCSCRings::e, exception, Exception, lumiQueryAPI::msg, and susybsm::HSCParticleType::unknown.

Referenced by stor::Constructed::~Constructed(), stor::DrainingQueues::~DrainingQueues(), stor::Enabled::~Enabled(), stor::Failed::~Failed(), stor::FinishingDQM::~FinishingDQM(), stor::Halted::~Halted(), stor::Halting::~Halting(), stor::Normal::~Normal(), stor::Processing::~Processing(), stor::Ready::~Ready(), stor::Running::~Running(), stor::Starting::~Starting(), stor::Stopped::~Stopped(), and stor::Stopping::~Stopping().

{
  const std::string unknown = "unknown exception";
  std::string msg = "Error leaving " + stateName() + " state: ";
  try
  {
    do_exitActionWork();
  }
  catch( xcept::Exception& e )
  {
    XCEPT_DECLARE_NESTED( stor::exception::StateTransition,
      sentinelException, msg, e );
    moveToFailedState( sentinelException );
  }
  catch( std::exception& e )
  {
    msg += e.what();
    XCEPT_DECLARE( stor::exception::StateTransition,
      sentinelException, msg );
    moveToFailedState( sentinelException );
  }
  catch(...)
  {
    msg += "unknown exception";
    XCEPT_DECLARE( stor::exception::StateTransition,
      sentinelException, msg );
    moveToFailedState( sentinelException );
  }
}
std::string Operations::stateName ( ) const