blob: 1b352d07ce47c9a42d03813bb188231139a2ce9e [file] [log] [blame]
// --------------------------------------------------------
// Code generated by Papyrus C++
// --------------------------------------------------------
#ifndef TESTTRACE_CLASSES_PACKAGE_A1_PACKAGE_E1_E1_H
#define TESTTRACE_CLASSES_PACKAGE_A1_PACKAGE_E1_E1_H
/************************************************************
E1 class header
************************************************************/
#include "TestTrace/Classes/Package_A1/Package_E1/Pkg_Package_E1.h"
#include "AnsiCLibrary/Pkg_AnsiCLibrary.h"
#include "TestTrace/Types/MyComplexType_1.h"
#include "TestTrace/Types/MyComplexType_2.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 E1_TIME_EVENT_LOWER_BOUND (0)
#define E1_CHANGE_EVENT_LOWER_BOUND (1)
#define E1_TE_INDEX(id) (id - E1_TIME_EVENT_LOWER_BOUND)
#define E1_CHE_INDEX(id) (id - E1_CHANGE_EVENT_LOWER_BOUND)
#define STATEMACHINE_REGION1_DEFAULT (0)
#define STATEMACHINE_REGION1 (0)
#include "time.h"
#include "pthread.h"
#include "time.h"
#include "sys/time.h"
#define E1_THREAD_CREATE(thThread, str) pthread_create(&thThread, NULL, &E1::thread_func_wrapper, &str);
#define E1_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 E1_RELEASE_CONTROL systemState = statemachine::SystemStateEnum_t::IDLE; pthread_cond_signal(&runToCompletionCond); \
pthread_mutex_unlock(&runToCompletionMutex);
// End of Include stereotype (header)
namespace TestTrace {
namespace Interfaces {
class Broadcast_I_MyInterface_1;
}
}
namespace TestTrace {
namespace Interfaces {
class Broadcast_I_MyInterface_2;
}
}
namespace TestTrace {
namespace Interfaces {
class I_MyInterface_1;
}
}
namespace TestTrace {
namespace Interfaces {
class I_MyInterface_2;
}
}
namespace statemachine {
class Event_t;
}
// derived using directives
using namespace AnsiCLibrary;
using namespace TestTrace::Interfaces;
using namespace TestTrace::Types;
using namespace statemachine;
namespace TestTrace {
namespace Classes {
namespace Package_A1 {
namespace Package_E1 {
/************************************************************/
/**
*
*/
class E1 {
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 (E1::*entry)();
void (E1::*exit)();
void (E1::*doActivity)();
State_t() {
entry = &E1::entry_dft;
exit = &E1::exit_dft;
doActivity = &E1::doActivity_dft;
for (int i = 0; i < 1; i++) {
previousStates[i] = STATE_MAX;
actives[i] = STATE_MAX;
}
}
} State_t;
/**
*
*/
enum StateIDEnum {
/**
*
*/
FIRSTSTATE_ID,
/**
*
*/
STATE_MAX
};
/**
*
*/
typedef void (E1::*FptPointer)();
/**
*
*/
enum EventId_t {
/**
*
*/
TIMEEVENT1_ID,
/**
*
*/
COMPLETIONEVENT_ID
};
/**
*
*/
MyComplexType_1 myDataVar;
/**
*
*/
MyComplexType_2 myData2Var;
/**
*
*/
MyEnumeration myEnumVar;
/**
*
*/
Integer myIntVar;
/**
*
*/
Double myDoubleVar;
/**
*
*/
Text myTextVar;
/**
*
*/
SystemStateEnum_t systemState;
/**
*
*/
::TestTrace::Classes::Package_A1::Package_E1::E1::State_t states[1];
/**
*
*/
::TestTrace::Classes::Package_A1::Package_E1::E1::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_E1::E1::FptPointer doActivityTable[STATE_MAX];
/**
*
*/
::TestTrace::Classes::Package_A1::Package_E1::E1::FptPointer timeEventTable[1];
/**
*
*/
pthread_t timeEventThreads[1];
/**
*
*/
bool timeEventFlags[1] = { false };
/**
*
*/
pthread_cond_t timeEventConds[1];
/**
*
*/
pthread_mutex_t timeEventMutexes[1];
/**
*
*/
StructForThread_t timeEventThreadStructs[1];
/**
*
*/
EventPriorityQueue eventQueue;
/**
*
*/
Event_t *currentEvent;
/**
*
*/
pthread_t dispatchThread;
/**
*
*/
StructForThread_t dispatchStruct;
/**
*
*/
pthread_mutex_t runToCompletionMutex;
/**
*
*/
pthread_cond_t runToCompletionCond;
/**
*
*/
Broadcast_I_MyInterface_1 *broadcastI_MyInterface_1=NULL;
/**
*
*/
Broadcast_I_MyInterface_2 *broadcastI_MyInterface_2=NULL;
/**
*
*/
void dispatchEvent();
/**
*
* @param enter_mode
*/
void StateMachine_Region1_Enter(char /*in*/enter_mode);
/**
*
*/
E1();
/**
*
*/
void startBehavior();
/**
*
*/
void processtimeEvent1();
/**
*
*/
void processCompletionEvent();
/**
*
* @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);
/**
*
* @param id
* @param duration
*/
void listenTimeEvent(int /*in*/id, int /*in*/duration);
/**
*
*/
void entry_dft();
/**
*
*/
void exit_dft();
/**
*
*/
void doActivity_dft();
/**
*
* @param ref
*/
void connect_broadcastI_MyInterface_1(I_MyInterface_1 * /*in*/ref);
/**
*
* @param ref
*/
void connect_broadcastI_MyInterface_2(I_MyInterface_2 * /*in*/ref);
};
/************************************************************/
/* External declarations (package visibility) */
/************************************************************/
/* Inline functions */
} // of namespace Package_E1
} // of namespace Package_A1
} // of namespace Classes
} // of namespace TestTrace
/************************************************************
End of E1 class header
************************************************************/
#endif