spot/src/ltlast/atomic_prop.hh
Alexandre Duret-Lutz 2c05a9fdb6 ltlast: move all accessor methods to headers to help the optimizer
* src/ltlast/atomic_prop.cc, src/ltlast/atomic_prop.hh,
src/ltlast/automatop.cc, src/ltlast/automatop.hh, src/ltlast/binop.cc,
src/ltlast/binop.hh, src/ltlast/bunop.cc, src/ltlast/bunop.hh,
src/ltlast/constant.cc, src/ltlast/constant.hh, src/ltlast/multop.cc,
src/ltlast/multop.hh, src/ltlast/unop.cc, src/ltlast/unop.hh: Move all
one-line accessors methods like nth(), child(), op()... from *.cc files
to their respective *.hh files.
2014-02-12 10:43:42 +01:00

95 lines
2.7 KiB
C++

// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2012, 2013, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// 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 3 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 this program. If not, see <http://www.gnu.org/licenses/>.
/// \file ltlast/atomic_prop.hh
/// \brief LTL atomic propositions
#ifndef SPOT_LTLAST_ATOMIC_PROP_HH
# define SPOT_LTLAST_ATOMIC_PROP_HH
#include "refformula.hh"
#include <string>
#include <iosfwd>
#include <map>
#include "ltlenv/environment.hh"
namespace spot
{
namespace ltl
{
/// \ingroup ltl_ast
/// \brief Atomic propositions.
class SPOT_API atomic_prop : public ref_formula
{
public:
/// Build an atomic proposition with name \a name in
/// environment \a env.
static const atomic_prop*
instance(const std::string& name, environment& env);
virtual void accept(visitor& visitor) const;
/// Get the name of the atomic proposition.
const std::string& name() const
{
return name_;
}
/// Get the environment of the atomic proposition.
environment& env() const
{
return *env_;
}
/// Return a canonic representation of the atomic proposition
virtual std::string dump() const;
/// 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:
atomic_prop(const std::string& name, environment& env);
virtual ~atomic_prop();
typedef std::pair<std::string, environment*> pair;
typedef std::map<pair, const atomic_prop*> map;
static map instances;
private:
std::string name_;
environment* env_;
};
inline
const atomic_prop*
is_atomic_prop(const formula* f)
{
if (f->kind() != formula::AtomicProp)
return 0;
return static_cast<const atomic_prop*>(f);
}
}
}
#endif // SPOT_LTLAST_ATOMICPROP_HH