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

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