CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/EventFilter/StorageManager/src/Running.cc

Go to the documentation of this file.
00001 // $Id: Running.cc,v 1.10 2011/03/07 15:31:32 mommsen Exp $
00003 
00004 #include "EventFilter/StorageManager/interface/ErrorStreamConfigurationInfo.h"
00005 #include "EventFilter/StorageManager/interface/EventStreamConfigurationInfo.h"
00006 #include "EventFilter/StorageManager/interface/EventDistributor.h"
00007 #include "EventFilter/StorageManager/interface/FragmentStore.h"
00008 #include "EventFilter/StorageManager/interface/RegistrationCollection.h"
00009 #include "EventFilter/StorageManager/interface/SharedResources.h"
00010 #include "EventFilter/StorageManager/interface/StateMachine.h"
00011 #include "EventFilter/StorageManager/interface/TransitionRecord.h"
00012 
00013 #include <iostream>
00014 #include <unistd.h>
00015 
00016 using namespace std;
00017 using namespace stor;
00018 
00019 Running::Running( my_context c ): my_base(c)
00020 {
00021   safeEntryAction();
00022 }
00023 
00024 void Running::do_entryActionWork()
00025 {
00026 
00027   TransitionRecord tr( stateName(), true );
00028   outermost_context().updateHistory( tr );
00029 
00030   SharedResourcesPtr sharedResources =
00031     outermost_context().getSharedResources();
00032 
00033   // Configure event distributor
00034   EventDistributor* ed = outermost_context().getEventDistributor();
00035   EvtStrConfigListPtr evtCfgList = sharedResources->configuration_->
00036     getCurrentEventStreamConfig();
00037   ErrStrConfigListPtr errCfgList = sharedResources->configuration_->
00038     getCurrentErrorStreamConfig();
00039   ed->registerEventStreams(evtCfgList);
00040   ed->registerErrorStreams(errCfgList);
00041 
00042   // Clear old consumer registrations:
00043   sharedResources->registrationCollection_->clearRegistrations();
00044   ed->clearConsumers();
00045   sharedResources->eventQueueCollection_->removeQueues();
00046   sharedResources->dqmEventQueueCollection_->removeQueues();
00047 
00048   // Enable consumer registration:
00049   sharedResources->registrationCollection_->enableConsumerRegistration();
00050 }
00051 
00052 Running::~Running()
00053 {
00054   safeExitAction();
00055 }
00056 
00057 void Running::do_exitActionWork()
00058 {
00059 
00060   TransitionRecord tr( stateName(), false );
00061   outermost_context().updateHistory( tr );
00062 
00063   SharedResourcesPtr sharedResources =
00064     outermost_context().getSharedResources();
00065 
00066   // Disable consumer registration:
00067   sharedResources->registrationCollection_->disableConsumerRegistration();
00068 
00069   // Clear consumer queues
00070   sharedResources->eventQueueCollection_->clearQueues();
00071   sharedResources->dqmEventQueueCollection_->clearQueues();
00072 
00073   // Clear the queues
00074   sharedResources->fragmentQueue_->clear();
00075   sharedResources->streamQueue_->clear();
00076   sharedResources->dqmEventQueue_->clear();
00077   sharedResources->registrationQueue_->clear();
00078 
00079   // Clear any fragments left in the fragment store
00080   outermost_context().getFragmentStore()->clear();
00081 
00082 }
00083 
00084 string Running::do_stateName() const
00085 {
00086   return std::string( "Running" );
00087 }
00088 
00089 void Running::do_moveToFailedState( xcept::Exception& exception ) const
00090 {
00091   outermost_context().getSharedResources()->moveToFailedState( exception );
00092 }
00093 
00094 void Running::logStopDoneRequest( const StopDone& request )
00095 {
00096   outermost_context().unconsumed_event( request );
00097 }
00098 
00099 void Running::logHaltDoneRequest( const HaltDone& request )
00100 {
00101   outermost_context().unconsumed_event( request );
00102 }
00103 
00104