pd_basics.hGo to the documentation of this file.00001 /** @file pd_basics.h Attributes for pushdown automata */ 00002 00003 00004 /* Pushdown plugin for FAU Discrete Event Systems Library (libfaudes) 00005 00006 Copyright (C) 2013 Stefan Jacobi, Sven Schneider, Anne-Kathrin Hess 00007 00008 */ 00009 00010 00011 #ifndef FAUDES_PD_BASICS_H 00012 #define FAUDES_PD_BASICS_H 00013 00014 #include "corefaudes.h" 00015 #include <list> 00016 00017 #define FAUDES_PD_LAMBDA "lambda" 00018 #define FAUDES_PD_STACK_BOTTOM "bottom" 00019 namespace faudes { 00020 00021 00022 00023 /* 00024 define non-lsb compliant "uint" from gcc" (tmoor) 00025 note: "pd_include.h" is meant for the external API, 00026 not for internal declarations; this should be reorganized 00027 to have e.g. the below typedef local to the pushdown plug-in 00028 */ 00029 typedef unsigned int uint; 00030 00031 00032 00033 /** 00034 * Container class to model a set of stack symbols. 00035 * Technically, this is a NameSet with a static SymbolTable to map 00036 * symbolic stack symbol names to stack symbol indices. Thus, stack symbol names are 00037 * global similar to event names. 00038 * 00039 * @ingroup PushdownPlugin 00040 * 00041 */ 00042 00043 class StackSymbolSet : public NameSet { 00044 00045 FAUDES_TYPE_DECLARATION(StackSymbolSet,StackSymbolSet,NameSet) 00046 00047 public: 00048 00049 /** 00050 * Constructor 00051 */ 00052 StackSymbolSet(void); 00053 00054 /** 00055 * Copy-constructor. 00056 * 00057 * @param rOtherSet 00058 * Set to copy 00059 */ 00060 StackSymbolSet(const StackSymbolSet& rOtherSet); 00061 00062 /** 00063 * Construct from file. 00064 * Uses the NameSet's Read() function to scan a file for a 00065 * specified clockset. 00066 * 00067 * @param rFilename 00068 * File to read 00069 * @param rLabel 00070 * Section label for the clocks in the file; default value "Clocks" 00071 */ 00072 StackSymbolSet(const std::string& rFilename, const std::string& rLabel = "StackSymbols"); 00073 00074 /** 00075 * Get pointer to static stack SymbolTable 00076 * 00077 * @return 00078 * Pointer to static stack SymbolTable 00079 */ 00080 static SymbolTable* StaticSymbolTablep(void); 00081 00082 protected: 00083 00084 /** Static global SymbolTable for stack symbol names */ 00085 static SymbolTable msSymbolTable; 00086 00087 /** 00088 * Assign from other stack symbol set. 00089 * 00090 * @param rSourceSet 00091 * Destination to copy from 00092 * @return 00093 * ref to this set 00094 */ 00095 virtual void DoAssign(const StackSymbolSet& rSourceSet); 00096 00097 /** 00098 * Test equality with other clock set. 00099 * 00100 * @param rOtherSet 00101 * Set to compare with 00102 * @return 00103 * True/false 00104 */ 00105 virtual bool DoEqual(const StackSymbolSet& rOtherSet) const; 00106 00107 }; // end class StackSymbolSet 00108 00109 /** 00110 * 00111 * Deprecated, do not use! 00112 * 00113 * 00114 * @ingroup PushdownPlugin 00115 * 00116 * @section Overview 00117 * Overview 00118 * 00119 * @section Contents 00120 * Contents 00121 */ 00122 00123 class StackSymbol{ 00124 public: 00125 00126 00127 std::string mSymbol; 00128 00129 /** 00130 * Constructor 00131 */ 00132 StackSymbol(void) {}; 00133 00134 /** 00135 * Constructor 00136 * @param 00137 * symbol name to set 00138 */ 00139 StackSymbol(std::string symbol) : mSymbol(symbol) {}; 00140 00141 /** 00142 * Getter for mSymbol 00143 * 00144 * @return 00145 * mSymbol 00146 */ 00147 const std::string& Symbol() const {return mSymbol;} 00148 00149 00150 /** 00151 * Write to TokenWriter. Currently not used! 00152 * 00153 * @param tw 00154 * Reference to TokenWriter 00155 * 00156 * @exception std::ios::failure 00157 * Thrown on i/o error. 00158 */ 00159 void Write(TokenWriter& tw) const; 00160 00161 /** 00162 * Write to TokenWriter with a given label 00163 * 00164 * @param tw 00165 * Reference to TokenWriter 00166 * @param rLabel 00167 * Label for set in file 00168 * 00169 * @exception std::ios::failure 00170 * Thrown on i/o error. 00171 */ 00172 void Write(TokenWriter& tw, const std::string& rLabel) const; 00173 00174 /** 00175 * Test inequality with other stack symbol. 00176 * 00177 * @param other 00178 * stack symbol to compare with 00179 * @return 00180 * True if mSymbol is not the same, else false 00181 */ 00182 bool operator!=(const StackSymbol& other) const; 00183 00184 /** 00185 * Test equality with other stack symbol. 00186 * 00187 * @param other 00188 * stack symbol to compare with 00189 * @return 00190 * True if mSymbol is the same, else false 00191 */ 00192 bool operator==(const StackSymbol& other) const; 00193 00194 /** 00195 * Test equality with other stack symbol. 00196 * 00197 * @param other 00198 * stack symbol to compare with 00199 * @return 00200 * True if mSymbol is the same, else false 00201 */ 00202 bool operator<(const StackSymbol& other) const; 00203 00204 /** 00205 * Test if stack symbol is lambda. 00206 * 00207 * @return 00208 * True if mSymbol is lambda, else false 00209 */ 00210 bool IsLambda() const; 00211 00212 /** 00213 * Write mSymbol to string 00214 * @return 00215 * mSymbol as String 00216 */ 00217 std::string ToString() const; 00218 00219 /** 00220 * Tests if mSymbol is an empty String ("") 00221 * @return 00222 * true if mSymbol is an emptry String, else false 00223 */ 00224 bool Empty() const; 00225 00226 }; // end class Stack Symbol 00227 00228 00229 } // namespace faudes 00230 00231 #endif libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen |