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,2014 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 */
129  mInvariant.Name("Invariant");
130  };
131 
132  /** Copy Constructor */
134  mInvariant.Name("Invariant");
135  DoAssign(rSrcAttr);
136  };
137 
138  /**
139  * Test for default value (ie empty invariant and default flags)
140  *
141  * @return
142  * True for default value
143  */
144  virtual bool IsDefault(void) const {return mInvariant.Empty() && AttributeFlags::IsDefault(); };
145 
146  /** Invariant */
148 
149  protected:
150 
151 
152  /**
153  * Assignment method.
154  *
155  * @param rSrcAttr
156  * Source to assign from
157  */
158  void DoAssign(const AttributeTimedState& rSrcAttr);
159 
160 
161  /**
162  * Test eaulity.
163  *
164  * @param rOther
165  * Other attribute to compare with.
166  */
167  bool DoEqual(const AttributeTimedState& rOther) const;
168 
169  /**
170  * Reads the attribute from TokenReader, see AttributeVoid for public wrappers.
171  *
172  * If the current token indicates a invariant section, the method reads the invariant
173  * from that section. Else, it does nothing. Exceptions may only be thrown
174  * on invalid data within the timing section. The context argument is ignored, the
175  * label argument can be used to override the default section name Invariant.
176  *
177  * @param rTr
178  * TokenReader to read from
179  * @param rLabel
180  * Section to read
181  * @param pContext
182  * Read context to provide contextual information
183  *
184  * @exception Exception
185  * - IO error (id 1)
186  */
187  virtual void DoRead(TokenReader& rTr, const std::string& rLabel="", const Type* pContext=0);
188 
189  /**
190  * Writes the attribute to TokenWriter, see AttributeVoid for public wrappers.
191  *
192  * Writes am Invariant section to include data on the invariant. The label argument
193  * can be used to set a section label different the the default Invariant.
194  * Th context argument is ignored.
195  *
196  * @param rTw
197  * TokenWriter to write to
198  * @param rLabel
199  * Section to write
200  * @param pContext
201  * Write context to provide contextual information
202  *
203  * @exception Exception
204  * - IO error (id 2)
205  */
206  virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const;
207 
208 
209 }; // class AttributeTimedState
210 
211 
212 /**
213  *
214  * Globat attribute with clockset.
215  *
216  * @ingroup TimedPlugin
217  *
218  */
219 
221 
223 
224  public:
225 
226  /** Constructor */
228  mpClockSymbolTable=mClocks.SymbolTablep(); };
229 
230  /**
231  * Test for default value (ie empty clockset)
232  *
233  * @return
234  * True for default value
235  */
236  virtual bool IsDefault(void) const {return mClocks.Empty(); };
237 
238  /** Clocks */
240 
241  /** Pointer to clock symboltable */
243 
244  protected:
245 
246  /**
247  * Assignment method.
248  *
249  * @param rSrcAttr
250  * Source to assign from
251  */
252  void DoAssign(const AttributeTimedGlobal& rSrcAttr);
253 
254  /**
255  * Test eaulity.
256  *
257  * @param rOther
258  * Other attribute to compare with.
259  */
260  bool DoEqual(const AttributeTimedGlobal& rOther) const;
261 
262  /**
263  * Reads the attribute from TokenReader, see AttributeVoid for public wrappers.
264  *
265  * If the current token indicates a Clocks section, the method reads the global
266  * timing data from that section. Else, it does nothing. Exceptions may only be thrown
267  * on invalid data within the timing section. The context argument is ignored, the
268  * label argument can be used to override the default section name Clocks.
269  *
270  * @param rTr
271  * TokenReader to read from
272  * @param rLabel
273  * Section to read
274  * @param pContext
275  * Read context to provide contextual information
276  *
277  * @exception Exception
278  * - IO error (id 1)
279  */
280  virtual void DoRead(TokenReader& rTr,const std::string& rLabel="", const Type* pContext=0);
281 
282  /**
283  * Writes the attribute to TokenWriter, see AttributeVoid for public wrappers.
284  *
285  * Writes a Clocks section to include global timing data. The label argument
286  * can be used to set a section label different the the default Clocks.
287  * Th context argument is ignored.
288  *
289  * @param rTw
290  * TokenWriter to write to
291  * @param rLabel
292  * Section to write
293  * @param pContext
294  * Write context to provide contextual information
295  *
296  * @exception Exception
297  * - IO error (id 2)
298  */
299  virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const;
300 
301 
302 
303 
304 }; // class AttributeTimedGlobal
305 
306 
307 } // namespace faudes
308 
309 #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
AttributeTimedState(const AttributeTimedState &rSrcAttr)
Copy Constructor.
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.32b --- 2024.03.01 --- c++ api documentaion by doxygen