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 };// class MergeAbstract
64 
65 /**
66  * Merge class which contains only states.
67 *
68 *
69 *
70 *
71 * @ingroup PushdownPlugin
72 *
73 * @section Overview
74 * Overview
75 *
76 * @section Contents
77 * Contents
78 */
79 class MergeStates : public MergeAbstract{
80 
81  public:
82 
83  /** the contained states */
84  std::vector<Idx> mStates;
85 
86  /**
87  * Constructor.
88  *
89  * @param states
90  * Vector of states. The vector must not be empty.
91  */
92  MergeStates(const std::vector<Idx>& states);
93  //MergeStates(std::vector<Idx> states, PushdownGenerator* gen);
94 
95  /**
96  * Writes the contained items.
97  * @param rTw
98  * TokenWriter
99  * @param rLabel
100  * label
101  */
102  void Write(TokenWriter& rTw, const std::string& rLabel);
103 
104  /**
105  * Getter for States
106  *
107  * @return
108  * mStates
109  */
110  std::vector<Idx> States() const { return mStates; }
111 
112 // /**
113 // * Set the contained states.
114 // *
115 // * @param states
116 // * Vector of states. The vector must not be emtpy.
117 // */
118 // void Set(std::vector<Idx> states);
119 };//class MergeStates
120 
121 /**
122  * Merge class which contains one state and a string annotation.
123 *
124 *
125 *
126 *
127 * @ingroup PushdownPlugin
128 *
129 * @section Overview
130 * Overview
131 *
132 * @section Contents
133 * Contents
134 */
136 
137  public:
138 
139  /** the contained state */
141  /** the annotation */
142  std::string mAnnotation;
143 
144  /**
145  * Constructor.
146  *
147  * @param state
148  * The state, which must not be empty
149  * @param annotation
150  * The annotation
151  */
152  MergeStateAnnotation(const Idx state, const std::string& annotation);
153 
154  /**
155  * Getter for State
156  *
157  * @return
158  * mState
159  */
160  Idx State() const { return mState; }
161 
162  /**
163  * Getter for annotation
164  *
165  * @return
166  * mAnnotation
167  */
168  std::string Annotation() const { return mAnnotation; }
169 
170  /**
171  * Writes the contained items.
172  * @param rTw
173  * TokenWriter
174  * @param rLabel
175  * label
176  */
177  void Write(TokenWriter& rTw, const std::string& rLabel);
178 
179 };//class MergeStateAnnotation
180 
181 /**
182  * Merge class which contains one state and one event
183 *
184 *
185 *
186 *
187 * @ingroup PushdownPlugin
188 *
189 * @section Overview
190 * Overview
191 *
192 * @section Contents
193 * Contents
194 */
196 
197  public:
198 
199  /** the contained state */
201  /** the contained event*/
203 
204  /**
205  * Constructor.
206  *
207  * @param state
208  * The state, which must not be empty
209  * @param event
210  * The event
211  */
212  MergeStateEvent(const Idx state, const Idx event);
213 
214  /**
215  * Getter for State
216  *
217  * @return
218  * mState
219  */
220  Idx State() const { return mState; }
221 
222  /**
223  * Getter for event
224  *
225  * @return
226  * mEvent
227  */
228  Idx Event() const { return mEvent; }
229 
230  /**
231  * Writes the contained items.
232  * @param rTw
233  * TokenWriter
234  * @param rLabel
235  * label
236  */
237  void Write(TokenWriter& rTw, const std::string& rLabel);
238 
239 };//class MergeStateEvent
240 
241 
242 /**
243  * Merge class which contains one state, one stack symbol and a string annotation.
244 *
245 *
246 *
247 *
248 * @ingroup PushdownPlugin
249 *
250 * @section Overview
251 * Overview
252 *
253 * @section Contents
254 * Contents
255 */
257 
258  public:
259 
260  /** the contained state */
262  /** the stack symbol */
264  /** isHead */
265  bool mIsHead;
266 
267  /**
268  * Constructor for heads.
269  *
270  * @param state
271  * The state, which must not be empty
272  */
273  MergeStateSplit(const Idx state);
274 
275  /**
276  * Constructor for ears.
277  *
278  * @param state
279  * The state, which must not be empty
280  * @param symbol
281  * The stack symbol
282  */
283  MergeStateSplit(const Idx state, const Idx symbol);
284 
285  /**
286  * Getter for State
287  *
288  * @return
289  * mState
290  */
291  Idx State() const { return mState; }
292 
293  /**
294  * Getter for symbol
295  *
296  * @return
297  * mSymbol
298  */
299  Idx Symbol() const { return mSymbol; }
300 
301  /**
302  * Getter for IsHead
303  *
304  * @return
305  * mIsHead
306  */
307  bool IsHead() const { return mIsHead; }
308 
309  /**
310  * Writes the contained items.
311  * @param rTw
312  * TokenWriter
313  * @param rLabel
314  * label
315  */
316  void Write(TokenWriter& rTw, const std::string& rLabel);
317 
318 };//class MergeStateSplit
319 
320 /**
321  * Merge class which contains one transition
322 *
323 *
324 *
325 *
326 * @ingroup PushdownPlugin
327 *
328 * @section Overview
329 * Overview
330 *
331 * @section Contents
332 * Contents
333 */
335 
336  public:
337 
338  /** the transition's start state, event, end state, pop symbols and push symbols */
342  std::vector<Idx> mPop;
343  std::vector<Idx> mPush;
344 
345  /**
346  * Constructor for heads.
347  *
348  * @param x1
349  * start state
350  * @param ev
351  * event
352  * @param x2
353  * end state
354  * @param pop
355  * pop stack symbols
356  * @param push
357  * push stack symbols
358  */
359  MergeTransition(Idx x1, Idx ev, Idx x2, const std::vector<Idx>& pop, const std::vector<Idx>& push);
360 
361  /**
362  * Getter for mX1
363  *
364  * @return
365  * mX1
366  */
367  Idx X1() const { return mX1; }
368 
369  /**
370  * Getter for mEv
371  *
372  * @return
373  * mEv
374  */
375  Idx Ev() const { return mEv; }
376 
377  /**
378  * Getter for mX2
379  *
380  * @return
381  * mX2
382  */
383  Idx X2() const { return mX2; }
384 
385  /**
386  * Getter for mPop
387  *
388  * @return
389  * mPop
390  */
391  const std::vector<Idx>& Pop() const { return mPop; }
392 
393  /**
394  * Getter for mPush
395  *
396  * @return
397  * mPush
398  */
399  const std::vector<Idx>& Push() const { return mPush; }
400 
401 
402  /**
403  * Writes the contained items.
404  * @param rTw
405  * TokenWriter
406  * @param rLabel
407  * label
408  */
409  void Write(TokenWriter& rTw, const std::string& rLabel);
410 
411 };//class MergeTransition
412 
413 } // namespace faudes
414 
415 #endif

libFAUDES 2.24g --- 2014.09.15 --- c++ api documentaion by doxygen