spot  1.1.3
bunop.hh
Go to the documentation of this file.
1 // Copyright (C) 2010, 2011, 2012 Laboratoire de Recherche et Développement
2 // de l'Epita (LRDE).
3 //
4 // This file is part of Spot, a model checking library.
5 //
6 // Spot is free software; you can redistribute it and/or modify it
7 // under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // Spot is distributed in the hope that it will be useful, but WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 // License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
21 #ifndef SPOT_LTLAST_BUNOP_HH
22 # define SPOT_LTLAST_BUNOP_HH
23 
24 #include <map>
25 #include <iosfwd>
26 #include "refformula.hh"
27 #include "constant.hh"
28 
29 namespace spot
30 {
31  namespace ltl
32  {
33 
36  class bunop : public ref_formula
37  {
38  public:
39  enum type { Star };
40 
41  static const unsigned unbounded = -1U;
42 
58  static const formula* instance(type op,
59  const formula* child,
60  unsigned min = 0,
61  unsigned max = unbounded);
62 
72  static const formula* sugar_goto(const formula* child,
73  unsigned min = 1,
74  unsigned max = unbounded);
75 
82  static const formula* sugar_equal(const formula* child,
83  unsigned min = 0,
84  unsigned max = unbounded);
85 
86  virtual void accept(visitor& v) const;
87 
89  const formula* child() const;
90 
92  unsigned min() const;
94  unsigned max() const;
95 
99  std::string format() const;
100 
102  type op() const;
104  const char* op_name() const;
105 
107  virtual std::string dump() const;
108 
110  static unsigned instance_count();
111 
113  static std::ostream& dump_instances(std::ostream& os);
114 
120  static const formula* one_star()
121  {
122  if (!one_star_)
124  return one_star_;
125  }
126 
127  protected:
128  typedef std::pair<unsigned, unsigned> pairu;
129  typedef std::pair<type, const formula*> pairo;
130  typedef std::pair<pairo, pairu> pair;
131  typedef std::map<pair, const bunop*> map;
132  static map instances;
133 
134  bunop(type op, const formula* child, unsigned min, unsigned max);
135  virtual ~bunop();
136 
137  private:
139  const formula* child_;
140  unsigned min_;
141  unsigned max_;
142  static const formula* one_star_;
143  };
144 
149  inline
150  const bunop*
151  is_bunop(const formula* f)
152  {
153  if (f->kind() != formula::BUnOp)
154  return 0;
155  return static_cast<const bunop*>(f);
156  }
157 
162  inline
163  const bunop*
165  {
166  if (const bunop* bo = is_bunop(f))
167  if (bo->op() == op)
168  return bo;
169  return 0;
170  }
171 
175  inline
176  const bunop*
177  is_Star(const formula* f)
178  {
179  return is_bunop(f, bunop::Star);
180  }
181 
185  inline
186  const bunop*
188  {
189  if (const bunop* b = is_Star(f))
190  if (b->min() == 0 && b->max() == bunop::unbounded)
191  return b;
192  return 0;
193  }
194 
195  }
196 }
197 #endif // SPOT_LTLAST_BUNOP_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