hyb_attributes.h
Go to the documentation of this file.
1 /** @file hyp_attributes.h Attributes of linear hybrid automata */
2 
3 /*
4  Hybrid systems plug-in for FAU Discrete Event Systems Library
5 
6  Copyright (C) 2010 Thomas Moor
7 
8 */
9 
10 
11 #ifndef FAUDES_HYB_ATTRIBUTES_H
12 #define FAUDES_HYB_ATTRIBUTES_H
13 
14 #include "corefaudes.h"
15 #include "hyb_parameter.h"
16 
17 namespace faudes {
18 
19 
20 /**
21  * Linear hybrid automata transition attribute with guard and resets.
22  * The guard condition is represented by a Polyhedron, the reset by
23  * a LinearRelation. This is a cheap container, both parameters can
24  * be directly accessed as public members mGuard and mReset.
25  *
26  * @ingroup HybridPlugin
27  */
28 
30 
32 
33  public:
34 
35  /** Constructor */
37 
38  /**
39  * Test for default value.
40  * True for no guard restriction and identity reset.
41  *
42  * @return
43  * True for default value
44  */
45  virtual bool IsDefault(void) const {
46  return AttributeFlags::IsDefault() && mGuard.Size()==0 && mReset.Identity(); };
47 
48  /** Guard */
50 
51  /** Resets */
53 
54  protected:
55 
56  /**
57  * Assignment method.
58  *
59  * @param rSrcAttr
60  * Source to assign from
61  */
62  AttributeLhaTrans& DoAssign(const AttributeLhaTrans& rSrcAttr);
63 
64  /**
65  * Test eaulity.
66  * Note: this test refers to the parametrisation as opposed to the
67  * relevant polyhedra.
68  *
69  * @param rOther
70  * Other attribute to compare with.
71  */
72  bool DoEqual(const AttributeLhaTrans& rOther) const;
73 
74  /**
75  * Reads the attribute from TokenReader, see AttributeVoid for public wrappers.
76  *
77  * If the current token indicates a hybrid system parameter section, the method reads
78  * the guard and reset data from that section. Else it does nothing. Exceptions may only be thrown
79  * on invalid data within the parameter section. The context argument is ignored, the
80  * label argument can be used to override the default section name Timing.
81  *
82  * @param rTr
83  * TokenReader to read from
84  * @param rLabel
85  * Section to read
86  * @param pContext
87  * Read context to provide contextual information
88  *
89  * @exception Exception
90  * - IO error (id 1)
91  */
92  virtual void DoRead(TokenReader& rTr,const std::string& rLabel="", const Type* pContext=0);
93 
94  /**
95  * Writes the attribute to TokenWriter, see AttributeVoid for public wrappers.
96  *
97  * Writes a hybrid systems parameter section to include data on the guard and resets.
98  * The label argument can be used to set a section label different the the default LhaTransition.
99  * The context argument is ignored.
100  *
101  * @param rTw
102  * TokenWriter to write to
103  * @param rLabel
104  * Section to write
105  * @param pContext
106  * Write context to provide contextual information
107  *
108  * @exception Exception
109  * - IO error (id 2)
110  */
111  virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const;
112 
113  /**
114  * Writes the attribute to TokenWriter, see AttributeVoid for public wrappers.
115  *
116  * Same as DoWrite but un strict XML format.
117  *
118  * @param rTw
119  * TokenWriter to write to
120  * @param rLabel
121  * Section to write
122  * @param pContext
123  * Write context to provide contextual information
124  *
125  * @exception Exception
126  * - IO error (id 2)
127  */
128  virtual void DoXWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const;
129 
130 }; // class AttributeLhaTrans
131 
132 
133 /**
134  *
135  * Linear hybrid automata state attribute with invariant, rates and optional initial state constraint.
136  * All enteties are represented by polyherda.
137  * The initial state constraints apply when the respective location is set up as a
138  * discrete initial state.
139  *
140  * @ingroup HybridPlugin
141  *
142  */
143 
145 
147 
148  public:
149 
150  /** Constructor */
152 
153  /**
154  * Test for default value (never)
155  *
156  * @return
157  * True for default value
158  */
159  virtual bool IsDefault(void) const { return false; };
160 
161  /** Invariant */
163 
164  /** Initial state constraint */
166 
167  /** Rate */
169 
170  protected:
171 
172 
173  /**
174  * Assignment method.
175  *
176  * @param rSrcAttr
177  * Source to assign from
178  */
179  AttributeLhaState& DoAssign(const AttributeLhaState& rSrcAttr);
180 
181 
182  /**
183  * Test eaulity.
184  *
185  * @param rOther
186  * Other attribute to compare with.
187  */
188  bool DoEqual(const AttributeLhaState& rOther) const;
189 
190  /**
191  * Reads the attribute from TokenReader, see AttributeVoid for public wrappers.
192  *
193  * If the current token indicates a hybrid systems parameter section, the method reads the
194  * parameters from that section. Else, it does nothing. Exceptions may only be thrown
195  * on invalid data within the parameter section. The context argument is ignored, the
196  * label argument can be used to override the default section name Invariant.
197  *
198  * @param rTr
199  * TokenReader to read from
200  * @param rLabel
201  * Section to read
202  * @param pContext
203  * Read context to provide contextual information
204  *
205  * @exception Exception
206  * - IO error (id 1)
207  */
208  virtual void DoRead(TokenReader& rTr, const std::string& rLabel="", const Type* pContext=0);
209 
210  /**
211  * Writes the attribute to TokenWriter, see AttributeVoid for public wrappers.
212  *
213  * Writes a hybrid system parameter section to include data on the invariant. The label argument
214  * can be used to set a section label different the the default LhaState.
215  * The context argument is ignored.
216  *
217  * @param rTw
218  * TokenWriter to write to
219  * @param rLabel
220  * Section to write
221  * @param pContext
222  * Write context to provide contextual information
223  *
224  * @exception Exception
225  * - IO error (id 2)
226  */
227  virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const;
228 
229  /**
230  * Writes the attribute to TokenWriter, see AttributeVoid for public wrappers.
231  *
232  * Same as DoWrite but in strict XML format.
233  *
234  * @param rTw
235  * TokenWriter to write to
236  * @param rLabel
237  * Section to write
238  * @param pContext
239  * Write context to provide contextual information
240  *
241  * @exception Exception
242  * - IO error (id 2)
243  */
244  virtual void DoXWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const;
245 
246 
247 }; // class AttributeLhaState
248 
249 
250 /**
251  *
252  * Linear hybrid automata globat attribute to specify the overall
253  * state space. All invariants are interpreted as intersection with
254  * the global state space.
255  *
256  * @ingroup HybridPlugin
257  *
258  */
259 
261 
263 
264  public:
265 
266  /** Constructor */
268 
269  /**
270  * Test for default value (never)
271  *
272  * @return
273  * True for default value
274  */
275  virtual bool IsDefault(void) const {return false;};
276 
277  /** Continuous states */
279 
280 
281  protected:
282 
283  /**
284  * Assignment method.
285  *
286  * @param rSrcAttr
287  * Source to assign from
288  */
289  AttributeLhaGlobal& DoAssign(const AttributeLhaGlobal& rSrcAttr);
290 
291  /**
292  * Test eaulity.
293  * Note: the test refers to the parametrisation.
294  *
295  * @param rOther
296  * Other attribute to compare with.
297  */
298  bool DoEqual(const AttributeLhaGlobal& rOther) const;
299 
300  /**
301  * Reads the attribute from TokenReader, see AttributeVoid for public wrappers.
302  *
303  * If the current token indicates a hybrid system parameter section, the method reads the global
304  * data from that section. Else, it does nothing. Exceptions may only be thrown
305  * on invalid data within the parameter section. The context argument is ignored, the
306  * label argument can be used to override the default section name Clocks.
307  *
308  * @param rTr
309  * TokenReader to read from
310  * @param rLabel
311  * Section to read
312  * @param pContext
313  * Read context to provide contextual information
314  *
315  * @exception Exception
316  * - IO error (id 1)
317  */
318  virtual void DoRead(TokenReader& rTr,const std::string& rLabel="", const Type* pContext=0);
319 
320  /**
321  * Writes the attribute to TokenWriter, see AttributeVoid for public wrappers.
322  *
323  * Writes hybrid automata global data. The label argument
324  * can be used to set a section label different the the default LhaGlobal.
325  * The context argument is ignored.
326  *
327  * @param rTw
328  * TokenWriter to write to
329  * @param rLabel
330  * Section to write
331  * @param pContext
332  * Write context to provide contextual information
333  *
334  * @exception Exception
335  * - IO error (id 2)
336  */
337  virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const;
338 
339 
340 }; // class AttributeLhaGlobal
341 
342 
343 } // namespace faudes
344 
345 #endif
#define FAUDES_API
Definition: cfl_platform.h:80
#define FAUDES_TYPE_DECLARATION(ftype, ctype, cbase)
Definition: cfl_types.h:872
virtual bool IsDefault(void) const
virtual bool IsDefault(void) const
virtual bool IsDefault(void) const
virtual bool IsDefault(void) const

libFAUDES 2.33c --- 2025.05.15 --- c++ api documentaion by doxygen