tp_attributes.h
Go to the documentation of this file.
1 /** @file tp_attributes.h Attributes for timed automata */
2 
3 
4 /* Timeplugin for FAU Discrete Event Systems Library (libfaudes)
5 
6 Copyright (C) 2006 Berno Schlein
7 Copyright (C) 2007 Thomas Moor
8 Exclusive copyright is granted to Klaus Schmidt
9 
10 */
11 
12 
13 #ifndef FAUDES_TP_ATTRIBUTES_H
14 #define FAUDES_TP_ATTRIBUTES_H
15 
16 #include "corefaudes.h"
17 #include "tp_timeconstraint.h"
18 
19 namespace faudes {
20 
21 
22 /**
23  * Transition Attribute with guard and resets.
24  *
25  * @ingroup TimedPlugin
26  */
27 
29 
31 
32  public:
33 
34  /** Constructor */
35  AttributeTimedTrans(void) : AttributeFlags() { mGuard.Name("Guard"); mResets.Name("Resets"); };
36 
37  /**
38  * Test for default value (ie empty constraint and default flags)
39  *
40  * @return
41  * True for default value
42  */
43  virtual bool IsDefault(void) const {return mGuard.Empty() && mResets.Empty() && AttributeFlags::IsDefault(); };
44 
45  /** Guard */
47 
48  /** Resets */
50 
51  protected:
52 
53  /**
54  * Assignment method.
55  *
56  * @param rSrcAttr
57  * Source to assign from
58  */
59  void DoAssign(const AttributeTimedTrans& rSrcAttr);
60 
61  /**
62  * Test eaulity.
63  *
64  * @param rOther
65  * Other attribute to compare with.
66  */
67  bool DoEqual(const AttributeTimedTrans& rOther) const;
68 
69  /**
70  * Reads the attribute from TokenReader, see AttributeVoid for public wrappers.
71  *
72  * If the current token indicates a timing section, the method reads the guard and reset
73  * timing data from that section. Else it does nothing. Exceptions may only be thrown
74  * on invalid data within the timing section. The context argument is ignored, the
75  * label argument can be used to override the default section name Timing.
76  *
77  * @param rTr
78  * TokenReader to read from
79  * @param rLabel
80  * Section to read
81  * @param pContext
82  * Read context to provide contextual information
83  *
84  * @exception Exception
85  * - IO error (id 1)
86  */
87  virtual void DoRead(TokenReader& rTr,const std::string& rLabel="", const Type* pContext=0);
88 
89  /**
90  * Writes the attribute to TokenWriter, see AttributeVoid for public wrappers.
91  *
92  * Writes a Timing section to include data on the guard and resets. The label argument
93  * can be used to set a section label different the the default Timing.
94  * Th context argument is ignored.
95  *
96  * @param rTw
97  * TokenWriter to write to
98  * @param rLabel
99  * Section to write
100  * @param pContext
101  * Write context to provide contextual information
102  *
103  * @exception Exception
104  * - IO error (id 2)
105  */
106  virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const;
107 
108 
109 
110 }; // class AttributeTimedTrans
111 
112 
113 /**
114  *
115  * State attribute with invariant.
116  *
117  * @ingroup TimedPlugin
118  *
119  */
120 
122 
124 
125  public:
126 
127  /** Constructor */
128  AttributeTimedState(void) : AttributeFlags() { mInvariant.Name("Invariant"); };
129 
130  /**
131  * Test for default value (ie empty invariant and default flags)
132  *
133  * @return
134  * True for default value
135  */
136  virtual bool IsDefault(void) const {return mInvariant.Empty() && AttributeFlags::IsDefault(); };
137 
138  /** Invariant */
140 
141  protected:
142 
143 
144  /**
145  * Assignment method.
146  *
147  * @param rSrcAttr
148  * Source to assign from
149  */
150  void DoAssign(const AttributeTimedState& rSrcAttr);
151 
152 
153  /**
154  * Test eaulity.
155  *
156  * @param rOther
157  * Other attribute to compare with.
158  */
159  bool DoEqual(const AttributeTimedState& rOther) const;
160 
161  /**
162  * Reads the attribute from TokenReader, see AttributeVoid for public wrappers.
163  *
164  * If the current token indicates a invariant section, the method reads the invariant
165  * from that section. Else, it does nothing. Exceptions may only be thrown
166  * on invalid data within the timing section. The context argument is ignored, the
167  * label argument can be used to override the default section name Invariant.
168  *
169  * @param rTr
170  * TokenReader to read from
171  * @param rLabel
172  * Section to read
173  * @param pContext
174  * Read context to provide contextual information
175  *
176  * @exception Exception
177  * - IO error (id 1)
178  */
179  virtual void DoRead(TokenReader& rTr, const std::string& rLabel="", const Type* pContext=0);
180 
181  /**
182  * Writes the attribute to TokenWriter, see AttributeVoid for public wrappers.
183  *
184  * Writes am Invariant section to include data on the invariant. The label argument
185  * can be used to set a section label different the the default Invariant.
186  * Th context argument is ignored.
187  *
188  * @param rTw
189  * TokenWriter to write to
190  * @param rLabel
191  * Section to write
192  * @param pContext
193  * Write context to provide contextual information
194  *
195  * @exception Exception
196  * - IO error (id 2)
197  */
198  virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const;
199 
200 
201 }; // class AttributeTimedState
202 
203 
204 /**
205  *
206  * Globat attribute with clockset.
207  *
208  * @ingroup TimedPlugin
209  *
210  */
211 
213 
215 
216  public:
217 
218  /** Constructor */
220  mpClockSymbolTable=mClocks.SymbolTablep(); };
221 
222  /**
223  * Test for default value (ie empty clockset)
224  *
225  * @return
226  * True for default value
227  */
228  virtual bool IsDefault(void) const {return mClocks.Empty(); };
229 
230  /** Clocks */
232 
233  /** Pointer to clock symboltable */
235 
236  protected:
237 
238  /**
239  * Assignment method.
240  *
241  * @param rSrcAttr
242  * Source to assign from
243  */
244  void DoAssign(const AttributeTimedGlobal& rSrcAttr);
245 
246  /**
247  * Test eaulity.
248  *
249  * @param rOther
250  * Other attribute to compare with.
251  */
252  bool DoEqual(const AttributeTimedGlobal& rOther) const;
253 
254  /**
255  * Reads the attribute from TokenReader, see AttributeVoid for public wrappers.
256  *
257  * If the current token indicates a Clocks section, the method reads the global
258  * timing data from that section. Else, it does nothing. Exceptions may only be thrown
259  * on invalid data within the timing section. The context argument is ignored, the
260  * label argument can be used to override the default section name Clocks.
261  *
262  * @param rTr
263  * TokenReader to read from
264  * @param rLabel
265  * Section to read
266  * @param pContext
267  * Read context to provide contextual information
268  *
269  * @exception Exception
270  * - IO error (id 1)
271  */
272  virtual void DoRead(TokenReader& rTr,const std::string& rLabel="", const Type* pContext=0);
273 
274  /**
275  * Writes the attribute to TokenWriter, see AttributeVoid for public wrappers.
276  *
277  * Writes a Clocks section to include global timing data. The label argument
278  * can be used to set a section label different the the default Clocks.
279  * Th context argument is ignored.
280  *
281  * @param rTw
282  * TokenWriter to write to
283  * @param rLabel
284  * Section to write
285  * @param pContext
286  * Write context to provide contextual information
287  *
288  * @exception Exception
289  * - IO error (id 2)
290  */
291  virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const;
292 
293 
294 
295 
296 }; // class AttributeTimedGlobal
297 
298 
299 } // namespace faudes
300 
301 #endif
#define FAUDES_API
Interface export/import symbols: windows.
Definition: cfl_platform.h:81
#define FAUDES_TYPE_DECLARATION(ftype, ctype, cbase)
faudes type declaration macro
Definition: cfl_types.h:867
Boolean flags Attribute.
virtual bool IsDefault(void) const
Test for default value.
Globat attribute with clockset.
SymbolTable * mpClockSymbolTable
Pointer to clock symboltable.
virtual bool IsDefault(void) const
Test for default value (ie empty clockset)
AttributeTimedGlobal(void)
Constructor.
State attribute with invariant.
TimeConstraint mInvariant
Invariant
virtual bool IsDefault(void) const
Test for default value (ie empty invariant and default flags)
AttributeTimedState(void)
Constructor.
Transition Attribute with guard and resets.
Definition: tp_attributes.h:28
AttributeTimedTrans(void)
Constructor.
Definition: tp_attributes.h:35
TimeConstraint mGuard
Guard
Definition: tp_attributes.h:43
virtual bool IsDefault(void) const
Test for default value (ie empty constraint and default flags)
Definition: tp_attributes.h:43
Minimal Attribute.
Container class to model a set of clocks.
A SymbolTable associates sybolic names with indices.
A TimeConstraint is a set of elementary clock constraints.
A TokenReader reads sequential tokens from a file or string.
A TokenWriter writes sequential tokens to a file, a string or stdout.
Base class of all libFAUDES objects that participate in the run-time interface.
Definition: cfl_types.h:239
virtual void Name(const std::string &rName)
Set the objects's name.
Definition: cfl_types.cpp:117
Includes all libFAUDES headers, no plugins.
libFAUDES resides within the namespace faudes.
Classes ClockSet, ElemConstraint and TimeConstraint.

libFAUDES 2.31h --- 2024.01.29 --- c++ api documentaion by doxygen