CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Starting.cc
Go to the documentation of this file.
1 // $Id: Starting.cc,v 1.12 2011/11/08 10:48:41 mommsen Exp $
3 
14 
15 #include <iostream>
16 #include <unistd.h>
17 
18 using namespace std;
19 using namespace stor;
20 
21 Starting::Starting( my_context c ): my_base(c)
22 {
24 }
25 
27 {
28  TransitionRecord tr( stateName(), true );
29  outermost_context().updateHistory( tr );
30 
31  SharedResourcesPtr sharedResources =
32  outermost_context().getSharedResources();
33 
34  // Request DiskWriter to configure streams
35  EvtStrConfigListPtr evtCfgList = sharedResources->configuration_->
36  getCurrentEventStreamConfig();
37  ErrStrConfigListPtr errCfgList = sharedResources->configuration_->
38  getCurrentErrorStreamConfig();
39 
40  WorkerThreadParams workerParams =
41  sharedResources->configuration_->getWorkerThreadParams();
42  sharedResources->diskWriterResources_->
43  requestStreamConfiguration(evtCfgList, errCfgList,
44  sharedResources->configuration_->getDiskWritingParams(),
45  sharedResources->configuration_->getRunNumber(),
46  workerParams.DWdeqWaitTime_);
47 
48  // Request configuration of DQMEventProcessor
49  sharedResources->dqmEventProcessorResources_->
50  requestConfiguration(
51  sharedResources->configuration_->getDQMProcessingParams(),
52  workerParams.DQMEPdeqWaitTime_);
53 }
54 
56 {
58 }
59 
61 {
62  TransitionRecord tr( stateName(), false );
63  outermost_context().updateHistory( tr );
64 }
65 
66 string Starting::do_stateName() const
67 {
68  return std::string( "Starting" );
69 }
70 
72 {
73  outermost_context().getSharedResources()->alarmHandler_->moveToFailedState( exception );
74 }
75 
76 void Starting::logStopDoneRequest( const StopDone& request )
77 {
78  outermost_context().unconsumed_event( request );
79 }
80 
81 void Starting::logHaltDoneRequest( const HaltDone& request )
82 {
83  outermost_context().unconsumed_event( request );
84 }
85 
86 void
88 {
90  {
91  SharedResourcesPtr sharedResources =
92  outermost_context().getSharedResources();
93  EventPtr_t stMachEvent( new StartRun() );
94  sharedResources->commandQueue_->enqWait( stMachEvent );
95  }
96 }
97 
98 bool
100 {
101  SharedResourcesPtr sharedResources =
102  outermost_context().getSharedResources();
103 
104  // check if the requests are still being processed
105  if ( sharedResources->diskWriterResources_->streamChangeOngoing() ) return false;
106 
107  if ( sharedResources->dqmEventProcessorResources_->requestsOngoing() ) return false;
108 
109  return true;
110 }
111 
112 
std::string stateName() const
Definition: Operations.cc:39
boost::shared_ptr< ErrStrConfigList > ErrStrConfigListPtr
virtual ~Starting()
Definition: Starting.cc:55
virtual void do_entryActionWork()
Definition: Starting.cc:26
boost::shared_ptr< SharedResources > SharedResourcesPtr
boost::shared_ptr< boost::statechart::event_base > EventPtr_t
Definition: CommandQueue.h:21
boost::shared_ptr< EvtStrConfigList > EvtStrConfigListPtr
void safeExitAction()
Definition: Operations.cc:108
boost::posix_time::time_duration DQMEPdeqWaitTime_
void logHaltDoneRequest(const HaltDone &request)
Definition: Starting.cc:81
virtual void do_noFragmentToProcess() const
Definition: Starting.cc:87
virtual void do_moveToFailedState(xcept::Exception &exception) const
Definition: Starting.cc:71
void logStopDoneRequest(const StopDone &request)
Definition: Starting.cc:76
bool workerThreadsConfigured() const
Definition: Starting.cc:99
boost::posix_time::time_duration DWdeqWaitTime_
virtual void do_exitActionWork()
Definition: Starting.cc:60
virtual std::string do_stateName() const
Definition: Starting.cc:66
void safeEntryAction()
Definition: Operations.cc:77