/***** <> *****/ #include "JDAQCHSM.hh" #include /***** state definitions *****/ int const JDAQStateMachine::state_root::children_[] = { 0, -1 }; JDAQStateMachine::state_root::state_root( CHSM_STATE_ARGS, bool chsm_history_ ) : CHSM_ns_alias::cluster( CHSM_STATE_INIT, children_, chsm_history_ ) { } int const JDAQStateMachine::state_Main::children_[] = { 1, 9, -1 }; JDAQStateMachine::state_Main::state_Main( CHSM_STATE_ARGS ) : CHSM_ns_alias::set( CHSM_STATE_INIT, children_ ), RunControl( chsm_machine_, "Main.RunControl", this, 0, 0, 0, 0, false ), Responder( chsm_machine_, "Main.Responder", this, 0, 0, 0, 0 ) { } int const JDAQStateMachine::state_Main::state_RunControl::children_[] = { 2, 8, -1 }; JDAQStateMachine::state_Main::state_RunControl::state_RunControl( CHSM_STATE_ARGS, bool chsm_history_ ) : CHSM_ns_alias::cluster( CHSM_STATE_INIT, children_, chsm_history_ ), Operational( chsm_machine_, "Main.RunControl.Operational", this, 0, 0, 0, 0, false ), Error( chsm_machine_, "Main.RunControl.Error", this, 0, 0, 0, 0 ) { } int const JDAQStateMachine::state_Main::state_RunControl::state_Operational::children_[] = { 3, 4, 5, 6, 7, -1 }; JDAQStateMachine::state_Main::state_RunControl::state_Operational::state_Operational( CHSM_STATE_ARGS, bool chsm_history_ ) : CHSM_ns_alias::cluster( CHSM_STATE_INIT, children_, chsm_history_ ), Idle( chsm_machine_, "Main.RunControl.Operational.Idle", this, 0, 0, 0, 0 ), Standby( chsm_machine_, "Main.RunControl.Operational.Standby", this, 0, 0, 0, 0 ), Ready( chsm_machine_, "Main.RunControl.Operational.Ready", this, 0, 0, 0, 0 ), Paused( chsm_machine_, "Main.RunControl.Operational.Paused", this, 0, 0, 0, 0 ), Running( chsm_machine_, "Main.RunControl.Operational.Running", this, 0, 0, 0, 0 ) { } /***** event definitions *****/ int const JDAQStateMachine::ev_daq_transitions[] = { -1 }; JDAQStateMachine::ev_daq_event::param_block::param_block( CHSM_ns_alias::event const &event, int Plength, const char * Pbuffer ) : CHSM_ns_alias::event::param_block( event ), length( Plength ), buffer( Pbuffer ) { } JDAQStateMachine::ev_daq_event::param_block::~param_block() { } void JDAQStateMachine::ev_daq_event::operator()( int length, const char * buffer ) { #ifdef CHSM_MULTITHREADED machine_lock const lock( machine_ ); #endif if ( !in_progress_ ) broadcast( new( ((JDAQStateMachine&)machine_).ev_daq_param_block ) param_block( *this, length, buffer ) ); } int const JDAQStateMachine::ev_init_transitions[] = { 1, -1 }; JDAQStateMachine::ev_init_event::param_block::param_block( CHSM_ns_alias::event const &event, int Plength, const char * Pbuffer ) : JDAQStateMachine::ev_daq_event::param_block( event, Plength, Pbuffer ) { } JDAQStateMachine::ev_init_event::param_block::~param_block() { } void JDAQStateMachine::ev_init_event::operator()( int length, const char * buffer ) { #ifdef CHSM_MULTITHREADED machine_lock const lock( machine_ ); #endif if ( !in_progress_ ) broadcast( new( ((JDAQStateMachine&)machine_).ev_init_param_block ) param_block( *this, length, buffer ) ); } int const JDAQStateMachine::ev_configure_transitions[] = { 3, -1 }; JDAQStateMachine::ev_configure_event::param_block::param_block( CHSM_ns_alias::event const &event, int Plength, const char * Pbuffer ) : JDAQStateMachine::ev_daq_event::param_block( event, Plength, Pbuffer ) { } JDAQStateMachine::ev_configure_event::param_block::~param_block() { } void JDAQStateMachine::ev_configure_event::operator()( int length, const char * buffer ) { #ifdef CHSM_MULTITHREADED machine_lock const lock( machine_ ); #endif if ( !in_progress_ ) broadcast( new( ((JDAQStateMachine&)machine_).ev_configure_param_block ) param_block( *this, length, buffer ) ); } int const JDAQStateMachine::ev_start_transitions[] = { 5, -1 }; JDAQStateMachine::ev_start_event::param_block::param_block( CHSM_ns_alias::event const &event, int Plength, const char * Pbuffer ) : JDAQStateMachine::ev_daq_event::param_block( event, Plength, Pbuffer ) { } JDAQStateMachine::ev_start_event::param_block::~param_block() { } void JDAQStateMachine::ev_start_event::operator()( int length, const char * buffer ) { #ifdef CHSM_MULTITHREADED machine_lock const lock( machine_ ); #endif if ( !in_progress_ ) broadcast( new( ((JDAQStateMachine&)machine_).ev_start_param_block ) param_block( *this, length, buffer ) ); } int const JDAQStateMachine::ev_pause_transitions[] = { 9, -1 }; JDAQStateMachine::ev_pause_event::param_block::param_block( CHSM_ns_alias::event const &event, int Plength, const char * Pbuffer ) : JDAQStateMachine::ev_daq_event::param_block( event, Plength, Pbuffer ) { } JDAQStateMachine::ev_pause_event::param_block::~param_block() { } void JDAQStateMachine::ev_pause_event::operator()( int length, const char * buffer ) { #ifdef CHSM_MULTITHREADED machine_lock const lock( machine_ ); #endif if ( !in_progress_ ) broadcast( new( ((JDAQStateMachine&)machine_).ev_pause_param_block ) param_block( *this, length, buffer ) ); } int const JDAQStateMachine::ev_continue_transitions[] = { 7, -1 }; JDAQStateMachine::ev_continue_event::param_block::param_block( CHSM_ns_alias::event const &event, int Plength, const char * Pbuffer ) : JDAQStateMachine::ev_daq_event::param_block( event, Plength, Pbuffer ) { } JDAQStateMachine::ev_continue_event::param_block::~param_block() { } void JDAQStateMachine::ev_continue_event::operator()( int length, const char * buffer ) { #ifdef CHSM_MULTITHREADED machine_lock const lock( machine_ ); #endif if ( !in_progress_ ) broadcast( new( ((JDAQStateMachine&)machine_).ev_continue_param_block ) param_block( *this, length, buffer ) ); } int const JDAQStateMachine::ev_stop_transitions[] = { 8, -1 }; JDAQStateMachine::ev_stop_event::param_block::param_block( CHSM_ns_alias::event const &event, int Plength, const char * Pbuffer ) : JDAQStateMachine::ev_daq_event::param_block( event, Plength, Pbuffer ) { } JDAQStateMachine::ev_stop_event::param_block::~param_block() { } void JDAQStateMachine::ev_stop_event::operator()( int length, const char * buffer ) { #ifdef CHSM_MULTITHREADED machine_lock const lock( machine_ ); #endif if ( !in_progress_ ) broadcast( new( ((JDAQStateMachine&)machine_).ev_stop_param_block ) param_block( *this, length, buffer ) ); } int const JDAQStateMachine::ev_reset_transitions[] = { 4, -1 }; JDAQStateMachine::ev_reset_event::param_block::param_block( CHSM_ns_alias::event const &event, int Plength, const char * Pbuffer ) : JDAQStateMachine::ev_daq_event::param_block( event, Plength, Pbuffer ) { } JDAQStateMachine::ev_reset_event::param_block::~param_block() { } void JDAQStateMachine::ev_reset_event::operator()( int length, const char * buffer ) { #ifdef CHSM_MULTITHREADED machine_lock const lock( machine_ ); #endif if ( !in_progress_ ) broadcast( new( ((JDAQStateMachine&)machine_).ev_reset_param_block ) param_block( *this, length, buffer ) ); } int const JDAQStateMachine::ev_quit_transitions[] = { 6, -1 }; JDAQStateMachine::ev_quit_event::param_block::param_block( CHSM_ns_alias::event const &event, int Plength, const char * Pbuffer ) : JDAQStateMachine::ev_daq_event::param_block( event, Plength, Pbuffer ) { } JDAQStateMachine::ev_quit_event::param_block::~param_block() { } void JDAQStateMachine::ev_quit_event::operator()( int length, const char * buffer ) { #ifdef CHSM_MULTITHREADED machine_lock const lock( machine_ ); #endif if ( !in_progress_ ) broadcast( new( ((JDAQStateMachine&)machine_).ev_quit_param_block ) param_block( *this, length, buffer ) ); } int const JDAQStateMachine::ev_off_transitions[] = { 2, 11, -1 }; JDAQStateMachine::ev_off_event::param_block::param_block( CHSM_ns_alias::event const &event, int Plength, const char * Pbuffer ) : JDAQStateMachine::ev_daq_event::param_block( event, Plength, Pbuffer ) { } JDAQStateMachine::ev_off_event::param_block::~param_block() { } void JDAQStateMachine::ev_off_event::operator()( int length, const char * buffer ) { #ifdef CHSM_MULTITHREADED machine_lock const lock( machine_ ); #endif if ( !in_progress_ ) broadcast( new( ((JDAQStateMachine&)machine_).ev_off_param_block ) param_block( *this, length, buffer ) ); } int const JDAQStateMachine::ev_check_transitions[] = { 12, -1 }; JDAQStateMachine::ev_check_event::param_block::param_block( CHSM_ns_alias::event const &event, int Plength, const char * Pbuffer ) : JDAQStateMachine::ev_daq_event::param_block( event, Plength, Pbuffer ) { } JDAQStateMachine::ev_check_event::param_block::~param_block() { } void JDAQStateMachine::ev_check_event::operator()( int length, const char * buffer ) { #ifdef CHSM_MULTITHREADED machine_lock const lock( machine_ ); #endif if ( !in_progress_ ) broadcast( new( ((JDAQStateMachine&)machine_).ev_check_param_block ) param_block( *this, length, buffer ) ); } int const JDAQStateMachine::ev_input_transitions[] = { 13, -1 }; JDAQStateMachine::ev_input_event::param_block::param_block( CHSM_ns_alias::event const &event, int Plength, const char * Pbuffer ) : JDAQStateMachine::ev_daq_event::param_block( event, Plength, Pbuffer ) { } JDAQStateMachine::ev_input_event::param_block::~param_block() { } void JDAQStateMachine::ev_input_event::operator()( int length, const char * buffer ) { #ifdef CHSM_MULTITHREADED machine_lock const lock( machine_ ); #endif if ( !in_progress_ ) broadcast( new( ((JDAQStateMachine&)machine_).ev_input_param_block ) param_block( *this, length, buffer ) ); } int const JDAQStateMachine::ev_recover_transitions[] = { 10, -1 }; JDAQStateMachine::ev_recover_event::param_block::param_block( CHSM_ns_alias::event const &event, int Plength, const char * Pbuffer ) : JDAQStateMachine::ev_daq_event::param_block( event, Plength, Pbuffer ) { } JDAQStateMachine::ev_recover_event::param_block::~param_block() { } void JDAQStateMachine::ev_recover_event::operator()( int length, const char * buffer ) { #ifdef CHSM_MULTITHREADED machine_lock const lock( machine_ ); #endif if ( !in_progress_ ) broadcast( new( ((JDAQStateMachine&)machine_).ev_recover_param_block ) param_block( *this, length, buffer ) ); } int const JDAQStateMachine::ev_error_transitions[] = { 0, -1 }; JDAQStateMachine::ev_error_event::param_block::~param_block() { } /***** transitions *****/ CHSM_ns_alias::transition const JDAQStateMachine::transition_[] = { { 0, 2, 8, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A1 }, { 0, 3, 4, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A2 }, { 0, 3, -1, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A3 }, { 0, 4, 5, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A4 }, { 0, 4, 3, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A5 }, { 0, 5, 7, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A6 }, { 0, 5, 4, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A7 }, { 0, 6, 7, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A8 }, { 0, 6, 4, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A9 }, { 0, 7, 6, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A10 }, { 0, 8, 2, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A11 }, { 0, 8, -1, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A12 }, { 0, 9, -1, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A13 }, { 0, 9, -1, 0, (CHSM_ns_alias::transition::action)&JDAQStateMachine::A14 }, 0 }; /***** CHSM constructor definition *****/ JDAQStateMachine::JDAQStateMachine( const std ::string P__name ) : JDAQCHSM ( state_, root, transition_, taken_, target_, 14, P__name ), root( *this, "root", 0, (CHSM_ns_alias::state::action)&JDAQStateMachine::EAM4root, (CHSM_ns_alias::state::action)&JDAQStateMachine::XAM4root, 0, 0, false ), Main( *this, "Main", &root, 0, 0, 0, 0 ), ev_daq( this, ev_daq_transitions, "ev_daq", 0 ), ev_init( this, ev_init_transitions, "ev_init", &ev_daq ), ev_configure( this, ev_configure_transitions, "ev_configure", &ev_daq ), ev_start( this, ev_start_transitions, "ev_start", &ev_daq ), ev_pause( this, ev_pause_transitions, "ev_pause", &ev_daq ), ev_continue( this, ev_continue_transitions, "ev_continue", &ev_daq ), ev_stop( this, ev_stop_transitions, "ev_stop", &ev_daq ), ev_reset( this, ev_reset_transitions, "ev_reset", &ev_daq ), ev_quit( this, ev_quit_transitions, "ev_quit", &ev_daq ), ev_off( this, ev_off_transitions, "ev_off", &ev_daq ), ev_check( this, ev_check_transitions, "ev_check", &ev_daq ), ev_input( this, ev_input_transitions, "ev_input", &ev_daq ), ev_recover( this, ev_recover_transitions, "ev_recover", &ev_daq ), ev_error( this, ev_error_transitions, "ev_error", 0 ) { state_[ 0 ] = &Main; state_[ 1 ] = &Main.RunControl; state_[ 2 ] = &Main.RunControl.Operational; state_[ 3 ] = &Main.RunControl.Operational.Idle; state_[ 4 ] = &Main.RunControl.Operational.Standby; state_[ 5 ] = &Main.RunControl.Operational.Ready; state_[ 6 ] = &Main.RunControl.Operational.Paused; state_[ 7 ] = &Main.RunControl.Operational.Running; state_[ 8 ] = &Main.RunControl.Error; state_[ 9 ] = &Main.Responder; state_[ 10 ] = 0; } JDAQStateMachine::~JDAQStateMachine() { } /***** user-code *****/ void JDAQStateMachine::EAM4root( CHSM_ns_alias::state const &chsm_state_, CHSM_ns_alias::event const &event ) { #line 164 "JDAQCHSM.chsm" CHSM_ns_alias::cluster const &state = (CHSM_ns_alias::cluster const&)chsm_state_; actionEnter(); } void JDAQStateMachine::XAM4root( CHSM_ns_alias::state const &chsm_state_, CHSM_ns_alias::event const &event ) { #line 165 "JDAQCHSM.chsm" CHSM_ns_alias::cluster const &state = (CHSM_ns_alias::cluster const&)chsm_state_; actionExit(); } #line 197 "JDAQCHSM.chsm" void JDAQStateMachine::A1( CHSM_ns_alias::event const &event ) { actionError(); } #line 203 "JDAQCHSM.chsm" void JDAQStateMachine::A2( CHSM_ns_alias::event const &event ) { execute(&JDAQCHSM::actionInit, event); } #line 204 "JDAQCHSM.chsm" void JDAQStateMachine::A3( CHSM_ns_alias::event const &event ) { JDAQCHSM::exit(); } #line 209 "JDAQCHSM.chsm" void JDAQStateMachine::A4( CHSM_ns_alias::event const &event ) { execute(&JDAQCHSM::actionConfigure, event); } #line 210 "JDAQCHSM.chsm" void JDAQStateMachine::A5( CHSM_ns_alias::event const &event ) { execute(&JDAQCHSM::actionReset, event); } #line 215 "JDAQCHSM.chsm" void JDAQStateMachine::A6( CHSM_ns_alias::event const &event ) { std::istringstream is(std::string(ev_start->buffer, ev_start->length)); is >> run_number >> detector_id; execute(&JDAQCHSM::actionStart, event); } #line 225 "JDAQCHSM.chsm" void JDAQStateMachine::A7( CHSM_ns_alias::event const &event ) { execute(&JDAQCHSM::actionQuit, event); } #line 230 "JDAQCHSM.chsm" void JDAQStateMachine::A8( CHSM_ns_alias::event const &event ) { execute(&JDAQCHSM::actionContinue, event); } #line 231 "JDAQCHSM.chsm" void JDAQStateMachine::A9( CHSM_ns_alias::event const &event ) { execute(&JDAQCHSM::actionStop, event); } #line 236 "JDAQCHSM.chsm" void JDAQStateMachine::A10( CHSM_ns_alias::event const &event ) { execute(&JDAQCHSM::actionPause, event); } #line 243 "JDAQCHSM.chsm" void JDAQStateMachine::A11( CHSM_ns_alias::event const &event ) { execute(&JDAQCHSM::actionRecover, event); } #line 244 "JDAQCHSM.chsm" void JDAQStateMachine::A12( CHSM_ns_alias::event const &event ) { JDAQCHSM::exit(); } #line 253 "JDAQCHSM.chsm" void JDAQStateMachine::A13( CHSM_ns_alias::event const &event ) { execute(&JDAQCHSM::actionCheck, event); } #line 254 "JDAQCHSM.chsm" void JDAQStateMachine::A14( CHSM_ns_alias::event const &event ) { execute(&JDAQCHSM::actionInput, event); } #line 257 "JDAQCHSM.chsm" /***** THE END *****/