spot  1.2.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
binop.hh
Go to the documentation of this file.
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Laboratoire de
3 // Recherche 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 "refformula.hh"
32 #include <map>
33 #include <iosfwd>
34 
35 namespace spot
36 {
37  namespace ltl
38  {
39 
42  class SPOT_API binop : public ref_formula
43  {
44  public:
49  enum type { Xor,
50  Implies,
51  Equiv,
52  U,
53  R,
54  W,
55  M,
58  UConcat
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
116  {
117  return first_;
118  }
119 
121  const formula* second() const
122  {
123  return second_;
124  }
125 
127  type op() const
128  {
129  return op_;
130  }
131 
133  const char* op_name() const;
134 
136  virtual std::string dump() const;
137 
139  static unsigned instance_count();
140 
142  static std::ostream& dump_instances(std::ostream& os);
143 
144  protected:
145  typedef std::pair<const formula*, const formula*> pairf;
146  typedef std::pair<type, pairf> pair;
147  typedef std::map<pair, const binop*> map;
148  static map instances;
149 
150  binop(type op, const formula* first, const formula* second);
151  virtual ~binop();
152 
153  private:
154  type op_;
155  const formula* first_;
156  const formula* second_;
157  };
158 
163  inline
164  const binop*
165  is_binop(const formula* f)
166  {
167  if (f->kind() != formula::BinOp)
168  return 0;
169  return static_cast<const binop*>(f);
170  }
171 
176  inline
177  const binop*
178  is_binop(const formula* f, binop::type op)
179  {
180  if (const binop* bo = is_binop(f))
181  if (bo->op() == op)
182  return bo;
183  return 0;
184  }
185 
190  inline
191  const binop*
192  is_binop(const formula* f, binop::type op1, binop::type op2)
193  {
194  if (const binop* bo = is_binop(f))
195  if (bo->op() == op1 || bo->op() == op2)
196  return bo;
197  return 0;
198  }
199 
203  inline
204  const binop*
205  is_U(const formula* f)
206  {
207  return is_binop(f, binop::U);
208  }
209 
213  inline
214  const binop*
215  is_M(const formula* f)
216  {
217  return is_binop(f, binop::M);
218  }
219 
223  inline
224  const binop*
225  is_R(const formula* f)
226  {
227  return is_binop(f, binop::R);
228  }
229 
233  inline
234  const binop*
235  is_W(const formula* f)
236  {
237  return is_binop(f, binop::W);
238  }
239  }
240 }
241 
242 #endif // SPOT_LTLAST_BINOP_HH

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Thu May 15 2014 11:04:11 for spot by doxygen 1.8.4