spot  0.9.2
unop.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 
26 #ifndef SPOT_LTLAST_UNOP_HH
27 # define SPOT_LTLAST_UNOP_HH
28 
29 #include <map>
30 #include <iosfwd>
31 #include "refformula.hh"
32 #include "bunop.hh"
33 
34 namespace spot
35 {
36  namespace ltl
37  {
38 
41  class unop : public ref_formula
42  {
43  public:
44  enum type {
45  // LTL
46  Not, X, F, G,
47  // ELTL
49  // Closure
51  };
52 
90  static const formula* instance(type op, const formula* child);
91 
92  virtual void accept(visitor& v) const;
93 
95  const formula* child() const;
96 
98  type op() const;
100  const char* op_name() const;
101 
103  virtual std::string dump() const;
104 
106  static unsigned instance_count();
107 
109  static std::ostream& dump_instances(std::ostream& os);
110 
111  protected:
112  typedef std::pair<type, const formula*> pair;
113  typedef std::map<pair, const unop*> map;
114  static map instances;
115 
116  unop(type op, const formula* child);
117  virtual ~unop();
118 
119  private:
121  const formula* child_;
122  };
123 
124 
129  inline
130  const unop*
131  is_unop(const formula* f)
132  {
133  if (f->kind() != formula::UnOp)
134  return 0;
135  return static_cast<const unop*>(f);
136  }
137 
142  inline
143  const unop*
144  is_unop(const formula* f, unop::type op)
145  {
146  if (const unop* uo = is_unop(f))
147  if (uo->op() == op)
148  return uo;
149  return 0;
150  }
151 
155  inline
156  const unop*
157  is_Not(const formula* f)
158  {
159  return is_unop(f, unop::Not);
160  }
161 
165  inline
166  const unop*
167  is_X(const formula* f)
168  {
169  return is_unop(f, unop::X);
170  }
171 
175  inline
176  const unop*
177  is_F(const formula* f)
178  {
179  return is_unop(f, unop::F);
180  }
181 
185  inline
186  const unop*
187  is_G(const formula* f)
188  {
189  return is_unop(f, unop::G);
190  }
191 
195  inline
196  const unop*
197  is_GF(const formula* f)
198  {
199  if (const unop* op = is_G(f))
200  return is_F(op->child());
201  return 0;
202  }
203 
207  inline
208  const unop*
209  is_FG(const formula* f)
210  {
211  if (const unop* op = is_F(f))
212  return is_G(op->child());
213  return 0;
214  }
215  }
216 }
217 
218 #endif // SPOT_LTLAST_UNOP_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