|
@@ -10,43 +10,73 @@ Templates for the main statechart cpp file.
|
|
|
«IMPORT stext»
|
|
|
«IMPORT sgraph»
|
|
|
|
|
|
+«EXTENSION org::yakindu::sct::generator::cpp::templates::Expression»
|
|
|
+«EXTENSION org::yakindu::sct::generator::cpp::templates::Naming»
|
|
|
+
|
|
|
+
|
|
|
+«DEFINE interfaces FOR ExecutionFlow»
|
|
|
+«EXPAND scope FOREACH this.scopes»
|
|
|
+«ENDDEFINE»
|
|
|
+
|
|
|
+«DEFINE scope FOR Scope -»
|
|
|
+«ENDDEFINE»
|
|
|
+
|
|
|
+«DEFINE scope FOR InterfaceScope»
|
|
|
+«EXPAND declaration FOREACH this.declarations»
|
|
|
+«ENDDEFINE»
|
|
|
+
|
|
|
+«DEFINE scope FOR InternalScope»
|
|
|
+«EXPAND declaration FOREACH this.declarations»
|
|
|
+«ENDDEFINE»
|
|
|
+
|
|
|
+«DEFINE declaration FOR Declaration -»
|
|
|
+ // unknown declaration «name»
|
|
|
+«ENDDEFINE»
|
|
|
+
|
|
|
+«DEFINE declaration FOR EventDefinition -»
|
|
|
+«ENDDEFINE»
|
|
|
+
|
|
|
+«DEFINE declaration FOR VariableDefinition -»
|
|
|
+ «type» «name»;
|
|
|
+«ENDDEFINE»
|
|
|
+
|
|
|
|
|
|
«DEFINE file FOR ExecutionFlow»
|
|
|
|
|
|
-«FILE 'MyDataRepository.h'»
|
|
|
-#ifndef MYDATAREPOSITORY_H_
|
|
|
-#define MYDATAREPOSITORY_H_
|
|
|
+«FILE DRName()+'.h'»
|
|
|
+#ifndef «DRNAME()»_H_
|
|
|
+#define «DRNAME()»_H_
|
|
|
|
|
|
#include "definition.h"
|
|
|
|
|
|
-class MyDataRepository {
|
|
|
-
|
|
|
- uint32_t var1; /* variable in the main region */
|
|
|
- uint32_t counter; /* counter in the main region */
|
|
|
- float sub_counter; /* counter in a sub region */
|
|
|
+class «DRName()» : public DataRepository {
|
|
|
|
|
|
- virtual void lock(){};
|
|
|
- virtual void unlock(){};
|
|
|
+«FOREACH this.declaredVariables() AS variable»
|
|
|
+ «((VariableDefinition)variable).type» «((VariableDefinition)variable).name»;
|
|
|
+«ENDFOREACH»
|
|
|
|
|
|
public:
|
|
|
|
|
|
- MyDataRepository() {};
|
|
|
- virtual ~MyDataRepository() {};
|
|
|
+ «DRName()»() {};
|
|
|
+ virtual ~«DRName()»() {};
|
|
|
|
|
|
- void init_data(uint32_t _var1, uint32_t _counter, float _sub_counter)
|
|
|
- { var1 = _var1; counter = _counter; sub_counter = _sub_counter; }
|
|
|
+// void init_data(uint32_t _var1, uint32_t _counter, float _sub_counter)
|
|
|
+// { var1 = _var1; counter = _counter; sub_counter = _sub_counter; }
|
|
|
|
|
|
- uint32_t get_var1() { uint32_t value; lock(); value=var1; unlock(); return(value); }
|
|
|
- uint32_t get_counter() { uint32_t value; lock(); value=counter; unlock(); return(value); }
|
|
|
- float get_sub_counter() { float value; lock(); value=sub_counter; unlock(); return(value); }
|
|
|
+
|
|
|
+«FOREACH this.declaredVariables() AS variable»
|
|
|
+ «((VariableDefinition)variable).type» get_«((VariableDefinition)variable).name»()
|
|
|
+ { «((VariableDefinition)variable).type» value; lock(); value = «((VariableDefinition)variable).name»; unlock(); return value; }
|
|
|
+«ENDFOREACH»
|
|
|
|
|
|
- void set_var1(const uint32_t value) { lock(); var1 = value; unlock(); }
|
|
|
- void set_counter(const uint32_t value) { lock(); counter = value; unlock(); }
|
|
|
- void set_sub_counter(const float value) { lock(); sub_counter = value; unlock(); }
|
|
|
+«FOREACH this.declaredVariables() AS variable»
|
|
|
+ void set_«((VariableDefinition)variable).name»(const «((VariableDefinition)variable).type»& value)
|
|
|
+ { lock(); «((VariableDefinition)variable).name» = value; unlock(); }
|
|
|
+«ENDFOREACH»
|
|
|
|
|
|
};
|
|
|
|
|
|
-#endif /* MYDATAREPOSITORY_H_ */
|
|
|
+#endif /* «DRNAME()»_H_ */
|
|
|
«ENDFILE»
|
|
|
|
|
|
«ENDDEFINE»
|