spot  1.0.2
multop.hh
Go to the documentation of this file.
1 // Copyright (C) 2009, 2010, 2011, 2012 Laboratoire de Recherche et
2 // Développement de l'Epita (LRDE).
3 // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris
4 // 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
5 // Université Pierre et Marie Curie.
6 //
7 // This file is part of Spot, a model checking library.
8 //
9 // Spot is free software; you can redistribute it and/or modify it
10 // under the terms of the GNU General Public License as published by
11 // the Free Software Foundation; either version 3 of the License, or
12 // (at your option) any later version.
13 //
14 // Spot is distributed in the hope that it will be useful, but WITHOUT
15 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
17 // License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program. If not, see <http://www.gnu.org/licenses/>.
21 
24 #ifndef SPOT_LTLAST_MULTOP_HH
25 # define SPOT_LTLAST_MULTOP_HH
26 
27 #include <vector>
28 #include <map>
29 #include <iosfwd>
30 #include "refformula.hh"
31 
32 namespace spot
33 {
34  namespace ltl
35  {
36 
39  class multop : public ref_formula
40  {
41  public:
43 
45  typedef std::vector<const formula*> vec;
46 
58  static const formula*
59  instance(type op, const formula* first, const formula* second);
60 
122  static const formula* instance(type op, vec* v);
123 
124  virtual void accept(visitor& v) const;
125 
127  unsigned size() const;
131  const formula* nth(unsigned n) const;
132 
138  const formula* all_but(unsigned n) const;
139 
141  type op() const;
143  const char* op_name() const;
144 
146  virtual std::string dump() const;
147 
149  static unsigned instance_count();
150 
152  static std::ostream& dump_instances(std::ostream& os);
153 
154  protected:
155  typedef std::pair<type, vec*> pair;
157  struct paircmp
158  {
159  bool
160  operator()(const pair& p1, const pair& p2) const
161  {
162  if (p1.first != p2.first)
163  return p1.first < p2.first;
164  return *p1.second < *p2.second;
165  }
166  };
167  typedef std::map<pair, const multop*, paircmp> map;
168  static map instances;
169 
170  multop(type op, vec* v);
171  virtual ~multop();
172 
173  private:
176  };
177 
178 
183  inline
184  const multop*
185  is_multop(const formula* f)
186  {
187  if (f->kind() != formula::MultOp)
188  return 0;
189  return static_cast<const multop*>(f);
190  }
191 
196  inline
197  const multop*
199  {
200  if (const multop* mo = is_multop(f))
201  if (mo->op() == op)
202  return mo;
203  return 0;
204  }
205 
210  inline
211  const multop*
213  {
214  if (const multop* mo = is_multop(f))
215  if (mo->op() == op1 || mo->op() == op2)
216  return mo;
217  return 0;
218  }
219 
223  inline
224  const multop*
225  is_And(const formula* f)
226  {
227  return is_multop(f, multop::And);
228  }
229 
233  inline
234  const multop*
235  is_AndRat(const formula* f)
236  {
237  return is_multop(f, multop::AndRat);
238  }
239 
243  inline
244  const multop*
245  is_AndNLM(const formula* f)
246  {
247  return is_multop(f, multop::AndNLM);
248  }
249 
253  inline
254  const multop*
255  is_Or(const formula* f)
256  {
257  return is_multop(f, multop::Or);
258  }
259 
263  inline
264  const multop*
265  is_OrRat(const formula* f)
266  {
267  return is_multop(f, multop::OrRat);
268  }
269 
273  inline
274  const multop*
275  is_Concat(const formula* f)
276  {
277  return is_multop(f, multop::Concat);
278  }
279 
283  inline
284  const multop*
285  is_Fusion(const formula* f)
286  {
287  return is_multop(f, multop::Fusion);
288  }
289  }
290 }
291 
292 #endif // SPOT_LTLAST_MULTOP_HH

Please comment this page and report errors about it on the RefDocComments page.
Generated on Wed Mar 6 2013 09:25:14 for spot by doxygen 1.8.1.2