spot  1.0
binop.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 
27 #ifndef SPOT_LTLAST_BINOP_HH
28 # define SPOT_LTLAST_BINOP_HH
29 
30 #include <map>
31 #include <iosfwd>
32 #include "refformula.hh"
33 
34 namespace spot
35 {
36  namespace ltl
37  {
38 
41  class binop : public ref_formula
42  {
43  public:
48  enum type { Xor,
51  U, //< until
52  R, //< release (dual of until)
53  W, //< weak until
54  M, //< strong release (dual of weak until)
55  EConcat, // Existential Concatenation
56  EConcatMarked, // Existential Concatenation, Marked
57  UConcat // Universal Concatenation
58  };
59 
107  static const formula* instance(type op,
108  const formula* first,
109  const formula* second);
110 
111  virtual void accept(visitor& v) const;
112 
114  const formula* first() const;
116  const formula* second() const;
117 
119  type op() const;
121  const char* op_name() const;
122 
124  virtual std::string dump() const;
125 
127  static unsigned instance_count();
128 
130  static std::ostream& dump_instances(std::ostream& os);
131 
132  protected:
133  typedef std::pair<const formula*, const formula*> pairf;
134  typedef std::pair<type, pairf> pair;
135  typedef std::map<pair, const binop*> map;
136  static map instances;
137 
138  binop(type op, const formula* first, const formula* second);
139  virtual ~binop();
140 
141  private:
143  const formula* first_;
144  const formula* second_;
145  };
146 
151  inline
152  const binop*
153  is_binop(const formula* f)
154  {
155  if (f->kind() != formula::BinOp)
156  return 0;
157  return static_cast<const binop*>(f);
158  }
159 
164  inline
165  const binop*
167  {
168  if (const binop* bo = is_binop(f))
169  if (bo->op() == op)
170  return bo;
171  return 0;
172  }
173 
178  inline
179  const binop*
181  {
182  if (const binop* bo = is_binop(f))
183  if (bo->op() == op1 || bo->op() == op2)
184  return bo;
185  return 0;
186  }
187 
191  inline
192  const binop*
193  is_U(const formula* f)
194  {
195  return is_binop(f, binop::U);
196  }
197 
201  inline
202  const binop*
203  is_M(const formula* f)
204  {
205  return is_binop(f, binop::M);
206  }
207 
211  inline
212  const binop*
213  is_R(const formula* f)
214  {
215  return is_binop(f, binop::R);
216  }
217 
221  inline
222  const binop*
223  is_W(const formula* f)
224  {
225  return is_binop(f, binop::W);
226  }
227  }
228 }
229 
230 #endif // SPOT_LTLAST_BINOP_HH

Please comment this page and report errors about it on the RefDocComments page.
Generated on Sat Oct 27 2012 09:34:32 for spot by doxygen 1.8.1.2