| // -------------------------------------------------------- |
| // Code generated by Papyrus C++ |
| // -------------------------------------------------------- |
| |
| #ifndef TESTTRACE_CLASSES_PACKAGE_A1_PACKAGE_C1_C1_H |
| #define TESTTRACE_CLASSES_PACKAGE_A1_PACKAGE_C1_C1_H |
| |
| /************************************************************ |
| C1 class header |
| ************************************************************/ |
| |
| #include "TestTrace/Classes/Package_A1/Package_C1/Pkg_Package_C1.h" |
| |
| #include "AnsiCLibrary/Pkg_AnsiCLibrary.h" |
| #include "PrimitiveTypes/Pkg_PrimitiveTypes.h" |
| #include "TestTrace/Interfaces/I_MyInterface_1.h" |
| #include "TestTrace/Types/Pkg_Types.h" |
| #include "pthread.h" |
| #include "statemachine/EventPriorityQueue.h" |
| #include "statemachine/Pkg_statemachine.h" |
| #include "statemachine/StructForThread_t.h" |
| |
| // Include from Include stereotype (header) |
| #define C1_TIME_EVENT_LOWER_BOUND (0) |
| #define C1_CHANGE_EVENT_LOWER_BOUND (0) |
| #define C1_TE_INDEX(id) (id - C1_TIME_EVENT_LOWER_BOUND) |
| #define C1_CHE_INDEX(id) (id - C1_CHANGE_EVENT_LOWER_BOUND) |
| #define STATEMACHINE_REGION1_DEFAULT (0) |
| #define STATEMACHINE_REGION1 (0) |
| #include "time.h" |
| #include "pthread.h" |
| #define C1_THREAD_CREATE(thThread, str) pthread_create(&thThread, NULL, &C1::thread_func_wrapper, &str); |
| #define C1_GET_CONTROL /*mutex synchronization to protect run-to-completion semantics*/ \ |
| pthread_mutex_lock(&runToCompletionMutex); \ |
| while (systemState != statemachine::SystemStateEnum_t::IDLE) {\ |
| pthread_cond_wait(&runToCompletionCond, &runToCompletionMutex);\ |
| } |
| #define C1_RELEASE_CONTROL systemState = statemachine::SystemStateEnum_t::IDLE; pthread_cond_signal(&runToCompletionCond); \ |
| pthread_mutex_unlock(&runToCompletionMutex); |
| // End of Include stereotype (header) |
| |
| namespace TestTrace { |
| namespace Signals { |
| class Sig_MyOperation_1; |
| } |
| } |
| namespace statemachine { |
| class Event_t; |
| } |
| |
| // derived using directives |
| using namespace AnsiCLibrary; |
| using namespace PrimitiveTypes; |
| using namespace TestTrace::Interfaces; |
| using namespace TestTrace::Signals; |
| using namespace TestTrace::Types; |
| using namespace statemachine; |
| |
| namespace TestTrace { |
| namespace Classes { |
| namespace Package_A1 { |
| namespace Package_C1 { |
| |
| /************************************************************/ |
| /** |
| * |
| */ |
| class C1: public I_MyInterface_1 { |
| public: |
| |
| /** |
| * |
| */ |
| typedef struct State_t { |
| //1 is configured as the maximum number of orthogonal regions a composite states can have |
| unsigned int /*StateIDEnum*/previousStates[1]; //for history states |
| unsigned int /*StateIDEnum*/actives[1]; |
| void (C1::*entry)(); |
| void (C1::*exit)(); |
| void (C1::*doActivity)(); |
| State_t() { |
| entry = &C1::entry_dft; |
| exit = &C1::exit_dft; |
| doActivity = &C1::doActivity_dft; |
| for (int i = 0; i < 1; i++) { |
| previousStates[i] = STATE_MAX; |
| actives[i] = STATE_MAX; |
| } |
| } |
| } State_t; |
| |
| /** |
| * |
| */ |
| enum StateIDEnum { |
| /** |
| * |
| */ |
| FIRSTSTATE_ID, |
| /** |
| * |
| */ |
| SECONDSTATE_ID, |
| /** |
| * |
| */ |
| STATE_MAX |
| }; |
| |
| /** |
| * |
| */ |
| typedef void (C1::*FptPointer)(); |
| |
| /** |
| * |
| */ |
| enum EventId_t { |
| /** |
| * |
| */ |
| EV_MYOPERATION_1_ID, |
| /** |
| * |
| */ |
| COMPLETIONEVENT_ID |
| }; |
| |
| /** |
| * |
| */ |
| BooleanType MyOperation_2_state; |
| |
| /** |
| * |
| */ |
| Integer index = 0; |
| |
| /** |
| * |
| */ |
| String instanceName = "C1"; |
| |
| /** |
| * |
| */ |
| SystemStateEnum_t systemState; |
| |
| /** |
| * |
| */ |
| ::TestTrace::Classes::Package_A1::Package_C1::C1::State_t states[2]; |
| |
| /** |
| * |
| */ |
| ::TestTrace::Classes::Package_A1::Package_C1::C1::StateIDEnum activeStateID; |
| |
| /** |
| * |
| */ |
| bool dispatchFlag=false; |
| |
| /** |
| * |
| */ |
| pthread_t threads[STATE_MAX]; |
| |
| /** |
| * |
| */ |
| bool flags[STATE_MAX]; |
| |
| /** |
| * |
| */ |
| pthread_cond_t conds[STATE_MAX]; |
| |
| /** |
| * |
| */ |
| pthread_mutex_t mutexes[STATE_MAX]; |
| |
| /** |
| * |
| */ |
| StructForThread_t threadStructs[STATE_MAX]; |
| |
| /** |
| * |
| */ |
| ::TestTrace::Classes::Package_A1::Package_C1::C1::FptPointer doActivityTable[STATE_MAX]; |
| |
| /** |
| * |
| */ |
| EventPriorityQueue eventQueue; |
| |
| /** |
| * |
| */ |
| Event_t *currentEvent; |
| |
| /** |
| * |
| */ |
| pthread_t dispatchThread; |
| |
| /** |
| * |
| */ |
| StructForThread_t dispatchStruct; |
| |
| /** |
| * |
| */ |
| pthread_mutex_t runToCompletionMutex; |
| |
| /** |
| * |
| */ |
| pthread_cond_t runToCompletionCond; |
| |
| /** |
| * |
| */ |
| void dispatchEvent(); |
| |
| /** |
| * |
| * @param state |
| */ |
| void MyOperation_1(BooleanType /*in*/state); |
| |
| /** |
| * |
| * @param enter_mode |
| */ |
| void StateMachine_Region1_Enter(char /*in*/enter_mode); |
| |
| /** |
| * |
| */ |
| C1(); |
| |
| /** |
| * |
| */ |
| void startBehavior(); |
| |
| /** |
| * |
| * @param sig |
| */ |
| void processEv_MyOperation_1(Sig_MyOperation_1 & /*in*/sig); |
| |
| /** |
| * |
| * @param sig |
| */ |
| void sendEv_MyOperation_1(Sig_MyOperation_1 & /*in*/sig); |
| |
| /** |
| * |
| */ |
| void processCompletionEvent(); |
| |
| /** |
| * |
| */ |
| void FirstState_entry(); |
| |
| /** |
| * |
| */ |
| void FirstState_exit(); |
| |
| /** |
| * |
| */ |
| void SecondState_entry(); |
| |
| /** |
| * |
| * @param data |
| * @return ret |
| */ |
| static void* thread_func_wrapper(void * /*in*/data); |
| |
| /** |
| * |
| * @param id |
| */ |
| void doCallActivity(int /*in*/id); |
| |
| /** |
| * |
| * @param id |
| * @param func_type |
| * @param value |
| */ |
| void setFlag(int /*in*/id, ThreadFunctions /*in*/func_type, |
| bool /*in*/value); |
| |
| /** |
| * |
| */ |
| void entry_dft(); |
| |
| /** |
| * |
| */ |
| void exit_dft(); |
| |
| /** |
| * |
| */ |
| void doActivity_dft(); |
| |
| /** |
| * |
| * @return ret |
| */ |
| I_MyInterface_1* get_listeningI_MyInterface_1(); |
| |
| }; |
| /************************************************************/ |
| /* External declarations (package visibility) */ |
| /************************************************************/ |
| |
| /* Inline functions */ |
| |
| } // of namespace Package_C1 |
| } // of namespace Package_A1 |
| } // of namespace Classes |
| } // of namespace TestTrace |
| |
| /************************************************************ |
| End of C1 class header |
| ************************************************************/ |
| |
| #endif |