pd_gotoattributes.h
Go to the documentation of this file.
1 /** @file pd_gotoattributes.h Attributes for LR machines */
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_GOTOATTRIBUTES_H
12 #define FAUDES_PD_GOTOATTRIBUTES_H
13 
14 #include "corefaudes.h"
15 #include "pd_parser.h"
16 
17 namespace faudes {
18 
19  /**
20  *
21  * Event attribute with grammar symbols.
22  *
23  * @ingroup PushdownPlugin
24  *
25  */
26 
28 
30 
31  public:
32 
33  /** Constructor */
35 
36  /**
37  * Test for default value (no grammar symbol set)
38  *
39  * @return
40  * True for default value
41  */
42  virtual bool IsDefault(void) const {return mpGrammarSymbol == 0; };
43 
44  /** Grammar Symbols */
46 
47  /**
48  * Getter for mpGrammarSymbol
49  *
50  * @return
51  * the grammar symbol
52  */
53  const GrammarSymbolPtr& Symbol() const { return mpGrammarSymbol; }
54 
55  /**
56  * Setter for mpGrammarSymbol
57  *
58  * @param symbol
59  * the grammar symbol
60  */
61  void Symbol(const GrammarSymbolPtr& symbol) { mpGrammarSymbol = symbol; }
62 
63  protected:
64 
65  /**
66  * Assignment method.
67  *
68  * @param rSrcAttr
69  * Source to assign from
70  */
71  void DoAssign(const AttributeGotoTransition& rSrcAttr);
72 
73  /**
74  * Test equality.
75  *
76  * @param rOther
77  * Other attribute to compare with.
78  */
79  bool DoEqual(const AttributeGotoTransition& rOther) const;
80 
81  /**
82  * Reads the attribute from TokenReader, see AttributeVoid for public wrappers.
83  *
84  * If the current token indicates a Clocks section, the method reads the global
85  * timing data from that section. Else, it does nothing. Exceptions may only be thrown
86  * on invalid data within the timing section. The context argument is ignored, the
87  * label argument can be used to override the default section name Clocks.
88  *
89  * @param rTr
90  * TokenReader to read from
91  * @param rLabel
92  * Section to read
93  * @param pContext
94  * Read context to provide contextual information
95  *
96  * @exception Exception
97  * - IO error (id 1)
98  */
99  virtual void DoRead(TokenReader& rTr,const std::string& rLabel="", const Type* pContext=0);
100 
101  /**
102  * Writes the attribute to TokenWriter, see AttributeVoid for public wrappers.
103  *
104  * Writes a Clocks section to include global timing data. The label argument
105  * can be used to set a section label different the the default Clocks.
106  * Th context argument is ignored.
107  *
108  * @param rTw
109  * TokenWriter to write to
110  * @param rLabel
111  * Section to write
112  * @param pContext
113  * Write context to provide contextual information
114  *
115  * @exception Exception
116  * - IO error (id 2)
117  */
118  virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const;
119 
120 };//class AttributeGotoTransition
121 
122 
123 /**
124  *
125  * State attribute with configuration set
126  *
127  * @ingroup PushdownPlugin
128  *
129  */
130 
132 
134 
135  public:
136 
137  /** Constructor */
139 
140  /**
141  * Test for default value (ie default flags)
142  *
143  * @return
144  * True for default value
145  */
146  virtual bool IsDefault(void) const {return AttributeFlags::IsDefault() && mConfigSet.empty(); };
147 
148  /** Configuration set */
149  std::set<Lr1Configuration> mConfigSet;
150 
151  /**
152  * Getter for mConfigSet
153  *
154  * @return
155  * the config set
156  */
157  const std::set<Lr1Configuration>& ConfigSet() const { return mConfigSet; }
158 
159  /**
160  * Setter for ConfigSet
161  *
162  * @param configs
163  * the config set
164  */
165  void ConfigSet(const std::set<Lr1Configuration>& configs) { mConfigSet = configs; }
166 
167  protected:
168 
169 
170 
171  /**
172  * Assignment method.
173  *
174  * @param rSrcAttr
175  * Source to assign from
176  */
177  void DoAssign(const AttributeGotoState& rSrcAttr);
178 
179 
180  /**
181  * Test eaulity.
182  *
183  * @param rOther
184  * Other attribute to compare with.
185  */
186  bool DoEqual(const AttributeGotoState& rOther) const;
187 
188  /**
189  * Reads the attribute from TokenReader, see AttributeVoid for public wrappers.
190  *
191  * If the current token indicates a invariant section, the method reads the invariant
192  * from that section. Else, it does nothing. Exceptions may only be thrown
193  * on invalid data within the timing section. The context argument is ignored, the
194  * label argument can be used to override the default section name Invariant.
195  *
196  * @param rTr
197  * TokenReader to read from
198  * @param rLabel
199  * Section to read
200  * @param pContext
201  * Read context to provide contextual information
202  *
203  * @exception Exception
204  * - IO error (id 1)
205  */
206  virtual void DoRead(TokenReader& rTr, const std::string& rLabel="", const Type* pContext=0);
207 
208  /**
209  * Writes the attribute to TokenWriter, see AttributeVoid for public wrappers.
210  *
211  * Writes am Invariant section to include data on the invariant. The label argument
212  * can be used to set a section label different the the default Invariant.
213  * Th context argument is ignored.
214  *
215  * @param rTw
216  * TokenWriter to write to
217  * @param rLabel
218  * Section to write
219  * @param pContext
220  * Write context to provide contextual information
221  *
222  * @exception Exception
223  * - IO error (id 2)
224  */
225  virtual void DoWrite(TokenWriter& rTw, const std::string& rLabel="", const Type* pContext=0) const;
226 
227 
228 }; // class AttributePushdownState
229 
230 
231 
232 
233 
234 
235 
236 
237 
238 
239 
240 } // namespace faudes
241 
242 #endif

libFAUDES 2.26g --- 2015.08.17 --- c++ api documentaion by doxygen