spot  1.99.3
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Modules 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 #pragma once
29 
30 #include "formula.hh"
31 #include <map>
32 #include <iosfwd>
33 #include <tuple>
34 
35 namespace spot
36 {
37  namespace ltl
38  {
39 
42  class SPOT_API binop final: public 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 override;
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 override;
137 
139  static unsigned instance_count();
140 
142  static std::ostream& dump_instances(std::ostream& os);
143 
144  protected:
145  typedef std::tuple<type, const formula*, const formula*> key;
146  typedef std::map<key, const binop*> map;
147  static map instances;
148 
149  binop(type op, const formula* first, const formula* second);
150  virtual ~binop();
151 
152  private:
153  type op_;
154  const formula* first_;
155  const formula* second_;
156  };
157 
162  inline
163  const binop*
164  is_binop(const formula* f)
165  {
166  if (f->kind() != formula::BinOp)
167  return 0;
168  return static_cast<const binop*>(f);
169  }
170 
175  inline
176  const binop*
177  is_binop(const formula* f, binop::type op)
178  {
179  if (const binop* bo = is_binop(f))
180  if (bo->op() == op)
181  return bo;
182  return 0;
183  }
184 
189  inline
190  const binop*
191  is_binop(const formula* f, binop::type op1, binop::type op2)
192  {
193  if (const binop* bo = is_binop(f))
194  if (bo->op() == op1 || bo->op() == op2)
195  return bo;
196  return 0;
197  }
198 
202  inline
203  const binop*
204  is_U(const formula* f)
205  {
206  return is_binop(f, binop::U);
207  }
208 
212  inline
213  const binop*
214  is_M(const formula* f)
215  {
216  return is_binop(f, binop::M);
217  }
218 
222  inline
223  const binop*
224  is_R(const formula* f)
225  {
226  return is_binop(f, binop::R);
227  }
228 
232  inline
233  const binop*
234  is_W(const formula* f)
235  {
236  return is_binop(f, binop::W);
237  }
238  }
239 }
Definition: public.hh:31
strong release (dual of weak until)
Definition: binop.hh:55
type op() const
Get the type of this operator.
Definition: binop.hh:127
LTL formula interface.
Binary operator.
Definition: binop.hh:42
Formula visitor.
Definition: visitor.hh:40
type
Definition: binop.hh:49
weak until
Definition: binop.hh:54
Existential Concatenation, Marked.
Definition: binop.hh:57
Existential Concatenation.
Definition: binop.hh:56
const formula * first() const
Get the first operand.
Definition: binop.hh:115
SPOT_API std::ostream & dump(std::ostream &os, const formula *f)
Dump a formula tree.
const formula * second() const
Get the second operand.
Definition: binop.hh:121
An LTL formula.
Definition: formula.hh:71
until
Definition: binop.hh:52
release (dual of until)
Definition: binop.hh:53

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Wed Aug 26 2015 08:42:37 for spot by doxygen 1.8.8