| |
| #include "Server1.hh" |
| |
| #include "Server.hh" |
| #include "Service.hh" |
| #include "umlrtcommsportrole.hh" |
| #include "umlrtmessage.hh" |
| #include "umlrtslot.hh" |
| #include <cstddef> |
| #include "umlrtcapsuleclass.hh" |
| #include "umlrtframeservice.hh" |
| class UMLRTRtsInterface; |
| struct UMLRTCommsPort; |
| |
| Capsule_Server1::Capsule_Server1( const UMLRTCapsuleClass * cd, UMLRTSlot * st, const UMLRTCommsPort * * border, const UMLRTCommsPort * * internal, bool isStat ) |
| : Capsule_Server( cd, st, border, internal, isStat ) |
| , service( internalPorts[internalport_service] ) |
| , currentState( SPECIAL_INTERNAL_STATE_UNVISITED ) |
| { |
| stateNames[WaitingForRequests] = "WaitingForRequests"; |
| stateNames[SPECIAL_INTERNAL_STATE_UNVISITED] = "<uninitialized>"; |
| } |
| |
| |
| |
| |
| |
| |
| void Capsule_Server1::bindPort( bool isBorder, int portId, int index ) |
| { |
| } |
| |
| void Capsule_Server1::unbindPort( bool isBorder, int portId, int index ) |
| { |
| } |
| |
| void Capsule_Server1::inject( const UMLRTMessage & message ) |
| { |
| msg = &message; |
| switch( currentState ) |
| { |
| case WaitingForRequests: |
| currentState = state_____WaitingForRequests( &message ); |
| break; |
| default: |
| break; |
| } |
| } |
| |
| void Capsule_Server1::initialize( const UMLRTMessage & message ) |
| { |
| msg = &message; |
| actionchain_____Initial( &message ); |
| currentState = WaitingForRequests; |
| } |
| |
| const char * Capsule_Server1::getCurrentStateString() const |
| { |
| return stateNames[currentState]; |
| } |
| |
| |
| |
| |
| void Capsule_Server1::entryaction_____WaitingForRequests( const UMLRTMessage * msg ) |
| { |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| /* UMLRTGEN-USERREGION-BEGIN platform:/resource/SPPInheritance/SPPInheritance.uml RootElement::Server1::WaitingForRequests entry */ |
| log.log("[Server1](WaitingForRequests)"); |
| /* UMLRTGEN-USERREGION-END */ |
| #undef rtdata |
| } |
| |
| void Capsule_Server1::exitaction_____WaitingForRequests( const UMLRTMessage * msg ) |
| { |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| /* UMLRTGEN-USERREGION-BEGIN platform:/resource/SPPInheritance/SPPInheritance.uml RootElement::Server1::WaitingForRequests exit */ |
| /* UMLRTGEN-USERREGION-END */ |
| #undef rtdata |
| } |
| |
| void Capsule_Server1::transitionaction_____TransitionAction1( const UMLRTMessage * msg ) |
| { |
| #define rtdata ( (void *)msg->getParam( 0 ) ) |
| /* UMLRTGEN-USERREGION-BEGIN platform:/resource/SPPInheritance/SPPInheritance.uml RootElement::Server1 transition WaitingForRequests,WaitingForRequests,request:service */ |
| log.log("[Server1](request) received request on service port"); |
| service.response().send(); |
| log.log("[Server1](request) sent response on service port"); |
| /* UMLRTGEN-USERREGION-END */ |
| #undef rtdata |
| } |
| |
| void Capsule_Server1::actionchain_____Initial( const UMLRTMessage * msg ) |
| { |
| entryaction_____WaitingForRequests( msg ); |
| } |
| |
| void Capsule_Server1::actionchain_____TransitionAction1( const UMLRTMessage * msg ) |
| { |
| exitaction_____WaitingForRequests( msg ); |
| transitionaction_____TransitionAction1( msg ); |
| entryaction_____WaitingForRequests( msg ); |
| } |
| |
| Capsule_Server1::State Capsule_Server1::state_____WaitingForRequests( const UMLRTMessage * msg ) |
| { |
| switch( msg->destPort->role()->id ) |
| { |
| case port_service: |
| switch( msg->getSignalId() ) |
| { |
| case Service::signal_request: |
| actionchain_____TransitionAction1( msg ); |
| return WaitingForRequests; |
| default: |
| this->unexpectedMessage(); |
| break; |
| } |
| return currentState; |
| default: |
| this->unexpectedMessage(); |
| break; |
| } |
| return currentState; |
| } |
| |
| |
| static const UMLRTCommsPortRole portroles_internal[] = |
| { |
| { |
| Capsule_Server1::port_service, |
| "Service", |
| "service", |
| "", |
| 1, |
| true, |
| false, |
| false, |
| false, |
| false, |
| true, |
| false |
| }, |
| { |
| Capsule_Server1::port_log, |
| "Log", |
| "log", |
| "", |
| 1, |
| true, |
| false, |
| false, |
| false, |
| true, |
| false, |
| false |
| } |
| }; |
| |
| static void instantiate_Server1( const UMLRTRtsInterface * rts, UMLRTSlot * slot, const UMLRTCommsPort * * borderPorts ) |
| { |
| const UMLRTCommsPort * * internalPorts = UMLRTFrameService::createInternalPorts( slot, &Server1 ); |
| slot->capsule = new Capsule_Server1( &Server1, slot, borderPorts, internalPorts, false ); |
| } |
| |
| const UMLRTCapsuleClass Server1 = |
| { |
| "Server1", |
| &Server, |
| instantiate_Server1, |
| 0, |
| NULL, |
| 0, |
| NULL, |
| 2, |
| portroles_internal |
| }; |
| |