pd_basics.h
Go to the documentation of this file.
1 /** @file pd_basics.h Attributes for pushdown automata */
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_BASICS_H
12 #define FAUDES_PD_BASICS_H
13 
14 #include "corefaudes.h"
15 #include <list>
16 
17 
18 #if __cplusplus < 201103L
19 #define FAUDES_PD_TR1
20 #endif
21 
22 
23 #define FAUDES_PD_LAMBDA "lambda"
24 #define FAUDES_PD_STACK_BOTTOM "bottom"
25 namespace faudes {
26 
27 
28 
29 /*
30 define non-lsb compliant "uint" from gcc" (tmoor)
31 note: "pd_include.h" is meant for the external API,
32 not for internal declarations; this should be reorganized
33 to have e.g. the below typedef local to the pushdown plug-in
34 */
35 typedef unsigned int uint;
36 
37 
38 
39 /**
40  * Container class to model a set of stack symbols.
41  * Technically, this is a NameSet with a static SymbolTable to map
42  * symbolic stack symbol names to stack symbol indices. Thus, stack symbol names are
43  * global similar to event names.
44  *
45  * @ingroup PushdownPlugin
46  *
47  */
48 
50 
52 
53  public:
54 
55  /**
56  * Constructor
57  */
58  StackSymbolSet(void);
59 
60  /**
61  * Copy-constructor.
62  *
63  * @param rOtherSet
64  * Set to copy
65  */
66  StackSymbolSet(const StackSymbolSet& rOtherSet);
67 
68  /**
69  * Construct from file.
70  * Uses the NameSet's Read() function to scan a file for a
71  * specified clockset.
72  *
73  * @param rFilename
74  * File to read
75  * @param rLabel
76  * Section label for the clocks in the file; default value "Clocks"
77  */
78  StackSymbolSet(const std::string& rFilename, const std::string& rLabel = "StackSymbols");
79 
80  /**
81  * Get pointer to static stack SymbolTable
82  *
83  * @return
84  * Pointer to static stack SymbolTable
85  */
86  static SymbolTable* StaticSymbolTablep(void);
87 
88  protected:
89 
90  /** Static global SymbolTable for stack symbol names */
92 
93  /**
94  * Assign from other stack symbol set.
95  *
96  * @param rSourceSet
97  * Destination to copy from
98  * @return
99  * ref to this set
100  */
101  void DoAssign(const StackSymbolSet& rSourceSet);
102 
103  /**
104  * Test equality with other clock set.
105  *
106  * @param rOtherSet
107  * Set to compare with
108  * @return
109  * True/false
110  */
111  bool DoEqual(const StackSymbolSet& rOtherSet) const;
112 
113 }; // end class StackSymbolSet
114 
115 /**
116 *
117 * Deprecated, do not use!
118 *
119 *
120 * @ingroup PushdownPlugin
121 *
122 * @section Overview
123 * Overview
124 *
125 * @section Contents
126 * Contents
127 */
128 
130  public:
131 
132 
133  std::string mSymbol;
134 
135  /**
136  * Constructor
137  */
138  StackSymbol(void) {};
139 
140  /**
141  * Constructor
142  * @param
143  * symbol name to set
144  */
145  StackSymbol(std::string symbol) : mSymbol(symbol) {};
146 
147  /**
148  * Getter for mSymbol
149  *
150  * @return
151  * mSymbol
152  */
153  const std::string& Symbol() const {return mSymbol;}
154 
155 
156  /**
157  * Write to TokenWriter. Currently not used!
158  *
159  * @param tw
160  * Reference to TokenWriter
161  *
162  * @exception std::ios::failure
163  * Thrown on i/o error.
164  */
165  void Write(TokenWriter& tw) const;
166 
167  /**
168  * Write to TokenWriter with a given label
169  *
170  * @param tw
171  * Reference to TokenWriter
172  * @param rLabel
173  * Label for set in file
174  *
175  * @exception std::ios::failure
176  * Thrown on i/o error.
177  */
178  void Write(TokenWriter& tw, const std::string& rLabel) const;
179 
180  /**
181  * Test inequality with other stack symbol.
182  *
183  * @param other
184  * stack symbol to compare with
185  * @return
186  * True if mSymbol is not the same, else false
187  */
188  bool operator!=(const StackSymbol& other) const;
189 
190  /**
191  * Test equality with other stack symbol.
192  *
193  * @param other
194  * stack symbol to compare with
195  * @return
196  * True if mSymbol is the same, else false
197  */
198  bool operator==(const StackSymbol& other) const;
199 
200  /**
201  * Test equality with other stack symbol.
202  *
203  * @param other
204  * stack symbol to compare with
205  * @return
206  * True if mSymbol is the same, else false
207  */
208  bool operator<(const StackSymbol& other) const;
209 
210  /**
211  * Test if stack symbol is lambda.
212  *
213  * @return
214  * True if mSymbol is lambda, else false
215  */
216  bool IsLambda() const;
217 
218  /**
219  * Write mSymbol to string
220  * @return
221  * mSymbol as String
222  */
223  std::string ToString() const;
224 
225  /**
226  * Tests if mSymbol is an empty String ("")
227  * @return
228  * true if mSymbol is an emptry String, else false
229  */
230  bool Empty() const;
231 
232 }; // end class Stack Symbol
233 
234 
235 } // namespace faudes
236 
237 #endif

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