unop.hh 2.14 KB
Newer Older
1
// Copyright (C) 2003, 2004  Laboratoire d'Informatique de Paris 6 (LIP6),
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Spot; see the file COPYING.  If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.

22
23
/// \file ltlast/unop.hh
/// \brief LTL unary operators
24
25
26
#ifndef SPOT_LTLAST_UNOP_HH
# define SPOT_LTLAST_UNOP_HH

27
#include <map>
28
#include "refformula.hh"
29
30
31
32
33

namespace spot
{
  namespace ltl
  {
34

35
    /// Unary operator.
36
    class unop : public ref_formula
37
38
39
40
    {
    public:
      enum type { Not, X, F, G };

41
42
43
      /// Build an unary operator with operation \a op and
      /// child \a child.
      static unop* instance(type op, formula* child);
44
45
46
47

      virtual void accept(visitor& v);
      virtual void accept(const_visitor& v) const;

48
      /// Get the sole operand of this operator.
49
      const formula* child() const;
50
      /// Get the sole operand of this operator.
51
      formula* child();
52

53
      /// Get the type of this operator.
54
      type op() const;
55
      /// Get the type of this operator, as a string.
56
57
      const char* op_name() const;

58
59
60
      /// Number of instantiated unary operators.  For debugging.
      static unsigned instance_count();

61
62
63
64
65
66
67
68
    protected:
      typedef std::pair<type, formula*> pair;
      typedef std::map<pair, formula*> map;
      static map instances;

      unop(type op, formula* child);
      virtual ~unop();

69
70
    private:
      type op_;
71
      formula* child_;
72
73
74
75
76
77
    };

  }
}

#endif // SPOT_LTLAST_UNOP_HH