blob: 488a4c35809665ce9c612178e2a187d3801c04d8 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:C_Cpp="http://www.eclipse.org/papyrus/C_Cpp/1" xmlns:Deployment="http://www.eclipse.org/papyrus/Deployment/1" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:standard="http://www.eclipse.org/uml2/5.0.0/UML/Profile/Standard" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML">
<uml:Model xmi:id="_O6TiIDLUEd26WNosUASSSw" name="SimpleSM">
<packagedElement xmi:type="uml:Package" xmi:id="_BKDCRZnuEeeCzKHJj7Wq7w" name="deployment">
<packagedElement xmi:type="uml:Package" xmi:id="_BKDpWpnuEeeCzKHJj7Wq7w" name="SimpleSMDepPlan">
<packagedElement xmi:type="uml:InstanceSpecification" xmi:id="_GYJDwG-QEea89JTVlr8RHA" name="mainInstance" classifier="_oqZNUDLaEd2qeKRLMdIx_A"/>
</packagedElement>
</packagedElement>
<packagedElement xmi:type="uml:Package" xmi:id="_BKEQYZnuEeeCzKHJj7Wq7w" name="classes">
<packagedElement xmi:type="uml:Class" xmi:id="_oqZNUDLaEd2qeKRLMdIx_A" name="SimpleSM" classifierBehavior="_BKCbMpnuEeeCzKHJj7Wq7w">
<ownedComment xmi:id="_cb-ncDemEeGPyrZ5I3hMlA" annotatedElement="_oqZNUDLaEd2qeKRLMdIx_A">
<body>State-machine support is enabled with a container rule</body>
</ownedComment>
<ownedAttribute xmi:id="_BIzsIJnuEeeCzKHJj7Wq7w" name="systemState">
<type xmi:type="uml:Enumeration" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/statemachine.uml#_uYyt0CdFEea3Ob5UfxuCGA"/>
</ownedAttribute>
<ownedAttribute xmi:id="_BJH1MZnuEeeCzKHJj7Wq7w" name="states" type="_BJBulJnuEeeCzKHJj7Wq7w"/>
<ownedAttribute xmi:id="_BJNUwJnuEeeCzKHJj7Wq7w" name="activeStateID" type="_BJBukJnuEeeCzKHJj7Wq7w"/>
<ownedAttribute xmi:id="_BJTbYJnuEeeCzKHJj7Wq7w" name="dispatchFlag">
<type xmi:type="uml:PrimitiveType" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/AnsiCLibrary.uml#_vAIV4I7PEdySGvm5GN66HA"/>
</ownedAttribute>
<ownedAttribute xmi:id="_BJYT4JnuEeeCzKHJj7Wq7w" name="threads">
<type xmi:type="uml:Class" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/pthread.uml#_ea234NYGEd-CgJIavLpOxQ"/>
</ownedAttribute>
<ownedAttribute xmi:id="_BJbXMZnuEeeCzKHJj7Wq7w" name="flags">
<type xmi:type="uml:PrimitiveType" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/AnsiCLibrary.uml#_vAIV4I7PEdySGvm5GN66HA"/>
</ownedAttribute>
<ownedAttribute xmi:id="_BJdzcZnuEeeCzKHJj7Wq7w" name="conds">
<type xmi:type="uml:Class" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/pthread.uml#_-vYZoCa0EeazPcQ6-9hBeQ"/>
</ownedAttribute>
<ownedAttribute xmi:id="_BJhd0ZnuEeeCzKHJj7Wq7w" name="mutexes">
<type xmi:type="uml:Class" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/pthread.uml#__niwsCa0EeazPcQ6-9hBeQ"/>
</ownedAttribute>
<ownedAttribute xmi:id="_BJj6EZnuEeeCzKHJj7Wq7w" name="threadStructs">
<type xmi:type="uml:Class" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/statemachine.uml#_4Z1UwCmREearkPe7QerpcQ"/>
</ownedAttribute>
<ownedAttribute xmi:id="_BJtrEZnuEeeCzKHJj7Wq7w" name="doActivityTable" type="_BJrO0pnuEeeCzKHJj7Wq7w"/>
<ownedAttribute xmi:id="_BJwuZJnuEeeCzKHJj7Wq7w" name="timeEventTable" type="_BJrO0pnuEeeCzKHJj7Wq7w"/>
<ownedAttribute xmi:id="_BJzxsJnuEeeCzKHJj7Wq7w" name="timeEventThreads">
<type xmi:type="uml:Class" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/pthread.uml#_ea234NYGEd-CgJIavLpOxQ"/>
</ownedAttribute>
<ownedAttribute xmi:id="_BJ2N8JnuEeeCzKHJj7Wq7w" name="timeEventFlags">
<type xmi:type="uml:PrimitiveType" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/AnsiCLibrary.uml#_vAIV4I7PEdySGvm5GN66HA"/>
</ownedAttribute>
<ownedAttribute xmi:id="_BJ4qMZnuEeeCzKHJj7Wq7w" name="timeEventConds">
<type xmi:type="uml:Class" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/pthread.uml#_-vYZoCa0EeazPcQ6-9hBeQ"/>
</ownedAttribute>
<ownedAttribute xmi:id="_BJ7GcJnuEeeCzKHJj7Wq7w" name="timeEventMutexes">
<type xmi:type="uml:Class" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/pthread.uml#__niwsCa0EeazPcQ6-9hBeQ"/>
</ownedAttribute>
<ownedAttribute xmi:id="_BJ9isZnuEeeCzKHJj7Wq7w" name="timeEventThreadStructs">
<type xmi:type="uml:Class" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/statemachine.uml#_4Z1UwCmREearkPe7QerpcQ"/>
</ownedAttribute>
<ownedAttribute xmi:id="_BKAmAJnuEeeCzKHJj7Wq7w" name="eventQueue">
<type xmi:type="uml:Class" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/statemachine.uml#_dWxYQD0zEeaQfbTekb55bw"/>
</ownedAttribute>
<ownedAttribute xmi:id="_BKAmAZnuEeeCzKHJj7Wq7w" name="currentEvent">
<type xmi:type="uml:Class" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/statemachine.uml#_MyJIUD0zEeaQfbTekb55bw"/>
</ownedAttribute>
<ownedAttribute xmi:id="_BKDCQJnuEeeCzKHJj7Wq7w" name="dispatchThread">
<type xmi:type="uml:Class" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/pthread.uml#_ea234NYGEd-CgJIavLpOxQ"/>
</ownedAttribute>
<ownedAttribute xmi:id="_BKDCQZnuEeeCzKHJj7Wq7w" name="dispatchStruct">
<type xmi:type="uml:Class" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/statemachine.uml#_4Z1UwCmREearkPe7QerpcQ"/>
</ownedAttribute>
<ownedAttribute xmi:id="_BKDCQpnuEeeCzKHJj7Wq7w" name="runToCompletionMutex">
<type xmi:type="uml:Class" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/pthread.uml#__niwsCa0EeazPcQ6-9hBeQ"/>
</ownedAttribute>
<ownedAttribute xmi:id="_BKDCQ5nuEeeCzKHJj7Wq7w" name="runToCompletionCond">
<type xmi:type="uml:Class" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/pthread.uml#_-vYZoCa0EeazPcQ6-9hBeQ"/>
</ownedAttribute>
<interfaceRealization xmi:id="_bi6iwJlGEeejksbGg7yusw" client="_oqZNUDLaEd2qeKRLMdIx_A">
<supplier xmi:type="uml:Interface" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/sysinterfaces.uml#_PTWzwCS-Ed-A_I32T0fkaA"/>
<contract href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/sysinterfaces.uml#_PTWzwCS-Ed-A_I32T0fkaA"/>
</interfaceRealization>
<ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_BKCbMpnuEeeCzKHJj7Wq7w" name="dispatchEvent" specification="_BKCbMZnuEeeCzKHJj7Wq7w">
<language>C++</language>
<body>bool popDeferred = false;
while(true) {
//run-to-completion: need to have a mutex here
currentEvent = eventQueue.pop(popDeferred);
dispatchFlag = true;
if (currentEvent != NULL) {
SIMPLESM_GET_CONTROL
switch(currentEvent->eventID) {
case TE_VALUE_250_UNIT_MS__ID:
processTE_value_250_unit_ms_();
break;
case TE_VALUE_500_UNIT_MS__ID:
processTE_value_500_unit_ms_();
break;
case COMPLETIONEVENT_ID:
processCompletionEvent();
break;
}
if (systemState == statemachine::EVENT_DEFERRED) {
eventQueue.saveDeferred(*currentEvent);
}
popDeferred = (systemState != statemachine::EVENT_DEFERRED);
systemState = statemachine::IDLE;
SIMPLESM_RELEASE_CONTROL
}
}</body>
</ownedBehavior>
<ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_ML-4AKI5Ed6FqJCjEUrkqQ" name="add" specification="_TbIjUJYlEd6G9q9hwr11bw">
<ownedParameter xmi:id="_YUV30GkzEearUflqhq5Pgw" name="res" direction="return">
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_YUXF8GkzEearUflqhq5Pgw" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_YUYUEGkzEearUflqhq5Pgw" value="1"/>
</ownedParameter>
<language>C/C++</language>
<body>this->processCE_CServer_impl_add(a, b);
// original method code
cout &lt;&lt; &quot;a=&quot; &lt;&lt; a &lt;&lt; &quot; b=&quot; &lt;&lt; b &lt;&lt; &quot; a+b=&quot; &lt;&lt; a+b &lt;&lt; endl;
return a+b;</body>
</ownedBehavior>
<ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_YNCW4CgBEeapjr3l63b85A" name="run" specification="_VGsRACgBEeapjr3l63b85A">
<language>C/C++</language>
<body>cout &lt;&lt; &quot;call add (2, 3);&quot; &lt;&lt; endl;
cout &lt;&lt; &quot;result: &quot; &lt;&lt; add (2, 3) &lt;&lt; endl;
cout &lt;&lt; &quot;sleeping for 15 seconds (statemachine remains active);&quot; &lt;&lt; endl;
sleep(15);
</body>
</ownedBehavior>
<ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_BJN70pnuEeeCzKHJj7Wq7w" name="SMSimple_Region0_Enter" specification="_BJN70JnuEeeCzKHJj7Wq7w">
<language>C++</language>
<body>switch(enter_mode) {
case SMSIMPLE_REGION0_DEFAULT:
activeStateID = FLIP_ID;
setFlag(SIMPLESM_TE_INDEX(TE_VALUE_250_UNIT_MS__ID), statemachine::TF_TIME_EVENT, true);
//TODO: set systemState to EVENT_CONSUMED
break;
}</body>
</ownedBehavior>
<ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_BJS0UJnuEeeCzKHJj7Wq7w" name="SimpleSM" specification="_BJOi4JnuEeeCzKHJj7Wq7w">
<language>C++</language>
<body>startBehavior();</body>
</ownedBehavior>
<ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_BJS0UpnuEeeCzKHJj7Wq7w" name="startBehavior" specification="_BJS0UZnuEeeCzKHJj7Wq7w">
<language>C++</language>
<body>systemState = statemachine::IDLE;
doActivityTable[FLIP_ID] = states[FLIP_ID].doActivity;
doActivityTable[FLOP_ID] = states[FLOP_ID].doActivity;
// initialize all threads, the threads wait until the associated flag is set
for(int i = 0; i &lt; (int) STATE_MAX; i++) {
if (states[i].doActivity != &amp;SimpleSM::doActivity_dft) {
threadStructs[i].id = i;
threadStructs[i].ptr = this;
threadStructs[i].func_type = statemachine::TF_DO_ACTIVITY;
mutexes[i] = PTHREAD_MUTEX_INITIALIZER;
conds[i] = PTHREAD_COND_INITIALIZER;
pthread_create(&amp;threads[i], NULL, &amp;SimpleSM::thread_func_wrapper, &amp;threadStructs[i]);
}
}
timeEventThreadStructs[SIMPLESM_TE_INDEX(TE_VALUE_250_UNIT_MS__ID)].duration = 250;
timeEventThreadStructs[SIMPLESM_TE_INDEX(TE_VALUE_500_UNIT_MS__ID)].duration = 500;
for(int i = SIMPLESM_TIME_EVENT_LOWER_BOUND; i &lt; 2; i++) {
timeEventThreadStructs[SIMPLESM_TE_INDEX(i)].id = i;
timeEventThreadStructs[SIMPLESM_TE_INDEX(i)].ptr = this;
timeEventThreadStructs[SIMPLESM_TE_INDEX(i)].func_type = statemachine::TF_TIME_EVENT;
timeEventMutexes[SIMPLESM_TE_INDEX(i)] = PTHREAD_MUTEX_INITIALIZER;
timeEventConds[SIMPLESM_TE_INDEX(i)] = PTHREAD_COND_INITIALIZER;
pthread_create(&amp;timeEventThreads[SIMPLESM_TE_INDEX(i)], NULL, &amp;SimpleSM::thread_func_wrapper, &amp;timeEventThreadStructs[SIMPLESM_TE_INDEX(i)]);
while(timeEventFlags[SIMPLESM_TE_INDEX(i)]) {}
}
runToCompletionMutex = PTHREAD_MUTEX_INITIALIZER;
runToCompletionCond = PTHREAD_COND_INITIALIZER;
dispatchStruct = statemachine::StructForThread_t(this, 0, 0, statemachine::TF_STATE_MACHINE_TYPE, 0);
SimpleSM_THREAD_CREATE(dispatchThread, dispatchStruct)
while(!dispatchFlag) {}
//initialze root active state
//execute initial effect
SMSimple_Region0_Enter(SMSIMPLE_REGION0_DEFAULT);
</body>
</ownedBehavior>
<ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_BJTbYpnuEeeCzKHJj7Wq7w" name="processCE_CServer_impl_add" specification="_BJTbYZnuEeeCzKHJj7Wq7w">
<language>C++</language>
<body>SIMPLESM_GET_CONTROL
systemState = statemachine::EVENT_PROCESSING;
if (systemState == statemachine::EVENT_PROCESSING) {
switch(activeStateID) {
case FLIP_ID:
//from Flip to Flop
if (true) {
setFlag(SIMPLESM_TE_INDEX(TE_VALUE_250_UNIT_MS__ID), statemachine::TF_TIME_EVENT, false);
activeStateID = FLOP_ID;
//starting the counters for time events
setFlag(SIMPLESM_TE_INDEX(TE_VALUE_500_UNIT_MS__ID), statemachine::TF_TIME_EVENT, true);
systemState = statemachine::EVENT_CONSUMED;
}
break;
default:
//do nothing
break;
}
}
SIMPLESM_RELEASE_CONTROL
</body>
</ownedBehavior>
<ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_BJVQkJnuEeeCzKHJj7Wq7w" name="processTE_value_250_unit_ms_" specification="_BJUph5nuEeeCzKHJj7Wq7w">
<language>C++</language>
<body>systemState = statemachine::EVENT_PROCESSING;
if (systemState == statemachine::EVENT_PROCESSING) {
switch(activeStateID) {
case FLIP_ID:
//from Flip to Flop
if (true) {
setFlag(SIMPLESM_TE_INDEX(TE_VALUE_250_UNIT_MS__ID), statemachine::TF_TIME_EVENT, false);
std::cout &lt;&lt;&quot;From Flip to Flop&quot;
&lt;&lt; std::endl;
activeStateID = FLOP_ID;
//starting the counters for time events
setFlag(SIMPLESM_TE_INDEX(TE_VALUE_500_UNIT_MS__ID), statemachine::TF_TIME_EVENT, true);
systemState = statemachine::EVENT_CONSUMED;
}
break;
default:
//do nothing
break;
}
}
</body>
</ownedBehavior>
<ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_BJV3oJnuEeeCzKHJj7Wq7w" name="processTE_value_500_unit_ms_" specification="_BJVQkZnuEeeCzKHJj7Wq7w">
<language>C++</language>
<body>systemState = statemachine::EVENT_PROCESSING;
if (systemState == statemachine::EVENT_PROCESSING) {
switch(activeStateID) {
case FLOP_ID:
//from Flop to Flip
if (true) {
setFlag(SIMPLESM_TE_INDEX(TE_VALUE_500_UNIT_MS__ID), statemachine::TF_TIME_EVENT, false);
std::cout &lt;&lt;&quot;From Flop to Flip&quot; &lt;&lt; std::endl;
activeStateID = FLIP_ID;
//starting the counters for time events
setFlag(SIMPLESM_TE_INDEX(TE_VALUE_250_UNIT_MS__ID), statemachine::TF_TIME_EVENT, true);
systemState = statemachine::EVENT_CONSUMED;
}
break;
default:
//do nothing
break;
}
}
</body>
</ownedBehavior>
<ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_BJWesZnuEeeCzKHJj7Wq7w" name="processCompletionEvent" specification="_BJWesJnuEeeCzKHJj7Wq7w">
<language>C++</language>
<body>systemState = statemachine::EVENT_PROCESSING;
</body>
</ownedBehavior>
<ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_BJrO0ZnuEeeCzKHJj7Wq7w" name="thread_func_wrapper" specification="_BJmWUZnuEeeCzKHJj7Wq7w">
<language>C++</language>
<body>statemachine::StructForThread_t* cptr = (statemachine::StructForThread_t*)data;
SimpleSM* ptr = (SimpleSM*) cptr->ptr;
switch(cptr->func_type) {
case statemachine::TF_TIME_EVENT:
ptr->listenTimeEvent(SIMPLESM_TE_INDEX(cptr->id), cptr->duration);
break;
case statemachine::TF_STATE_MACHINE_TYPE:
ptr->dispatchEvent();
break;
}
return NULL;</body>
</ownedBehavior>
<ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_BJwHU5nuEeeCzKHJj7Wq7w" name="doCallActivity" specification="_BJwHUZnuEeeCzKHJj7Wq7w">
<language>C++</language>
<body>flags[id] = false;
while(true) {
pthread_mutex_lock(&amp;mutexes[id]);
while(!flags[id]) {
pthread_cond_wait(&amp;conds[id], &amp;mutexes[id]);
}
(this->*doActivityTable[id])();
bool commitEvent = false;
if (flags[id]) {
commitEvent = true;
flags[id] = false;
}
pthread_cond_signal(&amp;conds[id]);
pthread_mutex_unlock(&amp;mutexes[id]);
}</body>
</ownedBehavior>
<ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_BJwuY5nuEeeCzKHJj7Wq7w" name="setFlag" specification="_BJwHVJnuEeeCzKHJj7Wq7w">
<language>C++</language>
<body>//value = true => start activity
//value = false => stop activity
if (func_type == statemachine::TF_TIME_EVENT) {
pthread_mutex_lock(&amp;timeEventMutexes[SIMPLESM_TE_INDEX(id)]);
timeEventFlags[SIMPLESM_TE_INDEX(id)] = value;
pthread_cond_signal(&amp;timeEventConds[SIMPLESM_TE_INDEX(id)]);
pthread_mutex_unlock(&amp;timeEventMutexes[SIMPLESM_TE_INDEX(id)]);
return;
}
if (func_type == statemachine::TF_DO_ACTIVITY) {
}
</body>
</ownedBehavior>
<ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_BJ_-9JnuEeeCzKHJj7Wq7w" name="listenTimeEvent" specification="_BJ_-8ZnuEeeCzKHJj7Wq7w">
<language>C++</language>
<body>struct timeval tv;
struct timespec ts;
int timedWaitResult;
while(true) {
pthread_mutex_lock(&amp;timeEventMutexes[id]);
while(!timeEventFlags[id]) {
pthread_cond_wait(&amp;timeEventConds[id], &amp;timeEventMutexes[id]);
}
gettimeofday(&amp;tv, NULL);
ts.tv_sec = time(NULL) + duration / 1000;
ts.tv_nsec = tv.tv_usec * 1000 + 1000 * 1000 * (duration % 1000);
ts.tv_sec += ts.tv_nsec / (1000 * 1000 * 1000);
ts.tv_nsec %= (1000 * 1000 * 1000);
timedWaitResult = pthread_cond_timedwait(&amp;timeEventConds[id], &amp;timeEventMutexes[id], &amp;ts);
bool commitEvent = false;
if (timedWaitResult != 0) {
//timeout
commitEvent = true;
}
timeEventFlags[id] = false;
pthread_cond_signal(&amp;timeEventConds[id]);
pthread_mutex_unlock(&amp;timeEventMutexes[id]);
if (commitEvent) {
//the state does not change, push time event to the queue
eventQueue.push(statemachine::PRIORITY_2, NULL, id, statemachine::TIME_EVENT, id);
}
}</body>
</ownedBehavior>
<ownedOperation xmi:id="_BKCbMZnuEeeCzKHJj7Wq7w" name="dispatchEvent" method="_BKCbMpnuEeeCzKHJj7Wq7w"/>
<ownedOperation xmi:id="_TbIjUJYlEd6G9q9hwr11bw" name="add" method="_ML-4AKI5Ed6FqJCjEUrkqQ">
<ownedParameter xmi:id="_guLbIGk0EearUflqhq5Pgw" name="a">
<type xmi:type="uml:PrimitiveType" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/PrimitiveTypes.uml#Integer"/>
</ownedParameter>
<ownedParameter xmi:id="_hTr78Gk0EearUflqhq5Pgw" name="b">
<type xmi:type="uml:PrimitiveType" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/PrimitiveTypes.uml#Integer"/>
</ownedParameter>
<ownedParameter xmi:id="_YN7GwGkzEearUflqhq5Pgw" name="res" direction="return">
<type xmi:type="uml:PrimitiveType" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/PrimitiveTypes.uml#Integer"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_YOFe0GkzEearUflqhq5Pgw" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_YOGs8GkzEearUflqhq5Pgw" value="1"/>
</ownedParameter>
</ownedOperation>
<ownedOperation xmi:id="_VGsRACgBEeapjr3l63b85A" name="run" method="_YNCW4CgBEeapjr3l63b85A"/>
<ownedOperation xmi:id="_BJN70JnuEeeCzKHJj7Wq7w" name="SMSimple_Region0_Enter" method="_BJN70pnuEeeCzKHJj7Wq7w">
<ownedParameter xmi:id="_BJN70ZnuEeeCzKHJj7Wq7w" name="enter_mode">
<type xmi:type="uml:PrimitiveType" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/AnsiCLibrary.uml#_5lVhgBydEduyofBvg4RL2w"/>
</ownedParameter>
</ownedOperation>
<ownedOperation xmi:id="_BJOi4JnuEeeCzKHJj7Wq7w" name="SimpleSM" method="_BJS0UJnuEeeCzKHJj7Wq7w"/>
<ownedOperation xmi:id="_BJS0UZnuEeeCzKHJj7Wq7w" name="startBehavior" method="_BJS0UpnuEeeCzKHJj7Wq7w"/>
<ownedOperation xmi:id="_BJTbYZnuEeeCzKHJj7Wq7w" name="processCE_CServer_impl_add" method="_BJTbYpnuEeeCzKHJj7Wq7w">
<ownedParameter xmi:id="_BJUCcJnuEeeCzKHJj7Wq7w" name="a">
<type xmi:type="uml:PrimitiveType" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/PrimitiveTypes.uml#Integer"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_BJUCcZnuEeeCzKHJj7Wq7w" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_BJUpgJnuEeeCzKHJj7Wq7w" value="1"/>
</ownedParameter>
<ownedParameter xmi:id="_BJUpgZnuEeeCzKHJj7Wq7w" name="b">
<type xmi:type="uml:PrimitiveType" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/PrimitiveTypes.uml#Integer"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_BJUpgpnuEeeCzKHJj7Wq7w" value="1"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_BJUpg5nuEeeCzKHJj7Wq7w" value="1"/>
</ownedParameter>
</ownedOperation>
<ownedOperation xmi:id="_BJUph5nuEeeCzKHJj7Wq7w" name="processTE_value_250_unit_ms_" method="_BJVQkJnuEeeCzKHJj7Wq7w"/>
<ownedOperation xmi:id="_BJVQkZnuEeeCzKHJj7Wq7w" name="processTE_value_500_unit_ms_" method="_BJV3oJnuEeeCzKHJj7Wq7w"/>
<ownedOperation xmi:id="_BJWesJnuEeeCzKHJj7Wq7w" name="processCompletionEvent" method="_BJWesZnuEeeCzKHJj7Wq7w"/>
<ownedOperation xmi:id="_BJmWUZnuEeeCzKHJj7Wq7w" name="thread_func_wrapper" isStatic="true" method="_BJrO0ZnuEeeCzKHJj7Wq7w">
<ownedParameter xmi:id="_BJmWUpnuEeeCzKHJj7Wq7w" name="data">
<type xmi:type="uml:PrimitiveType" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/AnsiCLibrary.uml#_8I6RgBydEduyofBvg4RL2w"/>
</ownedParameter>
<ownedParameter xmi:id="_BJoykZnuEeeCzKHJj7Wq7w" name="ret" direction="return">
<type xmi:type="uml:PrimitiveType" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/AnsiCLibrary.uml#_8I6RgBydEduyofBvg4RL2w"/>
</ownedParameter>
</ownedOperation>
<ownedOperation xmi:id="_BJwHUZnuEeeCzKHJj7Wq7w" name="doCallActivity" method="_BJwHU5nuEeeCzKHJj7Wq7w">
<ownedParameter xmi:id="_BJwHUpnuEeeCzKHJj7Wq7w" name="id">
<type xmi:type="uml:PrimitiveType" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/AnsiCLibrary.uml#_7wRIABydEduyofBvg4RL2w"/>
</ownedParameter>
</ownedOperation>
<ownedOperation xmi:id="_BJwHVJnuEeeCzKHJj7Wq7w" name="setFlag" method="_BJwuY5nuEeeCzKHJj7Wq7w">
<ownedParameter xmi:id="_BJwuYJnuEeeCzKHJj7Wq7w" name="id">
<type xmi:type="uml:PrimitiveType" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/AnsiCLibrary.uml#_7wRIABydEduyofBvg4RL2w"/>
</ownedParameter>
<ownedParameter xmi:id="_BJwuYZnuEeeCzKHJj7Wq7w" name="func_type">
<type xmi:type="uml:PrimitiveType" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/AnsiCLibrary.uml#_5lVhgBydEduyofBvg4RL2w"/>
</ownedParameter>
<ownedParameter xmi:id="_BJwuYpnuEeeCzKHJj7Wq7w" name="value">
<type xmi:type="uml:PrimitiveType" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/AnsiCLibrary.uml#_vAIV4I7PEdySGvm5GN66HA"/>
</ownedParameter>
</ownedOperation>
<ownedOperation xmi:id="_BJ_-8ZnuEeeCzKHJj7Wq7w" name="listenTimeEvent" method="_BJ_-9JnuEeeCzKHJj7Wq7w">
<ownedParameter xmi:id="_BJ_-8pnuEeeCzKHJj7Wq7w" name="id">
<type xmi:type="uml:PrimitiveType" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/AnsiCLibrary.uml#_7wRIABydEduyofBvg4RL2w"/>
</ownedParameter>
<ownedParameter xmi:id="_BJ_-85nuEeeCzKHJj7Wq7w" name="duration">
<type xmi:type="uml:PrimitiveType" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/AnsiCLibrary.uml#_7wRIABydEduyofBvg4RL2w"/>
</ownedParameter>
</ownedOperation>
<ownedOperation xmi:id="_BJBukZnuEeeCzKHJj7Wq7w" name="entry_dft"/>
<ownedOperation xmi:id="_BJBukpnuEeeCzKHJj7Wq7w" name="exit_dft"/>
<ownedOperation xmi:id="_BJBuk5nuEeeCzKHJj7Wq7w" name="doActivity_dft"/>
<nestedClassifier xmi:type="uml:PrimitiveType" xmi:id="_BJBulJnuEeeCzKHJj7Wq7w" name="State_t"/>
<nestedClassifier xmi:type="uml:Enumeration" xmi:id="_BJBukJnuEeeCzKHJj7Wq7w" name="StateIDEnum">
<ownedLiteral xmi:id="_BJXFwJnuEeeCzKHJj7Wq7w" name="FLIP_ID"/>
<ownedLiteral xmi:id="_BJXFwZnuEeeCzKHJj7Wq7w" name="FLOP_ID"/>
<ownedLiteral xmi:id="_BJXFwpnuEeeCzKHJj7Wq7w" name="STATE_MAX"/>
</nestedClassifier>
<nestedClassifier xmi:type="uml:PrimitiveType" xmi:id="_BJrO0pnuEeeCzKHJj7Wq7w" name="FptPointer"/>
<nestedClassifier xmi:type="uml:Enumeration" xmi:id="_BI_5YZnuEeeCzKHJj7Wq7w" name="EventId_t">
<ownedLiteral xmi:id="_BJAgcJnuEeeCzKHJj7Wq7w" name="TE_VALUE_250_UNIT_MS__ID"/>
<ownedLiteral xmi:id="_BJAgcZnuEeeCzKHJj7Wq7w" name="TE_VALUE_500_UNIT_MS__ID"/>
<ownedLiteral xmi:id="_BJBHgJnuEeeCzKHJj7Wq7w" name="CE_CSERVER_IMPL_ADD_ID"/>
<ownedLiteral xmi:id="_BJBHgZnuEeeCzKHJj7Wq7w" name="COMPLETIONEVENT_ID"/>
</nestedClassifier>
</packagedElement>
<packagedElement xmi:type="uml:Dependency" xmi:id="_BIzsIZnuEeeCzKHJj7Wq7w" client="_oqZNUDLaEd2qeKRLMdIx_A">
<supplier xmi:type="uml:Enumeration" href="/SimpleSM_defaultNode_SimpleSMDepPlan/model/statemachine.uml#_hNs5oCdSEea6h5xPEh8iAg"/>
</packagedElement>
<packagedElement xmi:type="uml:Dependency" xmi:id="_BJH1MJnuEeeCzKHJj7Wq7w" client="_BJBulJnuEeeCzKHJj7Wq7w" supplier="_BJBukJnuEeeCzKHJj7Wq7w"/>
</packagedElement>
<profileApplication xmi:id="_O6TiIjLUEd26WNosUASSSw">
<eAnnotations xmi:id="_O6TiIzLUEd26WNosUASSSw" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/uml2/5.0.0/UML/Profile/Standard#/"/>
</eAnnotations>
<appliedProfile href="pathmap://UML_PROFILES/Standard.profile.uml#_0"/>
</profileApplication>
<profileApplication xmi:id="_GcC0cAHtEd6HSdiss9GQ0A">
<eAnnotations xmi:id="_Gd1kMAHtEd6HSdiss9GQ0A" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/C_Cpp/1#/"/>
</eAnnotations>
<appliedProfile href="pathmap://PapyrusC_Cpp_PROFILES/C_Cpp.profile.uml#_j9REUByGEduN1bTiWJ0lyw"/>
</profileApplication>
<profileApplication xmi:id="_zi-sUE2sEeGl8qrc8BM7vA">
<eAnnotations xmi:id="_0QJUUE2sEeGl8qrc8BM7vA" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/MARTE/1#//MARTE_Foundations/Alloc"/>
</eAnnotations>
<appliedProfile href="pathmap://Papyrus_PROFILES/MARTE.profile.uml#_ar8OsAPMEdyuUt-4qHuVvQ"/>
</profileApplication>
<profileApplication xmi:id="_YPbKAFl5EeagP584YGQRWg">
<eAnnotations xmi:id="_YPc_MFl5EeagP584YGQRWg" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/Transformation/1#/"/>
</eAnnotations>
<appliedProfile href="pathmap://TRAFO_PROFILE/Transformation.profile.uml#_fPDsIBa-EearhdjjJ6cVzQ"/>
</profileApplication>
<profileApplication xmi:id="_1qZk0Fl6EeaMOsb_YMu4Rg">
<eAnnotations xmi:id="_1qhgoFl6EeaMOsb_YMu4Rg" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/papyrus/Deployment/1#/"/>
</eAnnotations>
<appliedProfile href="pathmap://DEP_PROFILE/Deployment.profile.uml#_gPDsIBa-EearhdjjJ6cVzQ"/>
</profileApplication>
<profileApplication xmi:id="_BI0TMJnuEeeCzKHJj7Wq7w">
<eAnnotations xmi:id="_BI0TMZnuEeeCzKHJj7Wq7w" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="http://www.eclipse.org/uml2/5.0.0/UML/Profile/Standard#/"/>
</eAnnotations>
<appliedProfile href="pathmap://UML_PROFILES/Standard.profile.uml#_0"/>
</profileApplication>
</uml:Model>
<Deployment:DeploymentPlan xmi:id="_BKEQYJnuEeeCzKHJj7Wq7w" base_Package="_BKDpWpnuEeeCzKHJj7Wq7w"/>
<C_Cpp:Include xmi:id="_BKEQZJnuEeeCzKHJj7Wq7w" body="#include &lt;iostream>&#xA;using namespace std;&#xA;&#xA;#include &lt;unistd.h>&#xA;" header="#define SIMPLESM_TIME_EVENT_LOWER_BOUND (0)&#xA;#define SIMPLESM_CHANGE_EVENT_LOWER_BOUND (2)&#xA;#define SIMPLESM_TE_INDEX(id) (id - SIMPLESM_TIME_EVENT_LOWER_BOUND)&#xA;#define SIMPLESM_CHE_INDEX(id) (id - SIMPLESM_CHANGE_EVENT_LOWER_BOUND)&#xA;#define SMSIMPLE_REGION0_DEFAULT (0)&#xA;#define SMSIMPLE_REGION0 (0)&#xA;#include &quot;time.h&quot;&#xA;#include &quot;pthread.h&quot;&#xA;#include &quot;time.h&quot;&#xA;&#x9;&#x9;#include &quot;sys/time.h&quot;&#xA;#define CHECKPOINT if (systemState == statemachine::EVENT_PROCESSING) {return;}&#xA;#define SimpleSM_THREAD_CREATE(thThread, str) pthread_create(&amp;thThread, NULL, &amp;SimpleSM::thread_func_wrapper, &amp;str);&#xA;#define SIMPLESM_GET_CONTROL /*mutex synchronization to protect run-to-completion semantics*/ \&#xA;&#x9;&#x9;pthread_mutex_lock(&amp;runToCompletionMutex); \&#xA;&#x9;&#x9;while (systemState != statemachine::IDLE) {\&#xA;&#x9;&#x9;&#x9;pthread_cond_wait(&amp;runToCompletionCond, &amp;runToCompletionMutex);\&#xA;&#x9;&#x9;}&#xA;#define SIMPLESM_RELEASE_CONTROL systemState = statemachine::IDLE; pthread_cond_signal(&amp;runToCompletionCond); \&#xA;&#x9;&#x9;&#x9;&#x9;pthread_mutex_unlock(&amp;runToCompletionMutex);" base_class="_oqZNUDLaEd2qeKRLMdIx_A"/>
<C_Cpp:Typedef xmi:id="_BKJI4JnuEeeCzKHJj7Wq7w" definition="struct State_t {&#xA;&#x9;//1 is configured as the maximum number of orthogonal regions a composite states can have&#xA;&#x9;unsigned int /*StateIDEnum*/ previousStates[1]; //for history states&#xA;&#x9;unsigned int /*StateIDEnum*/ actives[1];&#xA;&#x9;void (SimpleSM::*entry)();&#xA;&#x9;void (SimpleSM::*exit)();&#xA;&#x9;void (SimpleSM::*doActivity)();&#xA;&#x9;State_t() {&#xA;&#x9;&#x9;entry = &amp;SimpleSM::entry_dft;&#xA;&#x9;&#x9;exit = &amp;SimpleSM::exit_dft;&#xA;&#x9;&#x9;doActivity = &amp;SimpleSM::doActivity_dft;&#xA;&#x9;&#x9;for(int i = 0; i &lt; 1; i++) {&#xA;&#x9;&#x9;&#x9;previousStates[i] = STATE_MAX;&#xA;&#x9;&#x9;&#x9;actives[i] = STATE_MAX;&#xA;&#x9;&#x9;}&#xA;&#x9;}&#xA;} " base_primitivetype="_BJBulJnuEeeCzKHJj7Wq7w"/>
<C_Cpp:Array xmi:id="_BKJI4ZnuEeeCzKHJj7Wq7w" definition="[2]" base_property="_BJH1MZnuEeeCzKHJj7Wq7w"/>
<C_Cpp:Array xmi:id="_BKLlIpnuEeeCzKHJj7Wq7w" definition="[STATE_MAX]" base_property="_BJYT4JnuEeeCzKHJj7Wq7w"/>
<C_Cpp:Array xmi:id="_BKMMMJnuEeeCzKHJj7Wq7w" definition="[STATE_MAX]" base_property="_BJbXMZnuEeeCzKHJj7Wq7w"/>
<C_Cpp:Array xmi:id="_BKMzQZnuEeeCzKHJj7Wq7w" definition="[STATE_MAX]" base_property="_BJdzcZnuEeeCzKHJj7Wq7w"/>
<C_Cpp:Array xmi:id="_BKNaUZnuEeeCzKHJj7Wq7w" definition="[STATE_MAX]" base_property="_BJhd0ZnuEeeCzKHJj7Wq7w"/>
<C_Cpp:Array xmi:id="_BKSS0pnuEeeCzKHJj7Wq7w" definition="[STATE_MAX]" base_property="_BJj6EZnuEeeCzKHJj7Wq7w"/>
<C_Cpp:Typedef xmi:id="_BKS54ZnuEeeCzKHJj7Wq7w" definition="void (SimpleSM::*typeName)()" base_primitivetype="_BJrO0pnuEeeCzKHJj7Wq7w"/>
<C_Cpp:Array xmi:id="_BKTg8JnuEeeCzKHJj7Wq7w" definition="[STATE_MAX]" base_property="_BJtrEZnuEeeCzKHJj7Wq7w"/>
<C_Cpp:Array xmi:id="_BKTg8pnuEeeCzKHJj7Wq7w" definition="[2]" base_property="_BJwuZJnuEeeCzKHJj7Wq7w"/>
<C_Cpp:Array xmi:id="_BKUIAJnuEeeCzKHJj7Wq7w" definition="[2]" base_property="_BJzxsJnuEeeCzKHJj7Wq7w"/>
<C_Cpp:Array xmi:id="_BKUIApnuEeeCzKHJj7Wq7w" definition="[2]" base_property="_BJ2N8JnuEeeCzKHJj7Wq7w"/>
<C_Cpp:Array xmi:id="_BKUvEJnuEeeCzKHJj7Wq7w" definition="[2]" base_property="_BJ4qMZnuEeeCzKHJj7Wq7w"/>
<C_Cpp:Array xmi:id="_BKUvEpnuEeeCzKHJj7Wq7w" definition="[2]" base_property="_BJ7GcJnuEeeCzKHJj7Wq7w"/>
<C_Cpp:Array xmi:id="_BKVWIJnuEeeCzKHJj7Wq7w" definition="[2]" base_property="_BJ9isZnuEeeCzKHJj7Wq7w"/>
<C_Cpp:Ptr xmi:id="_BKg8UJnuEeeCzKHJj7Wq7w" base_property="_BKAmAZnuEeeCzKHJj7Wq7w"/>
<standard:Create xmi:id="_BKpfMJnuEeeCzKHJj7Wq7w" base_BehavioralFeature="_BJOi4JnuEeeCzKHJj7Wq7w"/>
<C_Cpp:Ptr xmi:id="_BKr7cJnuEeeCzKHJj7Wq7w" base_parameter="_BJmWUpnuEeeCzKHJj7Wq7w"/>
<C_Cpp:Ptr xmi:id="_BKr7cpnuEeeCzKHJj7Wq7w" base_parameter="_BJoykZnuEeeCzKHJj7Wq7w"/>
</xmi:XMI>