pd_gotoattributes.hGo to the documentation of this file.00001 /** @file pd_gotoattributes.h Attributes for LR machines */ 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_GOTOATTRIBUTES_H 00012 #define FAUDES_PD_GOTOATTRIBUTES_H 00013 00014 #include "corefaudes.h" 00015 #include "pd_parser.h" 00016 00017 namespace faudes { 00018 00019 /** 00020 * 00021 * Event attribute with grammar symbols. 00022 * 00023 * @ingroup PushdownPlugin 00024 * 00025 */ 00026 00027 class AttributeGotoTransition : public AttributeVoid { 00028 00029 FAUDES_TYPE_DECLARATION(Void,AttributeGotoTransition,AttributeVoid) 00030 00031 public: 00032 00033 /** Constructor */ 00034 AttributeGotoTransition(void) { mpGrammarSymbol = GrammarSymbolPtr(); }; 00035 00036 /** 00037 * Test for default value (no grammar symbol set) 00038 * 00039 * @return 00040 * True for default value 00041 */ 00042 virtual bool IsDefault(void) const {return mpGrammarSymbol == 0; }; 00043 00044 /** Grammar Symbols */ 00045 GrammarSymbolPtr mpGrammarSymbol; 00046 00047 /** 00048 * Getter for mpGrammarSymbol 00049 * 00050 * @return 00051 * the grammar symbol 00052 */ 00053 const GrammarSymbolPtr& Symbol() const { return mpGrammarSymbol; } 00054 00055 /** 00056 * Setter for mpGrammarSymbol 00057 * 00058 * @param symbol 00059 * the grammar symbol 00060 */ 00061 void Symbol(const GrammarSymbolPtr& symbol) { mpGrammarSymbol = symbol; } 00062 00063 protected: 00064 00065 /** 00066 * Assignment method. 00067 * 00068 * @param rSrcAttr 00069 * Source to assign from 00070 */ 00071 void DoAssign(const AttributeGotoTransition& rSrcAttr); 00072 00073 /** 00074 * Test equality. 00075 * 00076 * @param rOther 00077 * Other attribute to compare with. 00078 */ 00079 bool DoEqual(const AttributeGotoTransition& rOther) const; 00080 00081 /** 00082 * Reads the attribute from TokenReader, see AttributeVoid for public wrappers. 00083 * 00084 * If the current token indicates a Clocks section, the method reads the global 00085 * timing data from that section. Else, it does nothing. Exceptions may only be thrown 00086 * on invalid data within the timing section. The context argument is ignored, the 00087 * label argument can be used to override the default section name Clocks. 00088 * 00089 * @param rTr 00090 * TokenReader to read from 00091 * @param rLabel 00092 * Section to read 00093 * @param pContext 00094 * Read context to provide contextual information 00095 * 00096 * @exception Exception 00097 * - IO error (id 1) 00098 */ 00099 virtual void DoRead(TokenReader& rTr,const std::string& rLabel="", const Type* pContext=0); 00100 00101 /** 00102 * Writes the attribute to TokenWriter, see AttributeVoid for public wrappers. 00103 * 00104 * Writes a Clocks section to include global timing data. The label argument 00105 * can be used to set a section label different the the default Clocks. 00106 * Th context argument is ignored. 00107 * 00108 * @param rTw 00109 * TokenWriter to write to 00110 * @param rLabel 00111 * Section to write 00112 * @param pContext 00113 * Write context to provide contextual information 00114 * 00115 * @exception Exception 00116 * - IO error (id 2) 00117 */ 00118 virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const; 00119 00120 };//class AttributeGotoTransition 00121 00122 00123 /** 00124 * 00125 * State attribute with configuration set 00126 * 00127 * @ingroup PushdownPlugin 00128 * 00129 */ 00130 00131 class AttributeGotoState : public AttributeFlags { 00132 00133 FAUDES_TYPE_DECLARATION(Void,AttributeGotoState,AttributeFlags) 00134 00135 public: 00136 00137 /** Constructor */ 00138 AttributeGotoState(void) : AttributeFlags() { }; 00139 00140 /** 00141 * Test for default value (ie default flags) 00142 * 00143 * @return 00144 * True for default value 00145 */ 00146 virtual bool IsDefault(void) const {return AttributeFlags::IsDefault() && mConfigSet.empty(); }; 00147 00148 /** Configuration set */ 00149 std::set<Lr1Configuration> mConfigSet; 00150 00151 /** 00152 * Getter for mConfigSet 00153 * 00154 * @return 00155 * the config set 00156 */ 00157 const std::set<Lr1Configuration>& ConfigSet() const { return mConfigSet; } 00158 00159 /** 00160 * Setter for ConfigSet 00161 * 00162 * @param configs 00163 * the config set 00164 */ 00165 void ConfigSet(const std::set<Lr1Configuration>& configs) { mConfigSet = configs; } 00166 00167 protected: 00168 00169 00170 00171 /** 00172 * Assignment method. 00173 * 00174 * @param rSrcAttr 00175 * Source to assign from 00176 */ 00177 void DoAssign(const AttributeGotoState& rSrcAttr); 00178 00179 00180 /** 00181 * Test eaulity. 00182 * 00183 * @param rOther 00184 * Other attribute to compare with. 00185 */ 00186 bool DoEqual(const AttributeGotoState& rOther) const; 00187 00188 /** 00189 * Reads the attribute from TokenReader, see AttributeVoid for public wrappers. 00190 * 00191 * If the current token indicates a invariant section, the method reads the invariant 00192 * from that section. Else, it does nothing. Exceptions may only be thrown 00193 * on invalid data within the timing section. The context argument is ignored, the 00194 * label argument can be used to override the default section name Invariant. 00195 * 00196 * @param rTr 00197 * TokenReader to read from 00198 * @param rLabel 00199 * Section to read 00200 * @param pContext 00201 * Read context to provide contextual information 00202 * 00203 * @exception Exception 00204 * - IO error (id 1) 00205 */ 00206 virtual void DoRead(TokenReader& rTr, const std::string& rLabel="", const Type* pContext=0); 00207 00208 /** 00209 * Writes the attribute to TokenWriter, see AttributeVoid for public wrappers. 00210 * 00211 * Writes am Invariant section to include data on the invariant. The label argument 00212 * can be used to set a section label different the the default Invariant. 00213 * Th context argument is ignored. 00214 * 00215 * @param rTw 00216 * TokenWriter to write to 00217 * @param rLabel 00218 * Section to write 00219 * @param pContext 00220 * Write context to provide contextual information 00221 * 00222 * @exception Exception 00223 * - IO error (id 2) 00224 */ 00225 virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const; 00226 00227 00228 }; // class AttributePushdownState 00229 00230 00231 00232 00233 00234 00235 00236 00237 00238 00239 00240 } // namespace faudes 00241 00242 #endif libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen |