spot  1.1.3
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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
21 
24 #ifndef SPOT_LTLAST_UNOP_HH
25 # define SPOT_LTLAST_UNOP_HH
26 
27 #include <map>
28 #include <iosfwd>
29 #include "refformula.hh"
30 #include "bunop.hh"
31 
32 namespace spot
33 {
34  namespace ltl
35  {
36 
39  class unop : public ref_formula
40  {
41  public:
42  enum type {
43  // LTL
44  Not, X, F, G,
45  // ELTL
47  // Closure
49  };
50 
88  static const formula* instance(type op, const formula* child);
89 
90  virtual void accept(visitor& v) const;
91 
93  const formula* child() const;
94 
96  type op() const;
98  const char* op_name() const;
99 
101  virtual std::string dump() const;
102 
104  static unsigned instance_count();
105 
107  static std::ostream& dump_instances(std::ostream& os);
108 
109  protected:
110  typedef std::pair<type, const formula*> pair;
111  typedef std::map<pair, const unop*> map;
112  static map instances;
113 
114  unop(type op, const formula* child);
115  virtual ~unop();
116 
117  private:
119  const formula* child_;
120  };
121 
122 
127  inline
128  const unop*
129  is_unop(const formula* f)
130  {
131  if (f->kind() != formula::UnOp)
132  return 0;
133  return static_cast<const unop*>(f);
134  }
135 
140  inline
141  const unop*
142  is_unop(const formula* f, unop::type op)
143  {
144  if (const unop* uo = is_unop(f))
145  if (uo->op() == op)
146  return uo;
147  return 0;
148  }
149 
153  inline
154  const unop*
155  is_Not(const formula* f)
156  {
157  return is_unop(f, unop::Not);
158  }
159 
163  inline
164  const unop*
165  is_X(const formula* f)
166  {
167  return is_unop(f, unop::X);
168  }
169 
173  inline
174  const unop*
175  is_F(const formula* f)
176  {
177  return is_unop(f, unop::F);
178  }
179 
183  inline
184  const unop*
185  is_G(const formula* f)
186  {
187  return is_unop(f, unop::G);
188  }
189 
193  inline
194  const unop*
195  is_GF(const formula* f)
196  {
197  if (const unop* op = is_G(f))
198  return is_F(op->child());
199  return 0;
200  }
201 
205  inline
206  const unop*
207  is_FG(const formula* f)
208  {
209  if (const unop* op = is_F(f))
210  return is_G(op->child());
211  return 0;
212  }
213  }
214 }
215 
216 #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 Tue Jul 9 2013 14:04:33 for spot by doxygen 1.8.4