| |
| #include "User.hh" |
| |
| #include "umlrtcommsportrole.hh" |
| #include "umlrtmessage.hh" |
| #include "umlrtslot.hh" |
| #include "umlrttimerprotocol.hh" |
| #include <cstddef> |
| #include "umlrtcapsuleclass.hh" |
| #include "umlrtframeservice.hh" |
| class UMLRTRtsInterface; |
| struct UMLRTCommsPort; |
| |
| Capsule_User::Capsule_User( const UMLRTCapsuleClass * cd, UMLRTSlot * st, const UMLRTCommsPort * * border, const UMLRTCommsPort * * internal, bool isStat ) |
| : UMLRTCapsule( NULL, cd, st, border, internal, isStat ) |
| , computerPort( borderPorts[borderport_computerPort] ) |
| , timer( borderPorts[borderport_timer] ) |
| , currentState( SPECIAL_INTERNAL_STATE_UNVISITED ) |
| { |
| stateNames[top__Waiting4DocSave] = "top__Waiting4DocSave"; |
| stateNames[top__Alive] = "top__Alive"; |
| stateNames[top__Waiting4DocPrint] = "top__Waiting4DocPrint"; |
| stateNames[top__TestDone] = "top__TestDone"; |
| stateNames[top__FAILED] = "top__FAILED"; |
| stateNames[SPECIAL_INTERNAL_STATE_UNVISITED] = "<uninitialized>"; |
| } |
| |
| |
| |
| |
| |
| |
| void Capsule_User::bindPort( bool isBorder, int portId, int index ) |
| { |
| if( isBorder ) |
| switch( portId ) |
| { |
| case borderport_computerPort: |
| UMLRTFrameService::sendBoundUnbound( borderPorts, borderport_computerPort, index, true ); |
| break; |
| } |
| } |
| |
| void Capsule_User::unbindPort( bool isBorder, int portId, int index ) |
| { |
| if( isBorder ) |
| switch( portId ) |
| { |
| case borderport_computerPort: |
| UMLRTFrameService::sendBoundUnbound( borderPorts, borderport_computerPort, index, false ); |
| UMLRTFrameService::disconnectPort( borderPorts[borderport_computerPort], index ); |
| break; |
| } |
| } |
| |
| |
| |
| |
| void Capsule_User::inject( const UMLRTMessage & message ) |
| { |
| msg = &message; |
| switch( currentState ) |
| { |
| case top__Alive: |
| currentState = state_____top__Alive( &message ); |
| break; |
| case top__Waiting4DocSave: |
| currentState = state_____top__Waiting4DocSave( &message ); |
| break; |
| case top__Waiting4DocPrint: |
| currentState = state_____top__Waiting4DocPrint( &message ); |
| break; |
| case top__TestDone: |
| currentState = state_____top__TestDone( &message ); |
| break; |
| case top__FAILED: |
| currentState = state_____top__FAILED( &message ); |
| break; |
| default: |
| break; |
| } |
| } |
| |
| void Capsule_User::initialize( const UMLRTMessage & message ) |
| { |
| msg = &message; |
| actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__initialize( &message ); |
| currentState = choice_____top__ChoicePoint2( &message ); |
| } |
| |
| const char * Capsule_User::getCurrentStateString() const |
| { |
| return stateNames[currentState]; |
| } |
| |
| |
| |
| |
| void Capsule_User::entryaction_____ComputerSystem__System__User__User_SM__Region1__Alive__UserIsAlive( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_gwa88Oz_EeSEsOihEv1CcQ */ |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| time_t currentTime; |
| struct tm *localTime; |
| time( ¤tTime ); |
| localTime = localtime( ¤tTime ); |
| std::cout << std::setfill('0') << "[" << std::setw(2) << localTime->tm_hour << ":" << std::setw(2) << localTime->tm_min << ":" << std::setw(2) << localTime->tm_sec << "] "; |
| std::cout << "[" << this->getName() << "(" << this->getClass()->name << ")] is alive!" << std::endl; |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_User::entryaction_____ComputerSystem__System__User__User_SM__Region1__FAILED__testFailed( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_m7LQMBaaEeWD0440ocvGbg */ |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| time_t currentTime; |
| struct tm *localTime; |
| time( ¤tTime ); |
| localTime = localtime( ¤tTime ); |
| std::cout << std::setfill('0') << "[" << std::setw(2) << localTime->tm_hour << ":" << std::setw(2) << localTime->tm_min << ":" << std::setw(2) << localTime->tm_sec << "] "; |
| std::cout << "[" << this->getName() << "(" << this->getClass()->name << ")] {FAILED}!"; |
| std::exit(EXIT_FAILURE); // unsuccessful execution |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_User::entryaction_____ComputerSystem__System__User__User_SM__Region1__TestDone__testDone( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_f5R6wBaaEeWD0440ocvGbg */ |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| time_t currentTime; |
| struct tm *localTime; |
| time( ¤tTime ); |
| localTime = localtime( ¤tTime ); |
| std::cout << std::setfill('0') << "[" << std::setw(2) << localTime->tm_hour << ":" << std::setw(2) << localTime->tm_min << ":" << std::setw(2) << localTime->tm_sec << "] "; |
| std::cout << "[" << this->getName() << "(" << this->getClass()->name << ")] is finished testing." << std::endl; |
| std::exit(EXIT_SUCCESS); // successful execution |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_User::entryaction_____ComputerSystem__System__User__User_SM__Region1__Waiting4DocPrint__wait4Print( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_7CiQkJLcEeWTl7q8dOahXg */ |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| std::cout << "[" << this->getName() << "(" << this->getClass()->name << ")] user is {Waiting4DocPrint}" << std::endl; |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_User::entryaction_____ComputerSystem__System__User__User_SM__Region1__Waiting4DocSave__Waiting4DocSave_EN( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#__09VoJJLEeWg8uhgJTo7AQ */ |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| time_t currentTime; |
| struct tm *localTime; |
| time( ¤tTime ); |
| localTime = localtime( ¤tTime ); |
| std::cout << std::setfill('0') << "[" << std::setw(2) << localTime->tm_hour << ":" << std::setw(2) << localTime->tm_min << ":" << std::setw(2) << localTime->tm_sec << "] "; |
| std::cout << "[" << this->getName() << "(" << this->getClass()->name << ")] user is {Waiting4DocSave}" << std::endl; |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_User::transitionaction_____ComputerSystem__System__User__User_SM__Region1__Transition0__saveRequested( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#__KXC8BaYEeWD0440ocvGbg */ |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| std::cout << " asked for the document to be saved." << std::endl; |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_User::transitionaction_____ComputerSystem__System__User__User_SM__Region1__Transition1__printRequested( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_2Q8J0JLcEeWTl7q8dOahXg */ |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| std::cout << " asked for the document to be printed." << std::endl; |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_User::transitionaction_____ComputerSystem__System__User__User_SM__Region1__Transition2__saveFailed( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_E7D2QBaZEeWD0440ocvGbg */ |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| std::cout << " FAILed to ask for the document to be saved!"; |
| if ( timerID.isValid() ) { |
| std::cout << " - FAILed to send message!" << std::endl; |
| } else { |
| std::cout << " FAILed to set timer!" << std::endl; |
| } |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_User::transitionaction_____ComputerSystem__System__User__User_SM__Region1__Transition3__printFailure( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_uAQGAJLcEeWTl7q8dOahXg */ |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| std::cout << " FAILed to ask for the document to be printed!"; |
| if ( timerID.isValid() ) { |
| std::cout << " - FAILed to send message!" << std::endl; |
| } else { |
| std::cout << " FAILed to set timer!" << std::endl; |
| } |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_User::transitionaction_____ComputerSystem__System__User__User_SM__Region1__initTimerFail__initTimerFail( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_QFvQ4BaXEeWD0440ocvGbg */ |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| std::cout << " but FAILed to set a " << numSec << " seconds timer." << std::endl; |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_User::transitionaction_____ComputerSystem__System__User__User_SM__Region1__initTimerSet__initTimerSet( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_EY4oMBaXEeWD0440ocvGbg */ |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| std::cout << " and set a " << numSec << " seconds timer." << std::endl; |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_User::transitionaction_____ComputerSystem__System__User__User_SM__Region1__initialize__Initialize_USER( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_b3oZ8MWrEeS9x_uTNp8Ezw */ |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| time_t currentTime; |
| struct tm *localTime; |
| time( ¤tTime ); |
| localTime = localtime( ¤tTime ); |
| std::cout << std::setfill('0') << "[" << std::setw(2) << localTime->tm_hour << ":" << std::setw(2) << localTime->tm_min << ":" << std::setw(2) << localTime->tm_sec << "] "; |
| std::cout << "[" << this->getName() << "(" << this->getClass()->name << ")] initializing"; |
| numSec = 15; |
| timerID = timer.informIn(UMLRTTimespec(numSec,0)); |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_User::transitionaction_____ComputerSystem__System__User__User_SM__Region1__isFalsePrintDoc__printDoc( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_NakGcBbLEeWa4sJtLVaM7A */ |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| time_t currentTime; |
| struct tm *localTime; |
| time( ¤tTime ); |
| localTime = localtime( ¤tTime ); |
| std::cout << std::setfill('0') << "[" << std::setw(2) << localTime->tm_hour << ":" << std::setw(2) << localTime->tm_min << ":" << std::setw(2) << localTime->tm_sec << "] "; |
| std::cout << "[" << this->getName() << "]"; |
| bool sendStatus = computerPort.printDocument().send(); |
| //numSec = 10; |
| timerID = timer.informIn(UMLRTTimespec(numSec,0)); |
| status = sendStatus && timerID.isValid(); |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_User::transitionaction_____ComputerSystem__System__User__User_SM__Region1__isTrueDone__SuccessfulRun( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_DCwnAJJPEeWg8uhgJTo7AQ */ |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| time_t currentTime; |
| struct tm *localTime; |
| time( ¤tTime ); |
| localTime = localtime( ¤tTime ); |
| std::cout << std::setfill('0') << "["<< std::setw(2) << localTime->tm_hour << ":" << std::setw(2) << localTime->tm_min << ":" << std::setw(2) << localTime->tm_sec << "] "; |
| std::cout << "[" << this->getName() << "(" << this->getClass()->name << ")] Successful Run!" << std::endl; |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_User::transitionaction_____ComputerSystem__System__User__User_SM__Region1__onTimeout1__saveDocument( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_laox4BaXEeWD0440ocvGbg */ |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| time_t currentTime; |
| struct tm *localTime; |
| time( ¤tTime ); |
| localTime = localtime( ¤tTime ); |
| std::cout << std::setfill('0') << "[" << std::setw(2) << localTime->tm_hour << ":" << std::setw(2) << localTime->tm_min << ":" << std::setw(2) << localTime->tm_sec << "] "; |
| std::cout << "[" << this->getName() << "(" << this->getClass()->name << ")]"; |
| bool sendStatus = computerPort.saveDocument().send(); |
| //numSec = 10; |
| timerID = timer.informIn(UMLRTTimespec(numSec,0)); |
| status = sendStatus && timerID.isValid(); |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_User::transitionaction_____ComputerSystem__System__User__User_SM__Region1__onTimeout2__saveTimout( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_XefLsJJMEeWg8uhgJTo7AQ */ |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| time_t currentTime; |
| struct tm *localTime; |
| time( ¤tTime ); |
| localTime = localtime( ¤tTime ); |
| std::cout << std::setfill('0') << "[" << std::setw(2) << localTime->tm_hour << ":" << std::setw(2) << localTime->tm_min << ":" << std::setw(2) << localTime->tm_sec << "] "; |
| std::cout << "[" << this->getName() << "(" << this->getClass()->name << ")] Save timeout received" << std::endl; |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| bool Capsule_User::guard_____ComputerSystem__System__User__User_SM__Region1__Transition0__saveOK( const UMLRTMessage * msg ) |
| { |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| return(status); |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| bool Capsule_User::guard_____ComputerSystem__System__User__User_SM__Region1__Transition1__printSet( const UMLRTMessage * msg ) |
| { |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| return(status); |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| bool Capsule_User::guard_____ComputerSystem__System__User__User_SM__Region1__Transition2__saveFail( const UMLRTMessage * msg ) |
| { |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| return(!status); |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| bool Capsule_User::guard_____ComputerSystem__System__User__User_SM__Region1__Transition3__printFail( const UMLRTMessage * msg ) |
| { |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| return(!status); |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| bool Capsule_User::guard_____ComputerSystem__System__User__User_SM__Region1__initTimerFail__invalidTimer( const UMLRTMessage * msg ) |
| { |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| return(!timerID.isValid()); |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| bool Capsule_User::guard_____ComputerSystem__System__User__User_SM__Region1__initTimerSet__timerValid( const UMLRTMessage * msg ) |
| { |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| return(timerID.isValid()); |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| bool Capsule_User::guard_____ComputerSystem__System__User__User_SM__Region1__isFalsePrintDoc__isFalse( const UMLRTMessage * msg ) |
| { |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| return(false); |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| bool Capsule_User::guard_____ComputerSystem__System__User__User_SM__Region1__isTrueDone__isTrue( const UMLRTMessage * msg ) |
| { |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| return(true); |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_User::actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__Transition0( const UMLRTMessage * msg ) |
| { |
| transitionaction_____ComputerSystem__System__User__User_SM__Region1__Transition0__saveRequested( msg ); |
| entryaction_____ComputerSystem__System__User__User_SM__Region1__Waiting4DocSave__Waiting4DocSave_EN( msg ); |
| } |
| |
| void Capsule_User::actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__Transition1( const UMLRTMessage * msg ) |
| { |
| transitionaction_____ComputerSystem__System__User__User_SM__Region1__Transition1__printRequested( msg ); |
| entryaction_____ComputerSystem__System__User__User_SM__Region1__Waiting4DocPrint__wait4Print( msg ); |
| } |
| |
| void Capsule_User::actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__Transition2( const UMLRTMessage * msg ) |
| { |
| transitionaction_____ComputerSystem__System__User__User_SM__Region1__Transition2__saveFailed( msg ); |
| entryaction_____ComputerSystem__System__User__User_SM__Region1__FAILED__testFailed( msg ); |
| } |
| |
| void Capsule_User::actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__Transition3( const UMLRTMessage * msg ) |
| { |
| transitionaction_____ComputerSystem__System__User__User_SM__Region1__Transition3__printFailure( msg ); |
| entryaction_____ComputerSystem__System__User__User_SM__Region1__FAILED__testFailed( msg ); |
| } |
| |
| void Capsule_User::actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__Transition4( const UMLRTMessage * msg ) |
| { |
| entryaction_____ComputerSystem__System__User__User_SM__Region1__TestDone__testDone( msg ); |
| } |
| |
| void Capsule_User::actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__initTimerFail( const UMLRTMessage * msg ) |
| { |
| transitionaction_____ComputerSystem__System__User__User_SM__Region1__initTimerFail__initTimerFail( msg ); |
| entryaction_____ComputerSystem__System__User__User_SM__Region1__FAILED__testFailed( msg ); |
| } |
| |
| void Capsule_User::actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__initTimerSet( const UMLRTMessage * msg ) |
| { |
| transitionaction_____ComputerSystem__System__User__User_SM__Region1__initTimerSet__initTimerSet( msg ); |
| entryaction_____ComputerSystem__System__User__User_SM__Region1__Alive__UserIsAlive( msg ); |
| } |
| |
| void Capsule_User::actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__initialize( const UMLRTMessage * msg ) |
| { |
| transitionaction_____ComputerSystem__System__User__User_SM__Region1__initialize__Initialize_USER( msg ); |
| } |
| |
| void Capsule_User::actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__isFalsePrintDoc( const UMLRTMessage * msg ) |
| { |
| transitionaction_____ComputerSystem__System__User__User_SM__Region1__isFalsePrintDoc__printDoc( msg ); |
| } |
| |
| void Capsule_User::actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__isTrueDone( const UMLRTMessage * msg ) |
| { |
| transitionaction_____ComputerSystem__System__User__User_SM__Region1__isTrueDone__SuccessfulRun( msg ); |
| entryaction_____ComputerSystem__System__User__User_SM__Region1__TestDone__testDone( msg ); |
| } |
| |
| void Capsule_User::actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__onTimeout1( const UMLRTMessage * msg ) |
| { |
| transitionaction_____ComputerSystem__System__User__User_SM__Region1__onTimeout1__saveDocument( msg ); |
| } |
| |
| void Capsule_User::actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__onTimeout2( const UMLRTMessage * msg ) |
| { |
| transitionaction_____ComputerSystem__System__User__User_SM__Region1__onTimeout2__saveTimout( msg ); |
| } |
| |
| void Capsule_User::actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__onTimeout3( const UMLRTMessage * msg ) |
| { |
| entryaction_____ComputerSystem__System__User__User_SM__Region1__FAILED__testFailed( msg ); |
| } |
| |
| Capsule_User::State Capsule_User::choice_____top__ChoicePoint2( const UMLRTMessage * msg ) |
| { |
| if( guard_____ComputerSystem__System__User__User_SM__Region1__initTimerSet__timerValid( msg ) ) |
| { |
| actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__initTimerSet( msg ); |
| return top__Alive; |
| } |
| else if( guard_____ComputerSystem__System__User__User_SM__Region1__initTimerFail__invalidTimer( msg ) ) |
| { |
| actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__initTimerFail( msg ); |
| return top__FAILED; |
| } |
| return currentState; |
| } |
| |
| Capsule_User::State Capsule_User::choice_____top__ChoicePoint3( const UMLRTMessage * msg ) |
| { |
| if( guard_____ComputerSystem__System__User__User_SM__Region1__Transition0__saveOK( msg ) ) |
| { |
| actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__Transition0( msg ); |
| return top__Waiting4DocSave; |
| } |
| else if( guard_____ComputerSystem__System__User__User_SM__Region1__Transition2__saveFail( msg ) ) |
| { |
| actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__Transition2( msg ); |
| return top__FAILED; |
| } |
| return currentState; |
| } |
| |
| Capsule_User::State Capsule_User::choice_____top__ChoicePoint4( const UMLRTMessage * msg ) |
| { |
| if( guard_____ComputerSystem__System__User__User_SM__Region1__Transition1__printSet( msg ) ) |
| { |
| actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__Transition1( msg ); |
| return top__Waiting4DocPrint; |
| } |
| else if( guard_____ComputerSystem__System__User__User_SM__Region1__Transition3__printFail( msg ) ) |
| { |
| actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__Transition3( msg ); |
| return top__FAILED; |
| } |
| return currentState; |
| } |
| |
| Capsule_User::State Capsule_User::choice_____top__TesterChoice( const UMLRTMessage * msg ) |
| { |
| if( guard_____ComputerSystem__System__User__User_SM__Region1__isFalsePrintDoc__isFalse( msg ) ) |
| { |
| actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__isFalsePrintDoc( msg ); |
| return choice_____top__ChoicePoint4( msg ); |
| } |
| else if( guard_____ComputerSystem__System__User__User_SM__Region1__isTrueDone__isTrue( msg ) ) |
| { |
| actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__isTrueDone( msg ); |
| return top__TestDone; |
| } |
| return currentState; |
| } |
| |
| Capsule_User::State Capsule_User::state_____top__Alive( const UMLRTMessage * msg ) |
| { |
| switch( msg->destPort->role()->id ) |
| { |
| case port_timer: |
| switch( msg->getSignalId() ) |
| { |
| case UMLRTTimerProtocol::signal_timeout: |
| actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__onTimeout1( msg ); |
| return choice_____top__ChoicePoint3( msg ); |
| default: |
| this->unexpectedMessage(); |
| break; |
| } |
| return currentState; |
| default: |
| this->unexpectedMessage(); |
| break; |
| } |
| return currentState; |
| } |
| |
| Capsule_User::State Capsule_User::state_____top__FAILED( const UMLRTMessage * msg ) |
| { |
| switch( msg->destPort->role()->id ) |
| { |
| default: |
| this->unexpectedMessage(); |
| break; |
| } |
| return currentState; |
| } |
| |
| Capsule_User::State Capsule_User::state_____top__TestDone( const UMLRTMessage * msg ) |
| { |
| switch( msg->destPort->role()->id ) |
| { |
| default: |
| this->unexpectedMessage(); |
| break; |
| } |
| return currentState; |
| } |
| |
| Capsule_User::State Capsule_User::state_____top__Waiting4DocPrint( const UMLRTMessage * msg ) |
| { |
| switch( msg->destPort->role()->id ) |
| { |
| case port_timer: |
| switch( msg->getSignalId() ) |
| { |
| case UMLRTTimerProtocol::signal_timeout: |
| actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__onTimeout3( msg ); |
| return top__FAILED; |
| default: |
| this->unexpectedMessage(); |
| break; |
| } |
| return currentState; |
| default: |
| this->unexpectedMessage(); |
| break; |
| } |
| return currentState; |
| } |
| |
| Capsule_User::State Capsule_User::state_____top__Waiting4DocSave( const UMLRTMessage * msg ) |
| { |
| switch( msg->destPort->role()->id ) |
| { |
| case port_timer: |
| switch( msg->getSignalId() ) |
| { |
| case UMLRTTimerProtocol::signal_timeout: |
| actionchain_____action_____ComputerSystem__System__User__User_SM__Region1__onTimeout2( msg ); |
| return choice_____top__TesterChoice( msg ); |
| default: |
| this->unexpectedMessage(); |
| break; |
| } |
| return currentState; |
| default: |
| this->unexpectedMessage(); |
| break; |
| } |
| return currentState; |
| } |
| |
| |
| static const UMLRTCommsPortRole portroles_border[] = |
| { |
| { |
| Capsule_User::port_computerPort, |
| "AppControl", |
| "computerPort", |
| "", |
| 1, |
| true, |
| true, |
| false, |
| false, |
| false, |
| false, |
| true |
| }, |
| { |
| Capsule_User::port_timer, |
| "Timing", |
| "timer", |
| "", |
| 1, |
| true, |
| false, |
| false, |
| false, |
| false, |
| false, |
| false |
| } |
| }; |
| |
| static void instantiate_User( const UMLRTRtsInterface * rts, UMLRTSlot * slot, const UMLRTCommsPort * * borderPorts ) |
| { |
| slot->capsule = new Capsule_User( &User, slot, borderPorts, NULL, false ); |
| } |
| |
| const UMLRTCapsuleClass User = |
| { |
| "User", |
| NULL, |
| instantiate_User, |
| 0, |
| NULL, |
| 2, |
| portroles_border, |
| 0, |
| NULL |
| }; |
| |