| |
| #include "ComputerSystem.hh" |
| |
| #include "Computer.hh" |
| #include "ExtMassStorage.hh" |
| #include "LocalPrinter.hh" |
| #include "User.hh" |
| #include "umlrtcapsuleclass.hh" |
| #include "umlrtcapsulepart.hh" |
| #include "umlrtcommsportrole.hh" |
| #include "umlrtmessage.hh" |
| #include "umlrtslot.hh" |
| #include "umlrttimerprotocol.hh" |
| #include <cstddef> |
| #include "umlrtcapsulerole.hh" |
| #include "umlrtcommsport.hh" |
| #include "umlrtframeservice.hh" |
| class UMLRTRtsInterface; |
| |
| Capsule_ComputerSystem::Capsule_ComputerSystem( const UMLRTCapsuleClass * cd, UMLRTSlot * st, const UMLRTCommsPort * * border, const UMLRTCommsPort * * internal, bool isStat ) |
| : UMLRTCapsule( NULL, cd, st, border, internal, isStat ) |
| , currentState( SPECIAL_INTERNAL_STATE_UNVISITED ) |
| , frame( borderPorts[borderport_frame] ) |
| , timer( borderPorts[borderport_timer] ) |
| , computer( &slot->parts[part_computer] ) |
| , massStorage( &slot->parts[part_massStorage] ) |
| , printer( &slot->parts[part_printer] ) |
| , user( &slot->parts[part_user] ) |
| { |
| stateNames[top__Failure] = "top__Failure"; |
| stateNames[top__Running] = "top__Running"; |
| stateNames[top__WaitingForComputerInit] = "top__WaitingForComputerInit"; |
| stateNames[top__WaitingForDeviceInit] = "top__WaitingForDeviceInit"; |
| stateNames[SPECIAL_INTERNAL_STATE_UNVISITED] = "<uninitialized>"; |
| } |
| |
| |
| void Capsule_ComputerSystem::inject( const UMLRTMessage & message ) |
| { |
| msg = &message; |
| switch( currentState ) |
| { |
| case top__Running: |
| currentState = state_____top__Running( &message ); |
| break; |
| case top__Failure: |
| currentState = state_____top__Failure( &message ); |
| break; |
| case top__WaitingForComputerInit: |
| currentState = state_____top__WaitingForComputerInit( &message ); |
| break; |
| case top__WaitingForDeviceInit: |
| currentState = state_____top__WaitingForDeviceInit( &message ); |
| break; |
| default: |
| break; |
| } |
| } |
| |
| void Capsule_ComputerSystem::initialize( const UMLRTMessage & message ) |
| { |
| msg = &message; |
| actionchain_____action_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__setComputerInitTimer( &message ); |
| currentState = choice_____top__ChoicePoint3( &message ); |
| } |
| |
| const char * Capsule_ComputerSystem::getCurrentStateString() const |
| { |
| return stateNames[currentState]; |
| } |
| |
| |
| |
| |
| void Capsule_ComputerSystem::entryaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__Failure__ComputerSystemFailed( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_mKmHgAvIEeWCGuiso4e4-g */ |
| #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') << "[" << (localTime->tm_year + 1900) << "." << std::setw(2) << (localTime->tm_mon + 1) << "." << std::setw(2) << localTime->tm_mday << " " << std::setw(2) << localTime->tm_hour << ":" << std::setw(2) << localTime->tm_min << ":" << std::setw(2) << localTime->tm_sec << "] "; |
| std::cout << "[" << this->getName() << "] terminated in failure!" << std::endl; |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_ComputerSystem::entryaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__Running__Running( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_1wK1AO4KEeSAlbC0LA6o5Q */ |
| #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() << "] is {Running}." << std::endl; |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_ComputerSystem::entryaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__WaitingForComputerInit__waitingForComputerInit( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_GZec4A4FEeWZmqO69MGcNA */ |
| #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() << "] is waiting for computer initialisation {WaitingForComputerInit}." << std::endl; |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_ComputerSystem::entryaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__WaitingForDeviceInit__waitForDeviceInit( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_eZK6wA4GEeWZmqO69MGcNA */ |
| #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() << "] is waiting for external device initialization." << std::endl; |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_ComputerSystem::transitionaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__Failed__IncarnateFail( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_mWsncA4FEeWZmqO69MGcNA */ |
| #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() << "] did not incarnate all devices!" << std::endl; |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_ComputerSystem::transitionaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__Success__devicesIncarnated( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_TOqxMA4GEeWZmqO69MGcNA */ |
| #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() << "] incarnated all external devices!" << std::endl; |
| // context()->debugOutputModel(); |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_ComputerSystem::transitionaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__compTimerFail__TimerFail( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_rbKRwA4DEeWZmqO69MGcNA */ |
| #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_ComputerSystem::transitionaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__incarnateDevices__incarnateDevicesAndWait( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_02LZ4AvCEeWCGuiso4e4-g */ |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| /** |
| * Initialise the devices |
| */ |
| /** |
| * Incarnate the local printer |
| */ |
| 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() << "] local printer incarnation"; |
| UMLRTCapsuleId printerId = frame.incarnate(printer, LocalPrinter); |
| bool printerStatus = printerId.isValid(); |
| if ( printerStatus ) { |
| std::cout << " successful." << std::endl; |
| } else { |
| std::cout << " FAILED!" << std::endl; |
| } |
| /** |
| * Incarnate the mass storage device |
| */ |
| 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() << "] mass storage incarnation"; |
| UMLRTCapsuleId storageId = frame.incarnate(massStorage, ExtMassStorage); |
| bool storageStatus = storageId.isValid(); |
| if ( storageStatus ) { |
| std::cout << " successful." << std::endl; |
| } else { |
| std::cout << " FAILED!" << std::endl; |
| } |
| bool timerStatus = false; |
| if ( printerStatus && storageStatus ) { |
| /** |
| * Set timer to wait for device initialisation |
| */ |
| numSec = 15; |
| timerID = timer.informIn(UMLRTTimespec(numSec,0)); |
| timerStatus = timerID.isValid(); |
| 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() << "] "; |
| if ( ! timerStatus ) { |
| std::cout << "FAILED to "; |
| } |
| std::cout << "set " << numSec << " seconds timout for device initialization wait." << std::endl; |
| } |
| initStatus = ( printerStatus && storageStatus && timerStatus); |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_ComputerSystem::transitionaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__incarnateUser__incarnateUser( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_Z4ZoMMUeEeS9x_uTNp8Ezw */ |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| /** |
| * Incarnate the user |
| */ |
| 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() << "] is incarnating a user." << std::endl; |
| UMLRTCapsuleId userId = frame.incarnate(user, User); |
| initStatus = userId.isValid(); |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_ComputerSystem::transitionaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__setComputerInitTimer__setComputerTimer( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_BJHSgAvAEeWCGuiso4e4-g */ |
| #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() << "] is initializing "; |
| numSec = 20; |
| timerID = timer.informIn(UMLRTTimespec(numSec,0)); |
| initStatus = timerID.isValid(); |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_ComputerSystem::transitionaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__timerOK__TimerSet( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_wGf_gA4DEeWZmqO69MGcNA */ |
| #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_ComputerSystem::transitionaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__userNOK__errorIncarnatingUser( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_uITGEA4GEeWZmqO69MGcNA */ |
| #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() << "] FAILed to incarnate the user!" << std::endl; |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_ComputerSystem::transitionaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__userOK__userIncarnated( const UMLRTMessage * msg ) |
| { |
| // the following code has been generated |
| /* UMLRT-CODEGEN:platform:/resource/ComputerSystem/ComputerSystem.uml#_0UN1wA4GEeWZmqO69MGcNA */ |
| #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() << "] incarnated the user." << std::endl; |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| bool Capsule_ComputerSystem::guard_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__Failed__Failed( const UMLRTMessage * msg ) |
| { |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| return(!initStatus); |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| bool Capsule_ComputerSystem::guard_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__Success__Constraint( const UMLRTMessage * msg ) |
| { |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| return(initStatus); |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| bool Capsule_ComputerSystem::guard_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__compTimerFail__Failed( const UMLRTMessage * msg ) |
| { |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| return(!initStatus); |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| bool Capsule_ComputerSystem::guard_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__timerOK__validTimer( const UMLRTMessage * msg ) |
| { |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| return(initStatus); |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| bool Capsule_ComputerSystem::guard_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__userNOK__userNOK( const UMLRTMessage * msg ) |
| { |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| return(!initStatus); |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| bool Capsule_ComputerSystem::guard_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__userOK__userOK( const UMLRTMessage * msg ) |
| { |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| // generated code ends |
| return(initStatus); |
| // the following code has been generated |
| #undef rtdata |
| // generated code ends |
| } |
| |
| void Capsule_ComputerSystem::actionchain_____action_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__Failed( const UMLRTMessage * msg ) |
| { |
| transitionaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__Failed__IncarnateFail( msg ); |
| entryaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__Failure__ComputerSystemFailed( msg ); |
| } |
| |
| void Capsule_ComputerSystem::actionchain_____action_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__Success( const UMLRTMessage * msg ) |
| { |
| transitionaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__Success__devicesIncarnated( msg ); |
| entryaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__WaitingForDeviceInit__waitForDeviceInit( msg ); |
| } |
| |
| void Capsule_ComputerSystem::actionchain_____action_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__compTimerFail( const UMLRTMessage * msg ) |
| { |
| transitionaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__compTimerFail__TimerFail( msg ); |
| entryaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__Failure__ComputerSystemFailed( msg ); |
| } |
| |
| void Capsule_ComputerSystem::actionchain_____action_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__incarnateDevices( const UMLRTMessage * msg ) |
| { |
| transitionaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__incarnateDevices__incarnateDevicesAndWait( msg ); |
| } |
| |
| void Capsule_ComputerSystem::actionchain_____action_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__incarnateUser( const UMLRTMessage * msg ) |
| { |
| transitionaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__incarnateUser__incarnateUser( msg ); |
| } |
| |
| void Capsule_ComputerSystem::actionchain_____action_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__setComputerInitTimer( const UMLRTMessage * msg ) |
| { |
| transitionaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__setComputerInitTimer__setComputerTimer( msg ); |
| } |
| |
| void Capsule_ComputerSystem::actionchain_____action_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__timerOK( const UMLRTMessage * msg ) |
| { |
| transitionaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__timerOK__TimerSet( msg ); |
| entryaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__WaitingForComputerInit__waitingForComputerInit( msg ); |
| } |
| |
| void Capsule_ComputerSystem::actionchain_____action_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__userNOK( const UMLRTMessage * msg ) |
| { |
| transitionaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__userNOK__errorIncarnatingUser( msg ); |
| entryaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__Failure__ComputerSystemFailed( msg ); |
| } |
| |
| void Capsule_ComputerSystem::actionchain_____action_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__userOK( const UMLRTMessage * msg ) |
| { |
| transitionaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__userOK__userIncarnated( msg ); |
| entryaction_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__Running__Running( msg ); |
| } |
| |
| Capsule_ComputerSystem::State Capsule_ComputerSystem::choice_____top__ChoicePoint2( const UMLRTMessage * msg ) |
| { |
| if( guard_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__userOK__userOK( msg ) ) |
| { |
| actionchain_____action_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__userOK( msg ); |
| return top__Running; |
| } |
| else if( guard_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__userNOK__userNOK( msg ) ) |
| { |
| actionchain_____action_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__userNOK( msg ); |
| return top__Failure; |
| } |
| return currentState; |
| } |
| |
| Capsule_ComputerSystem::State Capsule_ComputerSystem::choice_____top__ChoicePoint3( const UMLRTMessage * msg ) |
| { |
| if( guard_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__timerOK__validTimer( msg ) ) |
| { |
| actionchain_____action_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__timerOK( msg ); |
| return top__WaitingForComputerInit; |
| } |
| else if( guard_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__compTimerFail__Failed( msg ) ) |
| { |
| actionchain_____action_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__compTimerFail( msg ); |
| return top__Failure; |
| } |
| return currentState; |
| } |
| |
| Capsule_ComputerSystem::State Capsule_ComputerSystem::choice_____top__ChoicePoint4( const UMLRTMessage * msg ) |
| { |
| if( guard_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__Failed__Failed( msg ) ) |
| { |
| actionchain_____action_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__Failed( msg ); |
| return top__Failure; |
| } |
| else if( guard_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__Success__Constraint( msg ) ) |
| { |
| actionchain_____action_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__Success( msg ); |
| return top__WaitingForDeviceInit; |
| } |
| return currentState; |
| } |
| |
| Capsule_ComputerSystem::State Capsule_ComputerSystem::state_____top__Failure( const UMLRTMessage * msg ) |
| { |
| switch( msg->destPort->role()->id ) |
| { |
| default: |
| this->unexpectedMessage(); |
| break; |
| } |
| return currentState; |
| } |
| |
| Capsule_ComputerSystem::State Capsule_ComputerSystem::state_____top__Running( const UMLRTMessage * msg ) |
| { |
| switch( msg->destPort->role()->id ) |
| { |
| default: |
| this->unexpectedMessage(); |
| break; |
| } |
| return currentState; |
| } |
| |
| Capsule_ComputerSystem::State Capsule_ComputerSystem::state_____top__WaitingForComputerInit( const UMLRTMessage * msg ) |
| { |
| switch( msg->destPort->role()->id ) |
| { |
| case port_timer: |
| switch( msg->getSignalId() ) |
| { |
| case UMLRTTimerProtocol::signal_timeout: |
| actionchain_____action_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__incarnateDevices( msg ); |
| return choice_____top__ChoicePoint4( msg ); |
| default: |
| this->unexpectedMessage(); |
| break; |
| } |
| return currentState; |
| default: |
| this->unexpectedMessage(); |
| break; |
| } |
| return currentState; |
| } |
| |
| Capsule_ComputerSystem::State Capsule_ComputerSystem::state_____top__WaitingForDeviceInit( const UMLRTMessage * msg ) |
| { |
| switch( msg->destPort->role()->id ) |
| { |
| case port_timer: |
| switch( msg->getSignalId() ) |
| { |
| case UMLRTTimerProtocol::signal_timeout: |
| actionchain_____action_____ComputerSystem__System__ComputerSystem__ComputerSystem_SM__Region1__incarnateUser( msg ); |
| return choice_____top__ChoicePoint2( msg ); |
| default: |
| this->unexpectedMessage(); |
| break; |
| } |
| return currentState; |
| default: |
| this->unexpectedMessage(); |
| break; |
| } |
| return currentState; |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| void Capsule_ComputerSystem::bindPort( bool isBorder, int portId, int index ) |
| { |
| } |
| |
| void Capsule_ComputerSystem::unbindPort( bool isBorder, int portId, int index ) |
| { |
| } |
| |
| |
| |
| |
| |
| |
| static const UMLRTCapsuleRole roles[] = |
| { |
| { |
| "computer", |
| &Computer, |
| 1, |
| 1, |
| false, |
| false |
| }, |
| { |
| "massStorage", |
| &ExtMassStorage, |
| 0, |
| 1, |
| true, |
| false |
| }, |
| { |
| "printer", |
| &LocalPrinter, |
| 0, |
| 1, |
| true, |
| false |
| }, |
| { |
| "user", |
| &User, |
| 0, |
| 1, |
| true, |
| false |
| } |
| }; |
| |
| static const UMLRTCommsPortRole portroles_border[] = |
| { |
| { |
| Capsule_ComputerSystem::port_frame, |
| "Frame", |
| "frame", |
| "", |
| 1, |
| true, |
| false, |
| false, |
| false, |
| false, |
| false, |
| false |
| }, |
| { |
| Capsule_ComputerSystem::port_timer, |
| "Timing", |
| "timer", |
| "", |
| 1, |
| true, |
| false, |
| false, |
| false, |
| false, |
| false, |
| false |
| } |
| }; |
| |
| static void instantiate_ComputerSystem( const UMLRTRtsInterface * rts, UMLRTSlot * slot, const UMLRTCommsPort * * borderPorts ) |
| { |
| UMLRTFrameService::connectPorts( &slot->parts[Capsule_ComputerSystem::part_computer].slots[0]->ports[Capsule_Computer::borderport_usbPort], 0, &slot->parts[Capsule_ComputerSystem::part_printer].slots[0]->ports[Capsule_LocalPrinter::borderport_usbPort], 0 ); |
| UMLRTFrameService::connectPorts( &slot->parts[Capsule_ComputerSystem::part_computer].slots[0]->ports[Capsule_Computer::borderport_usbPort], 1, &slot->parts[Capsule_ComputerSystem::part_massStorage].slots[0]->ports[Capsule_ExtMassStorage::borderport_usbPort], 0 ); |
| UMLRTFrameService::connectPorts( &slot->parts[Capsule_ComputerSystem::part_computer].slots[0]->ports[Capsule_Computer::borderport_userPort], 0, &slot->parts[Capsule_ComputerSystem::part_user].slots[0]->ports[Capsule_User::borderport_computerPort], 0 ); |
| Computer.instantiate( NULL, slot->parts[Capsule_ComputerSystem::part_computer].slots[0], UMLRTFrameService::createBorderPorts( slot->parts[Capsule_ComputerSystem::part_computer].slots[0], Computer.numPortRolesBorder ) ); |
| slot->capsule = new Capsule_ComputerSystem( &ComputerSystem, slot, borderPorts, NULL, false ); |
| } |
| |
| const UMLRTCapsuleClass ComputerSystem = |
| { |
| "ComputerSystem", |
| NULL, |
| instantiate_ComputerSystem, |
| 4, |
| roles, |
| 2, |
| portroles_border, |
| 0, |
| NULL |
| }; |
| |