spot  0.9.2
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 2 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 Spot; see the file COPYING. If not, write to the Free
21 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 // 02111-1307, USA.
23 
29 #ifndef SPOT_LTLAST_BINOP_HH
30 # define SPOT_LTLAST_BINOP_HH
31 
32 #include <map>
33 #include <iosfwd>
34 #include "refformula.hh"
35 
36 namespace spot
37 {
38  namespace ltl
39  {
40 
43  class binop : public ref_formula
44  {
45  public:
50  enum type { Xor,
53  U, //< until
54  R, //< release (dual of until)
55  W, //< weak until
56  M, //< strong release (dual of weak until)
57  EConcat, // Existential Concatenation
58  EConcatMarked, // Existential Concatenation, Marked
59  UConcat // Universal Concatenation
60  };
61 
109  static const formula* instance(type op,
110  const formula* first,
111  const formula* second);
112 
113  virtual void accept(visitor& v) const;
114 
116  const formula* first() const;
118  const formula* second() const;
119 
121  type op() const;
123  const char* op_name() const;
124 
126  virtual std::string dump() const;
127 
129  static unsigned instance_count();
130 
132  static std::ostream& dump_instances(std::ostream& os);
133 
134  protected:
135  typedef std::pair<const formula*, const formula*> pairf;
136  typedef std::pair<type, pairf> pair;
137  typedef std::map<pair, const binop*> map;
138  static map instances;
139 
140  binop(type op, const formula* first, const formula* second);
141  virtual ~binop();
142 
143  private:
145  const formula* first_;
146  const formula* second_;
147  };
148 
153  inline
154  const binop*
155  is_binop(const formula* f)
156  {
157  if (f->kind() != formula::BinOp)
158  return 0;
159  return static_cast<const binop*>(f);
160  }
161 
166  inline
167  const binop*
169  {
170  if (const binop* bo = is_binop(f))
171  if (bo->op() == op)
172  return bo;
173  return 0;
174  }
175 
180  inline
181  const binop*
183  {
184  if (const binop* bo = is_binop(f))
185  if (bo->op() == op1 || bo->op() == op2)
186  return bo;
187  return 0;
188  }
189 
193  inline
194  const binop*
195  is_U(const formula* f)
196  {
197  return is_binop(f, binop::U);
198  }
199 
203  inline
204  const binop*
205  is_M(const formula* f)
206  {
207  return is_binop(f, binop::M);
208  }
209 
213  inline
214  const binop*
215  is_R(const formula* f)
216  {
217  return is_binop(f, binop::R);
218  }
219 
223  inline
224  const binop*
225  is_W(const formula* f)
226  {
227  return is_binop(f, binop::W);
228  }
229  }
230 }
231 
232 #endif // SPOT_LTLAST_BINOP_HH

Please comment this page and report errors about it on the RefDocComments page.
Generated on Mon Jul 2 2012 17:35:47 for spot by doxygen 1.8.1.1