coffeemachine_marki_tester.cpp
来自「含有uml的多个实例及实例的java源码。」· C++ 代码 · 共 521 行
CPP
521 行
// {{{RME classifier 'Logical View::TestHarnesses::MarkI_Tests::CoffeeMachine_MarkI_Tester'#if defined( PRAGMA ) && ! defined( PRAGMA_IMPLEMENTED )#pragma implementation "rtg/CoffeeMachine_MarkI_Tester.h"#endif#include <RTSystem/AutoTestMarkI_x86VisualCpp60.h>#include <rtg/CoffeeMachine_MarkI_Tester.h>#include <rtg/Boiler.h>#include <rtg/BrewButton.h>#include <rtg/GlobalTestData_MarkI.h>#include <rtg/IndicatorLight.h>#include <rtg/ReliefValve.h>#include <rtg/TestResults.h>#include <rtg/Warmer.h>extern const RTActorClass MarkI_Container;extern const RTActorClass MarkI_TestContainer;// {{{RME tool 'OT::Cpp' property 'ImplementationPreface'// {{{USR// }}}USR// }}}RMEstatic RTActor * new_CoffeeMachine_MarkI_Tester_Actor( RTController * _rts, RTActorRef * _ref ){ return new CoffeeMachine_MarkI_Tester_Actor( _rts, _ref );}const RTActorClass CoffeeMachine_MarkI_Tester ={ &CoffeeMachine_Tester , "CoffeeMachine_MarkI_Tester" , (RTVersionId)0 , 0 , (const RTRelayDescriptor *)0 , new_CoffeeMachine_MarkI_Tester_Actor};static const char * const rtg_state_names[] ={ "TOP" , "Testing" , "Done" , "Finished_all_tests"};static const RTInterfaceDescriptor rtg_interfaces_testContainers[] ={ { "reliefValve" , 1 } , { "boiler" , 1 } , { "brewButton" , 1 } , { "warmer" , 1 } , { "indicatorLight" , 1 } , { "testResults" , 1 }};static const RTBindingDescriptor rtg_bindings_testContainers[] ={ { 0 , &ReliefValve::Conjugate::rt_class } , { 1 , &Boiler::Conjugate::rt_class } , { 2 , &BrewButton::Conjugate::rt_class } , { 3 , &Warmer::Conjugate::rt_class } , { 4 , &IndicatorLight::Conjugate::rt_class } , { 5 , &TestResults::Conjugate::rt_class }};static const RTInterfaceDescriptor rtg_interfaces_cuContainer[] ={ { "reliefValve" , 1 } , { "indicatorLight" , 1 } , { "boiler" , 1 } , { "brewButton" , 1 } , { "warmer" , 1 }};static const RTBindingDescriptor rtg_bindings_cuContainer[] ={ { 0 , &ReliefValve::Base::rt_class } , { 1 , &IndicatorLight::Base::rt_class } , { 2 , &Boiler::Base::rt_class } , { 3 , &BrewButton::Base::rt_class } , { 4 , &Warmer::Base::rt_class }};#define SUPER CoffeeMachine_Tester_ActorCoffeeMachine_MarkI_Tester_Actor::CoffeeMachine_MarkI_Tester_Actor( RTController * rtg_rts, RTActorRef * rtg_ref ) : CoffeeMachine_Tester_Actor( rtg_rts, rtg_ref ){}CoffeeMachine_MarkI_Tester_Actor::~CoffeeMachine_MarkI_Tester_Actor( void ){}// {{{RME operation 'InitializeTests()'void CoffeeMachine_MarkI_Tester_Actor::InitializeTests( void ){ // {{{USR test_cases = (struct TestCaseDescriptor *)TestInfoMarkI; num_tests = NUM_TESTS_MARKI; // }}}USR}// }}}RMEint CoffeeMachine_MarkI_Tester_Actor::_followOutV( RTBindingEnd & rtg_end, int rtg_compId, int rtg_portId, int rtg_repIndex ){ switch( rtg_compId ) { case 1: // testContainers switch( rtg_portId ) { case 0: // reliefValve if( rtg_repIndex < 1 ) { // cuContainer/reliefValve return cuContainer._followIn( rtg_end, 0, rtg_repIndex ); } break; case 1: // boiler if( rtg_repIndex < 1 ) { // cuContainer/boiler return cuContainer._followIn( rtg_end, 2, rtg_repIndex ); } break; case 2: // brewButton if( rtg_repIndex < 1 ) { // cuContainer/brewButton return cuContainer._followIn( rtg_end, 3, rtg_repIndex ); } break; case 3: // warmer if( rtg_repIndex < 1 ) { // cuContainer/warmer return cuContainer._followIn( rtg_end, 4, rtg_repIndex ); } break; case 4: // indicatorLight if( rtg_repIndex < 1 ) { // cuContainer/indicatorLight return cuContainer._followIn( rtg_end, 1, rtg_repIndex ); } break; case 5: // testResults if( rtg_repIndex < 1 ) { // testResults rtg_end.port = &testResults; rtg_end.index = rtg_repIndex; return 1; } break; default: break; } case 2: // cuContainer switch( rtg_portId ) { case 0: // reliefValve if( rtg_repIndex < 1 ) { // testContainers/reliefValve return testContainers._followIn( rtg_end, 0, rtg_repIndex ); } break; case 1: // indicatorLight if( rtg_repIndex < 1 ) { // testContainers/indicatorLight return testContainers._followIn( rtg_end, 4, rtg_repIndex ); } break; case 2: // boiler if( rtg_repIndex < 1 ) { // testContainers/boiler return testContainers._followIn( rtg_end, 1, rtg_repIndex ); } break; case 3: // brewButton if( rtg_repIndex < 1 ) { // testContainers/brewButton return testContainers._followIn( rtg_end, 2, rtg_repIndex ); } break; case 4: // warmer if( rtg_repIndex < 1 ) { // testContainers/warmer return testContainers._followIn( rtg_end, 3, rtg_repIndex ); } break; default: break; } default: break; } return CoffeeMachine_Tester_Actor::_followOutV( rtg_end, rtg_compId, rtg_portId, rtg_repIndex );}INLINE_CHAINS void CoffeeMachine_MarkI_Tester_Actor::chain1_Initial( void ){ // classifier 'Logical View::TestHarnesses::CoffeeMachine_Tester' transition ':TOP:Initial:Initial' rtgChainBegin( 1, "Initial" ); rtgTransitionBegin(); transition1_Initial( msg->data, msg->sap() ); rtgTransitionEnd(); enterState( 2 );}INLINE_CHAINS void CoffeeMachine_MarkI_Tester_Actor::chain2_Failed_Test( void ){ // classifier 'Logical View::TestHarnesses::CoffeeMachine_Tester' transition ':TOP:Testing:Junction2:Failed_Test' rtgChainBegin( 2, "Failed_Test" ); exitState( rtg_parent_state ); rtgTransitionBegin(); transition2_Failed_Test( msg->data, (TestResults::Conjugate *)msg->sap() ); rtgTransitionEnd(); enterState( 3 );}INLINE_CHAINS void CoffeeMachine_MarkI_Tester_Actor::chain3_Passed_Test( void ){ // classifier 'Logical View::TestHarnesses::CoffeeMachine_Tester' transition ':TOP:Testing:Junction4:Passed_Test' rtgChainBegin( 2, "Passed_Test" ); exitState( rtg_parent_state ); rtgTransitionBegin(); transition3_Passed_Test( msg->data, (TestResults::Conjugate *)msg->sap() ); rtgTransitionEnd(); if( choicePoint1_Finished_all_tests( msg->data, (TestResults::Conjugate *)msg->sap() ) ) chain5_True(); else chain4_False();}INLINE_CHAINS void CoffeeMachine_MarkI_Tester_Actor::chain5_True( void ){ // classifier 'Logical View::TestHarnesses::CoffeeMachine_Tester' transition ':TOP:Finished_all_tests:True' rtgChainBegin( 4, "True" ); rtgTransitionBegin(); transition5_True( msg->data, (TestResults::Conjugate *)msg->sap() ); rtgTransitionEnd(); enterState( 3 );}INLINE_CHAINS void CoffeeMachine_MarkI_Tester_Actor::chain4_False( void ){ // classifier 'Logical View::TestHarnesses::CoffeeMachine_Tester' transition ':TOP:Finished_all_tests:False' rtgChainBegin( 4, "False" ); rtgTransitionBegin(); rtgTransitionEnd(); enterState( 2 );}void CoffeeMachine_MarkI_Tester_Actor::rtsBehavior( int signalIndex, int portIndex ){ for( int stateIndex = getCurrentState(); ; stateIndex = rtg_parent_state[ stateIndex - 1 ] ) switch( stateIndex ) { case 1: // {{{RME classifier 'Logical View::TestHarnesses::CoffeeMachine_Tester' state ':TOP' switch( portIndex ) { case 0: switch( signalIndex ) { case 1: chain1_Initial(); return; default: break; } break; default: break; } unexpectedMessage(); return; // }}}RME case 2: // {{{RME classifier 'Logical View::TestHarnesses::CoffeeMachine_Tester' state ':TOP:Testing' switch( portIndex ) { case 0: switch( signalIndex ) { case 1: return; default: break; } break; case 1: // {{{RME port 'testResults' switch( signalIndex ) { case TestResults::Conjugate::rti_fail: chain2_Failed_Test(); return; case TestResults::Conjugate::rti_success: chain3_Passed_Test(); return; default: break; } break; // }}}RME default: break; } break; // }}}RME case 3: // {{{RME classifier 'Logical View::TestHarnesses::CoffeeMachine_Tester' state ':TOP:Done' switch( portIndex ) { case 0: switch( signalIndex ) { case 1: return; default: break; } break; default: break; } break; // }}}RME default: unexpectedState(); return; }}const RTActor_class * CoffeeMachine_MarkI_Tester_Actor::getActorData( void ) const{ return &CoffeeMachine_MarkI_Tester_Actor::rtg_class;}const RTActor_class CoffeeMachine_MarkI_Tester_Actor::rtg_class ={ &CoffeeMachine_Tester_Actor::rtg_class , rtg_state_names , 3 , CoffeeMachine_MarkI_Tester_Actor::rtg_parent_state , &CoffeeMachine_MarkI_Tester , 2 , CoffeeMachine_MarkI_Tester_Actor::rtg_capsule_roles , 3 , CoffeeMachine_MarkI_Tester_Actor::rtg_ports , 0 , (const RTLocalBindingDescriptor *)0 , 0 , (const RTFieldDescriptor *)0};const RTStateId CoffeeMachine_MarkI_Tester_Actor::rtg_parent_state[] ={ 0 , 1 , 1};const RTComponentDescriptor CoffeeMachine_MarkI_Tester_Actor::rtg_capsule_roles[] ={ { "testContainers" , &MarkI_TestContainer , RTOffsetOf( CoffeeMachine_MarkI_Tester_Actor, testContainers ) , 1 , RTComponentDescriptor::Optional , 1 , 1 // cardinality , 6 , rtg_interfaces_testContainers , 6 , rtg_bindings_testContainers } , { "cuContainer" , &MarkI_Container , RTOffsetOf( CoffeeMachine_MarkI_Tester_Actor, cuContainer ) , 2 , RTComponentDescriptor::Optional , 1 , 1 // cardinality , 5 , rtg_interfaces_cuContainer , 5 , rtg_bindings_cuContainer }};const RTPortDescriptor CoffeeMachine_MarkI_Tester_Actor::rtg_ports[] ={ { "testResults" , (const char *)0 , &TestResults::Conjugate::rt_class , RTOffsetOf( CoffeeMachine_MarkI_Tester_Actor, CoffeeMachine_Tester_Actor::testResults ) , 1 // cardinality , 1 , RTPortDescriptor::KindWired + RTPortDescriptor::NotificationDisabled + RTPortDescriptor::RegisterNotPermitted + RTPortDescriptor::VisibilityProtected } , { "frame" , (const char *)0 , &Frame::Base::rt_class , RTOffsetOf( CoffeeMachine_MarkI_Tester_Actor, CoffeeMachine_Tester_Actor::frame ) , 1 // cardinality , 2 , RTPortDescriptor::KindSpecial + RTPortDescriptor::NotificationDisabled + RTPortDescriptor::RegisterNotPermitted + RTPortDescriptor::VisibilityProtected } , { "log" , (const char *)0 , &Log::Base::rt_class , RTOffsetOf( CoffeeMachine_MarkI_Tester_Actor, CoffeeMachine_Tester_Actor::log ) , 1 // cardinality , 3 , 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 + -
显示快捷键?