spot  1.99.3
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
constant.hh
Go to the documentation of this file.
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2009, 2010, 2012, 2013, 2014 Laboratoire de Recherche
3 // et Développement de l'Epita (LRDE).
4 // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
5 //
6 // This file is part of Spot, a model checking library.
7 //
8 // Spot is free software; you can redistribute it and/or modify it
9 // under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 3 of the License, or
11 // (at your option) any later version.
12 //
13 // Spot is distributed in the hope that it will be useful, but WITHOUT
14 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
16 // License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 
23 #pragma once
24 
25 #include "formula.hh"
26 
27 namespace spot
28 {
29  namespace ltl
30  {
31 
34  class SPOT_API constant final : public formula
35  {
36  public:
37  enum type { False, True, EmptyWord };
38  virtual void accept(visitor& v) const override;
39 
41  type val() const
42  {
43  return val_;
44  }
45 
47  const char* val_name() const;
48 
49  virtual std::string dump() const override;
50 
52  static constant* true_instance() { return &true_instance_; }
54  static constant* false_instance() { return &false_instance_; }
56  static constant* empty_word_instance() { return &empty_word_instance_; }
57 
58  protected:
59  constant(type val);
60  virtual ~constant();
61 
62  private:
63  type val_;
64 
65  static constant true_instance_;
66  static constant false_instance_;
67  static constant empty_word_instance_;
68  // If you add new constants here, be sure to update the
69  // formula::formula() constructor.
70  };
71 
72 
77  inline
78  const constant*
79  is_constant(const formula* f)
80  {
81  if (f->kind() != formula::Constant)
82  return 0;
83  return static_cast<const constant*>(f);
84  }
85  }
86 }
Definition: public.hh:31
A constant (True or False)
Definition: constant.hh:34
LTL formula interface.
Formula visitor.
Definition: visitor.hh:40
type val() const
Return the value of the constant.
Definition: constant.hh:41
static constant * empty_word_instance()
Get the sole instance of spot::ltl::constant::constant(EmptyWord).
Definition: constant.hh:56
SPOT_API std::ostream & dump(std::ostream &os, const formula *f)
Dump a formula tree.
static constant * true_instance()
Get the sole instance of spot::ltl::constant::constant(True).
Definition: constant.hh:52
static constant * false_instance()
Get the sole instance of spot::ltl::constant::constant(False).
Definition: constant.hh:54
An LTL formula.
Definition: formula.hh:71

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Wed Aug 26 2015 08:42:37 for spot by doxygen 1.8.8