spot  1.0.2
binop.hh
Go to the documentation of this file.
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2009, 2010, 2011, 2012, 2013 Laboratoire de Recherche
3 // et Développement de l'Epita (LRDE).
4 // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris
5 // 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
6 // Université Pierre et Marie Curie.
7 //
8 // This file is part of Spot, a model checking library.
9 //
10 // Spot is free software; you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation; either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Spot is distributed in the hope that it will be useful, but WITHOUT
16 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
18 // License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 
28 #ifndef SPOT_LTLAST_BINOP_HH
29 # define SPOT_LTLAST_BINOP_HH
30 
31 #include <map>
32 #include <iosfwd>
33 #include "refformula.hh"
34 
35 namespace spot
36 {
37  namespace ltl
38  {
39 
42  class binop : public ref_formula
43  {
44  public:
49  enum type { Xor,
52  U,
53  R,
54  W,
55  M,
59  };
60 
108  static const formula* instance(type op,
109  const formula* first,
110  const formula* second);
111 
112  virtual void accept(visitor& v) const;
113 
115  const formula* first() const;
117  const formula* second() const;
118 
120  type op() const;
122  const char* op_name() const;
123 
125  virtual std::string dump() const;
126 
128  static unsigned instance_count();
129 
131  static std::ostream& dump_instances(std::ostream& os);
132 
133  protected:
134  typedef std::pair<const formula*, const formula*> pairf;
135  typedef std::pair<type, pairf> pair;
136  typedef std::map<pair, const binop*> map;
137  static map instances;
138 
139  binop(type op, const formula* first, const formula* second);
140  virtual ~binop();
141 
142  private:
144  const formula* first_;
145  const formula* second_;
146  };
147 
152  inline
153  const binop*
154  is_binop(const formula* f)
155  {
156  if (f->kind() != formula::BinOp)
157  return 0;
158  return static_cast<const binop*>(f);
159  }
160 
165  inline
166  const binop*
168  {
169  if (const binop* bo = is_binop(f))
170  if (bo->op() == op)
171  return bo;
172  return 0;
173  }
174 
179  inline
180  const binop*
182  {
183  if (const binop* bo = is_binop(f))
184  if (bo->op() == op1 || bo->op() == op2)
185  return bo;
186  return 0;
187  }
188 
192  inline
193  const binop*
194  is_U(const formula* f)
195  {
196  return is_binop(f, binop::U);
197  }
198 
202  inline
203  const binop*
204  is_M(const formula* f)
205  {
206  return is_binop(f, binop::M);
207  }
208 
212  inline
213  const binop*
214  is_R(const formula* f)
215  {
216  return is_binop(f, binop::R);
217  }
218 
222  inline
223  const binop*
224  is_W(const formula* f)
225  {
226  return is_binop(f, binop::W);
227  }
228  }
229 }
230 
231 #endif // SPOT_LTLAST_BINOP_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