CompileDES 3.14
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
18using 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
112class AttributeCodeGeneratorEvent : public AttributeVoid {
113
114FAUDES_TYPE_DECLARATION(AttributeCodeGeneratorEvent,AttributeCodeGeneratorEvent,AttributeVoid)
115
116public:
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
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
151
153 typedef struct {
155 std::string mAddress;
157 bool mPos;
159 bool mNeg;
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;
195
198
199 protected:
200
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
254typedef TaNameSet<AttributeCodeGeneratorEvent> cgEventSet;
255
256
257
258#endif
TaNameSet< AttributeCodeGeneratorEvent > cgEventSet
Convenience typedef: eventset with code-generator config attributes.
Event attributes for the purpose of code generation.
bool mNeg
Negative edge triggers event.
bool mExe
Evaluate literal expression to trigger event.
std::vector< InputTrigger > mTriggers
List of triggers (input events only)
virtual void DoRead(TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
TimeConstraint mTimeConstraint
Timer definition (indicate timer event iff mInitialValue non-empty)
bool mPos
Positive edge triggers event.
bool mStatic
Fake an initial edge on initialisation to sense static levels.
std::string mAddress
Abstract address.
virtual void Clear(void)
Clear to default.
std::vector< OutputAction > mActions
List of actions to perform (output events only)
std::string mAddress
Abstract address.
EventSet mResetEvents
Events that reset this timer.
virtual void DoWrite(TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
std::string mInitialValue
Initial value (literal to allow for advanced units, empty string for "not a timer")
virtual bool IsDefault(void) const
Test for default value (never)
AttributeCodeGeneratorEvent(const AttributeCodeGeneratorEvent &rOtherAttr)
Copy constructor.
AttributeCodeGeneratorEvent(void)
Default constructor (internal event)
EventSet mStopEvents
Events that stop this timer.
virtual AttributeCodeGeneratorEvent & DoAssign(const AttributeCodeGeneratorEvent &rSrcAttr)
EventSet mStartEvents
Events that start this timer.
Typedef for an individual trigger condition.
Typedef for an individual output action.
Typedef for timer specification (internal events only)