spot  1.2.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
unop.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 
25 #ifndef SPOT_LTLAST_UNOP_HH
26 # define SPOT_LTLAST_UNOP_HH
27 
28 #include <map>
29 #include <iosfwd>
30 #include "refformula.hh"
31 #include "bunop.hh"
32 
33 namespace spot
34 {
35  namespace ltl
36  {
37 
40  class SPOT_API unop : public ref_formula
41  {
42  public:
43  enum type {
44  // LTL
45  Not, X, F, G,
46  // ELTL
47  Finish,
48  // Closure
49  Closure, NegClosure, NegClosureMarked
50  };
51 
89  static const formula* instance(type op, const formula* child);
90 
91  virtual void accept(visitor& v) const;
92 
94  const formula* child() const
95  {
96  return child_;
97  }
98 
100  type op() const
101  {
102  return op_;
103  }
104 
106  const char* op_name() const;
107 
109  virtual std::string dump() const;
110 
112  static unsigned instance_count();
113 
115  static std::ostream& dump_instances(std::ostream& os);
116 
117  protected:
118  typedef std::pair<type, const formula*> pair;
119  typedef std::map<pair, const unop*> map;
120  static map instances;
121 
122  unop(type op, const formula* child);
123  virtual ~unop();
124 
125  private:
126  type op_;
127  const formula* child_;
128  };
129 
130 
135  inline
136  const unop*
137  is_unop(const formula* f)
138  {
139  if (f->kind() != formula::UnOp)
140  return 0;
141  return static_cast<const unop*>(f);
142  }
143 
148  inline
149  const unop*
150  is_unop(const formula* f, unop::type op)
151  {
152  if (const unop* uo = is_unop(f))
153  if (uo->op() == op)
154  return uo;
155  return 0;
156  }
157 
161  inline
162  const unop*
163  is_Not(const formula* f)
164  {
165  return is_unop(f, unop::Not);
166  }
167 
171  inline
172  const unop*
173  is_X(const formula* f)
174  {
175  return is_unop(f, unop::X);
176  }
177 
181  inline
182  const unop*
183  is_F(const formula* f)
184  {
185  return is_unop(f, unop::F);
186  }
187 
191  inline
192  const unop*
193  is_G(const formula* f)
194  {
195  return is_unop(f, unop::G);
196  }
197 
201  inline
202  const unop*
203  is_GF(const formula* f)
204  {
205  if (const unop* op = is_G(f))
206  return is_F(op->child());
207  return 0;
208  }
209 
213  inline
214  const unop*
215  is_FG(const formula* f)
216  {
217  if (const unop* op = is_F(f))
218  return is_G(op->child());
219  return 0;
220  }
221  }
222 }
223 
224 #endif // SPOT_LTLAST_UNOP_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