coffeepotnotempty_test.cpp
来自「含有uml的多个实例及实例的java源码。」· C++ 代码 · 共 545 行
CPP
545 行
// {{{RME classifier 'Logical View::TestHarnesses::MarkI_Tests::Scenarios_MarkI::CoffeePotNotEmpty_Test'#if defined( PRAGMA ) && ! defined( PRAGMA_IMPLEMENTED )#pragma implementation "rtg/CoffeePotNotEmpty_Test.h"#endif#include <RTSystem/AutoTestMarkI_x86VisualCpp60.h>#include <rtg/CoffeePotNotEmpty_Test.h>#include <rtg/Boiler.h>#include <rtg/BrewButton.h>#include <rtg/IndicatorLight.h>#include <rtg/ReliefValve.h>#include <rtg/Warmer.h>// {{{RME tool 'OT::Cpp' property 'ImplementationPreface'// {{{USR// }}}USR// }}}RMEstatic const RTRelayDescriptor rtg_relays[] ={ { "reliefValve" , &ReliefValve::Base::rt_class , 1 // cardinality } , { "boiler" , &Boiler::Base::rt_class , 1 // cardinality } , { "brewButton" , &BrewButton::Base::rt_class , 1 // cardinality } , { "warmer" , &Warmer::Base::rt_class , 1 // cardinality } , { "indicatorLight" , &IndicatorLight::Base::rt_class , 1 // cardinality } , { "testResults" , &TestResults::Base::rt_class , 1 // cardinality }};static RTActor * new_CoffeePotNotEmpty_Test_Actor( RTController * _rts, RTActorRef * _ref ){ return new CoffeePotNotEmpty_Test_Actor( _rts, _ref );}const RTActorClass CoffeePotNotEmpty_Test ={ &MarkI_TestContainer , "CoffeePotNotEmpty_Test" , (RTVersionId)0 , 6 , rtg_relays , new_CoffeePotNotEmpty_Test_Actor};static const char * const rtg_state_names[] ={ "TOP" , "S1" , "S2" , "Fail" , "S3"};#define SUPER MarkI_TestContainer_ActorCoffeePotNotEmpty_Test_Actor::CoffeePotNotEmpty_Test_Actor( RTController * rtg_rts, RTActorRef * rtg_ref ) : MarkI_TestContainer_Actor( rtg_rts, rtg_ref ){}CoffeePotNotEmpty_Test_Actor::~CoffeePotNotEmpty_Test_Actor( void ){}int CoffeePotNotEmpty_Test_Actor::_followInV( RTBindingEnd & rtg_end, int rtg_portId, int rtg_repIndex ){ switch( rtg_portId ) { case 0: // reliefValve if( rtg_repIndex < 1 ) { // t_reliefValve rtg_end.port = &t_reliefValve; rtg_end.index = rtg_repIndex; return 1; } break; case 1: // boiler if( rtg_repIndex < 1 ) { // t_boiler rtg_end.port = &t_boiler; rtg_end.index = rtg_repIndex; return 1; } break; case 2: // brewButton if( rtg_repIndex < 1 ) { // t_brewButton rtg_end.port = &t_brewButton; rtg_end.index = rtg_repIndex; return 1; } break; case 3: // warmer if( rtg_repIndex < 1 ) { // t_warmer rtg_end.port = &t_warmer; rtg_end.index = rtg_repIndex; return 1; } break; case 4: // indicatorLight if( rtg_repIndex < 1 ) { // t_indicatorLight rtg_end.port = &t_indicatorLight; rtg_end.index = rtg_repIndex; return 1; } break; case 5: // testResults if( rtg_repIndex < 1 ) { rtg_end.port = &testResults; rtg_end.index = rtg_repIndex; return 1; } break; default: break; } return MarkI_TestContainer_Actor::_followInV( rtg_end, rtg_portId, rtg_repIndex );}// {{{RME enter ':TOP:Fail'#define CALLSUPER MarkI_TestContainer_Actor::enter4_Fail()INLINE_METHODS void CoffeePotNotEmpty_Test_Actor::enter4_Fail( void ){ // {{{USR testResults.fail().send(); // }}}USR}#undef CALLSUPER// }}}RMEvoid CoffeePotNotEmpty_Test_Actor::enterStateV( void ){ switch( getCurrentState() ) { case 4: enter4_Fail(); break; default: MarkI_TestContainer_Actor::enterStateV(); break; }}// {{{RME transition ':TOP:Junction1:timeout'#define SUPERMETHOD MarkI_TestContainer_Actor::transition1_timeout#define CALLSUPER MarkI_TestContainer_Actor::transition1_timeout( rtdata, rtport )INLINE_METHODS void CoffeePotNotEmpty_Test_Actor::transition1_timeout( const void * rtdata, Timing::Base * rtport ){ // {{{USR testResults.success().send(); // }}}USR}#undef SUPERMETHOD#undef CALLSUPER// }}}RME// {{{RME transition ':TOP:S1:Junction2:put_full_pot'#define SUPERMETHOD MarkI_TestContainer_Actor::transition3_put_full_pot#define CALLSUPER MarkI_TestContainer_Actor::transition3_put_full_pot( rtdata, rtport )INLINE_METHODS void CoffeePotNotEmpty_Test_Actor::transition3_put_full_pot( const void * rtdata, TestResults::Base * rtport ){ // {{{USR timer.informIn( RTTimespec( 2,0 ) ); t_warmer.potNotEmpty().send(); t_brewButton.brewButtonPushed().send(); // }}}USR}#undef SUPERMETHOD#undef CALLSUPER// }}}RMEINLINE_CHAINS void CoffeePotNotEmpty_Test_Actor::chain2_Initial( void ){ // transition ':TOP:Initial:Initial' rtgChainBegin( 1, "Initial" ); rtgTransitionBegin(); rtgTransitionEnd(); enterState( 2 );}INLINE_CHAINS void CoffeePotNotEmpty_Test_Actor::chain1_timeout( void ){ // transition ':TOP:Junction1:timeout' rtgChainBegin( 1, "timeout" ); exitToChainState( 1, rtg_parent_state ); rtgTransitionBegin(); transition1_timeout( msg->data, (Timing::Base *)msg->sap() ); rtgTransitionEnd(); processHistory();}INLINE_CHAINS void CoffeePotNotEmpty_Test_Actor::chain3_put_full_pot( void ){ // transition ':TOP:S1:Junction2:put_full_pot' rtgChainBegin( 2, "put_full_pot" ); exitState( rtg_parent_state ); rtgTransitionBegin(); transition3_put_full_pot( msg->data, (TestResults::Base *)msg->sap() ); rtgTransitionEnd(); enterState( 3 );}INLINE_CHAINS void CoffeePotNotEmpty_Test_Actor::chain4_indicator_light_off( void ){ // transition ':TOP:S2:Junction2:indicator_light_off' rtgChainBegin( 3, "indicator_light_off" ); exitState( rtg_parent_state ); rtgTransitionBegin(); rtgTransitionEnd(); enterState( 3 );}INLINE_CHAINS void CoffeePotNotEmpty_Test_Actor::chain6_warmer_on( void ){ // transition ':TOP:S2:Junction5:warmer_on' rtgChainBegin( 3, "warmer_on" ); exitState( rtg_parent_state ); rtgTransitionBegin(); rtgTransitionEnd(); enterState( 5 );}INLINE_CHAINS void CoffeePotNotEmpty_Test_Actor::chain5_boiler_on( void ){ // transition ':TOP:S3:Junction2:boiler_on' rtgChainBegin( 5, "boiler_on" ); exitState( rtg_parent_state ); rtgTransitionBegin(); rtgTransitionEnd(); enterState( 4 );}void CoffeePotNotEmpty_Test_Actor::rtsBehavior( int signalIndex, int portIndex ){ for( int stateIndex = getCurrentState(); ; stateIndex = rtg_parent_state[ stateIndex - 1 ] ) switch( stateIndex ) { case 1: // {{{RME state ':TOP' switch( portIndex ) { case 0: switch( signalIndex ) { case 1: chain2_Initial(); return; default: break; } break; case 12: // {{{RME classifier 'Logical View::TestHarnesses::MarkI_Tests::MarkI_TestContainer' port 'timer' switch( signalIndex ) { case Timing::Base::rti_timeout: chain1_timeout(); return; default: break; } break; // }}}RME default: break; } unexpectedMessage(); return; // }}}RME case 2: // {{{RME state ':TOP:S1' switch( portIndex ) { case 0: switch( signalIndex ) { case 1: return; default: break; } break; case 6: // {{{RME classifier 'Logical View::TestHarnesses::MarkI_Tests::MarkI_TestContainer' port 'testResults' switch( signalIndex ) { case TestResults::Base::rti_start: chain3_put_full_pot(); return; default: break; } break; // }}}RME default: break; } break; // }}}RME case 3: // {{{RME state ':TOP:S2' switch( portIndex ) { case 0: switch( signalIndex ) { case 1: return; default: break; } break; case 8: // {{{RME classifier 'Logical View::TestHarnesses::MarkI_Tests::MarkI_TestContainer' port 't_indicatorLight' switch( signalIndex ) { case IndicatorLight::Base::rti_indicatorOff: chain4_indicator_light_off(); return; default: break; } break; // }}}RME case 11: // {{{RME classifier 'Logical View::TestHarnesses::MarkI_Tests::MarkI_TestContainer' port 't_warmer' switch( signalIndex ) { case Warmer::Base::rti_warmerOn: chain6_warmer_on(); return; default: break; } break; // }}}RME default: break; } break; // }}}RME case 4: // {{{RME state ':TOP:Fail' switch( portIndex ) { case 0: switch( signalIndex ) { case 1: return; default: break; } break; default: break; } break; // }}}RME case 5: // {{{RME state ':TOP:S3' switch( portIndex ) { case 0: switch( signalIndex ) { case 1: return; default: break; } break; case 9: // {{{RME classifier 'Logical View::TestHarnesses::MarkI_Tests::MarkI_TestContainer' port 't_boiler' switch( signalIndex ) { case Boiler::Base::rti_boilerOn: chain5_boiler_on(); return; default: break; } break; // }}}RME default: break; } break; // }}}RME default: unexpectedState(); return; }}const RTActor_class * CoffeePotNotEmpty_Test_Actor::getActorData( void ) const{ return &CoffeePotNotEmpty_Test_Actor::rtg_class;}const RTActor_class CoffeePotNotEmpty_Test_Actor::rtg_class ={ &MarkI_TestContainer_Actor::rtg_class , rtg_state_names , 5 , CoffeePotNotEmpty_Test_Actor::rtg_parent_state , &CoffeePotNotEmpty_Test , 0 , (const RTComponentDescriptor *)0 , 7 , CoffeePotNotEmpty_Test_Actor::rtg_ports , 0 , (const RTLocalBindingDescriptor *)0 , 0 , (const RTFieldDescriptor *)0};const RTStateId CoffeePotNotEmpty_Test_Actor::rtg_parent_state[] ={ 0 , 1 , 1 , 1 , 1};const RTPortDescriptor CoffeePotNotEmpty_Test_Actor::rtg_ports[] ={ { "testResults" , (const char *)0 , &TestResults::Base::rt_class , RTOffsetOf( CoffeePotNotEmpty_Test_Actor, MarkI_TestContainer_Actor::testResults ) , 1 // cardinality , 6 , RTPortDescriptor::KindWired + RTPortDescriptor::NotificationDisabled + RTPortDescriptor::RegisterNotPermitted + RTPortDescriptor::VisibilityPublic } , { "t_reliefValve" , (const char *)0 , &ReliefValve::Base::rt_class , RTOffsetOf( CoffeePotNotEmpty_Test_Actor, MarkI_TestContainer_Actor::t_reliefValve ) , 1 // cardinality , 7 , RTPortDescriptor::KindWired + RTPortDescriptor::NotificationDisabled + RTPortDescriptor::RegisterNotPermitted + RTPortDescriptor::VisibilityProtected } , { "t_indicatorLight" , (const char *)0 , &IndicatorLight::Base::rt_class , RTOffsetOf( CoffeePotNotEmpty_Test_Actor, MarkI_TestContainer_Actor::t_indicatorLight ) , 1 // cardinality , 8 , RTPortDescriptor::KindWired + RTPortDescriptor::NotificationDisabled + RTPortDescriptor::RegisterNotPermitted + RTPortDescriptor::VisibilityProtected } , { "t_boiler" , (const char *)0 , &Boiler::Base::rt_class , RTOffsetOf( CoffeePotNotEmpty_Test_Actor, MarkI_TestContainer_Actor::t_boiler ) , 1 // cardinality , 9 , RTPortDescriptor::KindWired + RTPortDescriptor::NotificationDisabled + RTPortDescriptor::RegisterNotPermitted + RTPortDescriptor::VisibilityProtected } , { "t_brewButton" , (const char *)0 , &BrewButton::Base::rt_class , RTOffsetOf( CoffeePotNotEmpty_Test_Actor, MarkI_TestContainer_Actor::t_brewButton ) , 1 // cardinality , 10 , RTPortDescriptor::KindWired + RTPortDescriptor::NotificationDisabled + RTPortDescriptor::RegisterNotPermitted + RTPortDescriptor::VisibilityProtected } , { "t_warmer" , (const char *)0 , &Warmer::Base::rt_class , RTOffsetOf( CoffeePotNotEmpty_Test_Actor, MarkI_TestContainer_Actor::t_warmer ) , 1 // cardinality , 11 , RTPortDescriptor::KindWired + RTPortDescriptor::NotificationDisabled + RTPortDescriptor::RegisterNotPermitted + RTPortDescriptor::VisibilityProtected } , { "timer" , (const char *)0 , &Timing::Base::rt_class , RTOffsetOf( CoffeePotNotEmpty_Test_Actor, MarkI_TestContainer_Actor::timer ) , 1 // cardinality , 12 , RTPortDescriptor::KindSpecial + RTPortDescriptor::NotificationDisabled + RTPortDescriptor::RegisterNotPermitted + RTPortDescriptor::VisibilityProtected }};#undef SUPER// {{{RME tool 'OT::Cpp' property 'ImplementationEnding'// {{{USR// }}}USR// }}}RME// }}}RME
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?