atomic_prop.hh 2.64 KB
Newer Older
1
2
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2012 Laboratoire de Recherche et Développement
Guillaume Sadegh's avatar
Guillaume Sadegh committed
3
4
// de l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
5
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
6
// et Marie Curie.
7
8
9
10
11
//
// 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
12
// the Free Software Foundation; either version 3 of the License, or
13
14
15
16
17
18
19
20
// (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
21
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
22

23
24
25
26
/// \file ltlast/atomic_prop.hh
/// \brief LTL atomic propositions
#ifndef SPOT_LTLAST_ATOMIC_PROP_HH
# define SPOT_LTLAST_ATOMIC_PROP_HH
27
28
29
30
31

#include <string>
#include <iosfwd>
#include <map>
#include "refformula.hh"
32
#include "ltlenv/environment.hh"
33
34
35

namespace spot
{
36
  namespace ltl
37
38
  {

39
    /// \ingroup ltl_ast
40
    /// \brief Atomic propositions.
41
    class atomic_prop : public ref_formula
42
43
44
45
    {
    public:
      /// Build an atomic proposition with name \a name in
      /// environment \a env.
46
47
      static const atomic_prop*
      instance(const std::string& name, environment& env);
48

49
      virtual void accept(visitor& visitor) const;
50
51
52
53

      /// Get the name of the atomic proposition.
      const std::string& name() const;
      /// Get the environment of the atomic proposition.
54
      environment& env() const;
55

56
57
58
      /// Return a canonic representation of the atomic proposition
      virtual std::string dump() const;

59
60
61
62
63
64
      /// Number of instantiated atomic propositions.  For debugging.
      static unsigned instance_count();
      /// List all instances of atomic propositions.  For debugging.
      static std::ostream& dump_instances(std::ostream& os);

    protected:
65
      atomic_prop(const std::string& name, environment& env);
66
67
      virtual ~atomic_prop();

68
      typedef std::pair<std::string, environment*> pair;
69
      typedef std::map<pair, const atomic_prop*> map;
70
71
72
73
      static map instances;

    private:
      std::string name_;
74
      environment* env_;
75
76
    };

77
78
79
80
81
82
83
84
    inline
    const atomic_prop*
    is_atomic_prop(const formula* f)
    {
      if (f->kind() != formula::AtomicProp)
	return 0;
      return static_cast<const atomic_prop*>(f);
    }
85
86
87
  }
}

88
#endif // SPOT_LTLAST_ATOMICPROP_HH