CompileDES  3.12
Executable-Code Generation from Synchronised libFAUDES Automata
cgp_eventconfig.h
Go to the documentation of this file.
1 
4 /*
5  FAU Discrete Event Systems Library (libFAUDES)
6 
7  Copyright (C) 2010, 2016 Thomas Moor
8 
9 */
10 
11 
12 
13 #ifndef FAUDES_CGP_EVENTCONF_H
14 #define FAUDES_CGP_EVENTCONF_H
15 
16 #include "libfaudes.h"
17 
18 using namespace faudes;
19 
20 
21 //#define FAUDES_DEBUG_CODEGEN
22 
23 // debugging
24 #ifdef FAUDES_DEBUG_CODEGEN
25 #define FD_DCG(message) FAUDES_WRITE_CONSOLE("FAUDES_CODEGENERATOR: " << message)
26 #else
27 #define FD_DCG(message)
28 #endif
29 
30 
112 class AttributeCodeGeneratorEvent : public AttributeVoid {
113 
114 FAUDES_TYPE_DECLARATION(AttributeCodeGeneratorEvent,AttributeCodeGeneratorEvent,AttributeVoid)
115 
116 public:
117 
119  AttributeCodeGeneratorEvent(void) : AttributeVoid() { mType=ETInternal; mPriority=0;};
120 
122  AttributeCodeGeneratorEvent (const AttributeCodeGeneratorEvent& rOtherAttr) : AttributeVoid()
123  { DoAssign(rOtherAttr); };
124 
126  virtual bool IsDefault(void) const { return false;};
127 
129  virtual void Clear(void);
130 
132  typedef enum { ETInput, ETOutput, ETInternal } EventType;
133 
135  EventType mType;
136 
138  bool Input(void) const { return mType == ETInput;};
139 
141  bool Output(void) const { return mType == ETOutput;};
142 
144  bool Internal(void) const { return mType == ETInternal;};
145 
147  bool Timer(void) const { return (mType == ETInternal) && (mTimeConstraint.mInitialValue != "");};
148 
150  Int mPriority;
151 
153  typedef struct {
155  std::string mAddress;
157  bool mPos;
159  bool mNeg;
161  bool mStatic;
163  bool mExe;
164  } InputTrigger;
165 
167  std::vector<InputTrigger> mTriggers;
168 
170  typedef struct {
172  std::string mAddress;
174  bool mSet;
176  bool mClr;
178  bool mExe;
179  } OutputAction;
180 
182  std::vector<OutputAction> mActions;
183 
185  typedef struct {
187  std::string mInitialValue;
189  EventSet mStartEvents;
191  EventSet mStopEvents;
193  EventSet mResetEvents;
194  } TimeConstraint;
195 
198 
199  protected:
200 
209  virtual AttributeCodeGeneratorEvent& DoAssign(const AttributeCodeGeneratorEvent& rSrcAttr);
210 
229  virtual void DoRead(TokenReader& rTr,const std::string& rLabel="", const Type* pContext=0);
230 
231 
249  virtual void DoWrite(TokenWriter& rTw,const std::string& rLabel="", const Type* pContext=0) const;
250 
251 };
252 
254 typedef TaNameSet<AttributeCodeGeneratorEvent> cgEventSet;
255 
256 
257 
258 #endif
EventSet mStartEvents
Events that start this timer.
std::string mAddress
Abstract address.
virtual bool IsDefault(void) const
Test for default value (never)
Event attributes for the purpose of code generation.
TimeConstraint mTimeConstraint
Timer definition (indicate timer event iff mInitialValue non-empty)
EventSet mResetEvents
Events that reset this timer.
std::string mAddress
Abstract address.
bool mNeg
Negative edge triggers event.
std::vector< InputTrigger > mTriggers
List of triggers (input events only)
bool mStatic
Fake an initial edge on initialisation to sense static levels.
TaNameSet< AttributeCodeGeneratorEvent > cgEventSet
Convenience typedef: eventset with code-generator config attributes.
AttributeCodeGeneratorEvent(void)
Default constructor (internal event)
bool mExe
Evaluate literal expression to trigger event.
AttributeCodeGeneratorEvent(const AttributeCodeGeneratorEvent &rOtherAttr)
Copy constructor.
bool mPos
Positive edge triggers event.
std::vector< OutputAction > mActions
List of actions to perform (output events only)
EventSet mStopEvents
Events that stop this timer.
Typedef for timer specification (internal events only)
Typedef for an individual trigger condition.
Typedef for an individual output action.
std::string mInitialValue
Initial value (literal to allow for advanced units, empty string for "not a timer") ...