pd_merge.h
Go to the documentation of this file.
1 /** @file pd_merge.h Attributes for pushdown automata states */
2 
3 
4 /* Pushdown plugin for FAU Discrete Event Systems Library (libfaudes)
5 
6  Copyright (C) 2013 Stefan Jacobi, Sven Schneider, Anne-Kathrin Hess
7 
8 */
9 
10 
11 #ifndef FAUDES_PD_MERGE_H
12 #define FAUDES_PD_MERGE_H
13 
14 #include "corefaudes.h"
15 #include "pd_basics.h"
16 namespace faudes {
17 
18 
19 //forward declarations
20 /*template <class GlobalAttr, class StateAttr, class EventAttr, class TransAttr> class TpdGenerator;
21 class AttributePushdownState;
22 class AttributePushdownGlobal;
23 class AttributePushdownTransition;
24 typedef TpdGenerator<AttributePushdownGlobal, AttributePushdownState, AttributeCFlags,AttributePushdownTransition>
25  PushdownGenerator;*/
26 
27 /**
28  * Abstract interface class for all kinds of items which can comprise a new state.
29 *
30 *
31 *
32 *
33 * @ingroup PushdownPlugin
34 *
35 * @section Overview
36 * Overview
37 *
38 * @section Contents
39 * Contents
40 */
41 
43 
44  public:
45 
46  /**
47  * Generator which contains the contained items. In order to print information
48  * about the contained items, the class needs a reference to the generator.
49  */
50  //PushdownGenerator* mpGen;
51 
52  /**
53  * Write Method which is to be implemented by all inheriting classes. Writes the
54  * contained items of which the states consists.
55  *
56  * @param rTw
57  * TokenWriter
58  * @param rLabel
59  * label
60  */
61  virtual void Write(TokenWriter& rTw, const std::string& rLabel) = 0;
62 
63  // virtuals destructor for abstract class (tmoor 2016-03)
64  virtual ~MergeAbstract() {};
65 };// class MergeAbstract
66 
67 /**
68  * Merge class which contains only states.
69 *
70 *
71 *
72 *
73 * @ingroup PushdownPlugin
74 *
75 * @section Overview
76 * Overview
77 *
78 * @section Contents
79 * Contents
80 */
81 class MergeStates : public MergeAbstract{
82 
83  public:
84 
85  /** the contained states */
86  std::vector<Idx> mStates;
87 
88  /**
89  * Constructor.
90  *
91  * @param states
92  * Vector of states. The vector must not be empty.
93  */
94  MergeStates(const std::vector<Idx>& states);
95  //MergeStates(std::vector<Idx> states, PushdownGenerator* gen);
96 
97  /**
98  * Writes the contained items.
99  * @param rTw
100  * TokenWriter
101  * @param rLabel
102  * label
103  */
104  void Write(TokenWriter& rTw, const std::string& rLabel);
105 
106  /**
107  * Getter for States
108  *
109  * @return
110  * mStates
111  */
112  std::vector<Idx> States() const { return mStates; }
113 
114 // /**
115 // * Set the contained states.
116 // *
117 // * @param states
118 // * Vector of states. The vector must not be emtpy.
119 // */
120 // void Set(std::vector<Idx> states);
121 };//class MergeStates
122 
123 /**
124  * Merge class which contains one state and a string annotation.
125 *
126 *
127 *
128 *
129 * @ingroup PushdownPlugin
130 *
131 * @section Overview
132 * Overview
133 *
134 * @section Contents
135 * Contents
136 */
138 
139  public:
140 
141  /** the contained state */
143  /** the annotation */
144  std::string mAnnotation;
145 
146  /**
147  * Constructor.
148  *
149  * @param state
150  * The state, which must not be empty
151  * @param annotation
152  * The annotation
153  */
154  MergeStateAnnotation(const Idx state, const std::string& annotation);
155 
156  /**
157  * Getter for State
158  *
159  * @return
160  * mState
161  */
162  Idx State() const { return mState; }
163 
164  /**
165  * Getter for annotation
166  *
167  * @return
168  * mAnnotation
169  */
170  std::string Annotation() const { return mAnnotation; }
171 
172  /**
173  * Writes the contained items.
174  * @param rTw
175  * TokenWriter
176  * @param rLabel
177  * label
178  */
179  void Write(TokenWriter& rTw, const std::string& rLabel);
180 
181 };//class MergeStateAnnotation
182 
183 /**
184  * Merge class which contains one state and one event
185 *
186 *
187 *
188 *
189 * @ingroup PushdownPlugin
190 *
191 * @section Overview
192 * Overview
193 *
194 * @section Contents
195 * Contents
196 */
198 
199  public:
200 
201  /** the contained state */
203  /** the contained event*/
205 
206  /**
207  * Constructor.
208  *
209  * @param state
210  * The state, which must not be empty
211  * @param event
212  * The event
213  */
214  MergeStateEvent(const Idx state, const Idx event);
215 
216  /**
217  * Getter for State
218  *
219  * @return
220  * mState
221  */
222  Idx State() const { return mState; }
223 
224  /**
225  * Getter for event
226  *
227  * @return
228  * mEvent
229  */
230  Idx Event() const { return mEvent; }
231 
232  /**
233  * Writes the contained items.
234  * @param rTw
235  * TokenWriter
236  * @param rLabel
237  * label
238  */
239  void Write(TokenWriter& rTw, const std::string& rLabel);
240 
241 };//class MergeStateEvent
242 
243 
244 /**
245  * Merge class which contains one state, one stack symbol and a string annotation.
246 *
247 *
248 *
249 *
250 * @ingroup PushdownPlugin
251 *
252 * @section Overview
253 * Overview
254 *
255 * @section Contents
256 * Contents
257 */
259 
260  public:
261 
262  /** the contained state */
264  /** the stack symbol */
266  /** isHead */
267  bool mIsHead;
268 
269  /**
270  * Constructor for heads.
271  *
272  * @param state
273  * The state, which must not be empty
274  */
275  MergeStateSplit(const Idx state);
276 
277  /**
278  * Constructor for ears.
279  *
280  * @param state
281  * The state, which must not be empty
282  * @param symbol
283  * The stack symbol
284  */
285  MergeStateSplit(const Idx state, const Idx symbol);
286 
287  /**
288  * Getter for State
289  *
290  * @return
291  * mState
292  */
293  Idx State() const { return mState; }
294 
295  /**
296  * Getter for symbol
297  *
298  * @return
299  * mSymbol
300  */
301  Idx Symbol() const { return mSymbol; }
302 
303  /**
304  * Getter for IsHead
305  *
306  * @return
307  * mIsHead
308  */
309  bool IsHead() const { return mIsHead; }
310 
311  /**
312  * Writes the contained items.
313  * @param rTw
314  * TokenWriter
315  * @param rLabel
316  * label
317  */
318  void Write(TokenWriter& rTw, const std::string& rLabel);
319 
320 };//class MergeStateSplit
321 
322 /**
323  * Merge class which contains one transition
324 *
325 *
326 *
327 *
328 * @ingroup PushdownPlugin
329 *
330 * @section Overview
331 * Overview
332 *
333 * @section Contents
334 * Contents
335 */
337 
338  public:
339 
340  /** the transition's start state, event, end state, pop symbols and push symbols */
344  std::vector<Idx> mPop;
345  std::vector<Idx> mPush;
346 
347  /**
348  * Constructor for heads.
349  *
350  * @param x1
351  * start state
352  * @param ev
353  * event
354  * @param x2
355  * end state
356  * @param pop
357  * pop stack symbols
358  * @param push
359  * push stack symbols
360  */
361  MergeTransition(Idx x1, Idx ev, Idx x2, const std::vector<Idx>& pop, const std::vector<Idx>& push);
362 
363  /**
364  * Constructor for heads.
365  *
366  * @param trans
367  * Transition
368  * @param pop
369  * pop stack symbols
370  * @param push
371  * push stack symbols
372  */
373  MergeTransition(const Transition trans, const std::vector<Idx>& pop, const std::vector<Idx>& push);
374 
375  /**
376  * Getter for mX1
377  *
378  * @return
379  * mX1
380  */
381  Idx X1() const { return mX1; }
382 
383  /**
384  * Getter for mEv
385  *
386  * @return
387  * mEv
388  */
389  Idx Ev() const { return mEv; }
390 
391  /**
392  * Getter for mX2
393  *
394  * @return
395  * mX2
396  */
397  Idx X2() const { return mX2; }
398 
399  /**
400  * Getter for mPop
401  *
402  * @return
403  * mPop
404  */
405  const std::vector<Idx>& Pop() const { return mPop; }
406 
407  /**
408  * Getter for mPush
409  *
410  * @return
411  * mPush
412  */
413  const std::vector<Idx>& Push() const { return mPush; }
414 
415 
416  /**
417  * Writes the contained items.
418  * @param rTw
419  * TokenWriter
420  * @param rLabel
421  * label
422  */
423  void Write(TokenWriter& rTw, const std::string& rLabel);
424 
425 };//class MergeTransition
426 
427 } // namespace faudes
428 
429 #endif

libFAUDES 2.28c --- 2016.09.30 --- c++ api documentaion by doxygen