Commit 4f1535c8 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

defaultenv: simplify usage

* src/ltlenv/defaultenv.hh, src/ltlenv/defaultenv.cc (require): Return
an atomic_prop*, not a formula*.
* src/bin/randaut.cc, src/bin/randltl.cc, src/ltlvisit/apcollect.cc,
src/tgbatest/ltl2tgba.cc, src/tgbatest/randtgba.cc: Do not cast
the return of require().
parent e6e416e1
......@@ -31,7 +31,6 @@
#include "common_range.hh"
#include "common_cout.hh"
#include "ltlast/atomic_prop.hh"
#include "ltlenv/defaultenv.hh"
#include "misc/random.hh"
......@@ -242,8 +241,7 @@ parse_opt(int key, char* arg, struct argp_state* as)
break;
}
}
aprops.insert(static_cast<const spot::ltl::atomic_prop*>
(spot::ltl::default_environment::instance().require(arg)));
aprops.insert(spot::ltl::default_environment::instance().require(arg));
break;
default:
......
......@@ -32,7 +32,6 @@
#include "common_r.hh"
#include <sstream>
#include "ltlast/atomic_prop.hh"
#include "ltlast/multop.hh"
#include "ltlast/unop.hh"
#include "ltlvisit/randomltl.hh"
......@@ -156,7 +155,7 @@ remove_some_props(spot::ltl::atomic_prop_set& s)
while (n--)
{
spot::ltl::atomic_prop_set::iterator i = s.begin();
auto i = s.begin();
std::advance(i, spot::mrand(s.size()));
s.erase(i);
}
......@@ -260,8 +259,7 @@ parse_opt(int key, char* arg, struct argp_state* as)
break;
}
}
aprops.insert(static_cast<const spot::ltl::atomic_prop*>
(spot::ltl::default_environment::instance().require(arg)));
aprops.insert(spot::ltl::default_environment::instance().require(arg));
break;
default:
return ARGP_ERR_UNKNOWN;
......
......@@ -20,7 +20,6 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "ltlast/atomic_prop.hh"
#include "defaultenv.hh"
namespace spot
......@@ -32,7 +31,7 @@ namespace spot
{
}
const formula*
const atomic_prop*
default_environment::require(const std::string& s)
{
return atomic_prop::instance(s, *this);
......
......@@ -24,6 +24,7 @@
# define SPOT_LTLENV_DEFAULTENV_HH
# include "environment.hh"
# include "ltlast/atomic_prop.hh"
namespace spot
{
......@@ -41,7 +42,7 @@ namespace spot
{
public:
virtual ~default_environment();
virtual const formula* require(const std::string& prop_str);
virtual const atomic_prop* require(const std::string& prop_str);
virtual const std::string& name() const;
/// Get the sole instance of spot::ltl::default_environment.
......
......@@ -61,8 +61,7 @@ namespace spot
{
std::ostringstream p;
p << 'p' << i;
res.insert(static_cast<const spot::ltl::atomic_prop*>
(e.require(p.str())));
res.insert(e.require(p.str()));
}
return res;
}
......
......@@ -386,7 +386,7 @@ checked_main(int argc, char** argv)
bool opt_stutterize = false;
bool spin_comments = false;
const char* hoa_opt = 0;
spot::ltl::environment& env(spot::ltl::default_environment::instance());
auto& env = spot::ltl::default_environment::instance();
spot::ltl::atomic_prop_set* unobservables = 0;
spot::tgba_ptr system_aut = 0;
auto dict = spot::make_bdd_dict();
......@@ -846,8 +846,7 @@ checked_main(int argc, char** argv)
const char* tok = strtok(argv[formula_index] + 2, ", \t;");
while (tok)
{
unobservables->insert
(static_cast<const spot::ltl::atomic_prop*>(env.require(tok)));
unobservables->insert(env.require(tok));
tok = strtok(0, ", \t;");
}
}
......
......@@ -40,7 +40,6 @@
#include "tgbaalgos/save.hh"
#include "tgbaalgos/stats.hh"
#include "ltlenv/defaultenv.hh"
#include "ltlast/atomic_prop.hh"
#include "tgbaalgos/dotty.hh"
#include "tgbaparse/public.hh"
#include "misc/random.hh"
......@@ -586,7 +585,7 @@ main(int argc, char** argv)
spot::option_map options;
spot::ltl::environment& env(spot::ltl::default_environment::instance());
auto& env = spot::ltl::default_environment::instance();
spot::ltl::atomic_prop_set* ap = new spot::ltl::atomic_prop_set;
auto dict = spot::make_bdd_dict();
......@@ -794,8 +793,7 @@ main(int argc, char** argv)
}
else
{
ap->insert(static_cast<const spot::ltl::atomic_prop*>
(env.require(argv[argn])));
ap->insert(env.require(argv[argn]));
}
}
......@@ -886,7 +884,7 @@ main(int argc, char** argv)
spot::ltl::atomic_prop_collect(f);
for (spot::ltl::atomic_prop_set::iterator i = tmp->begin();
i != tmp->end(); ++i)
apf->insert(dynamic_cast<const spot::ltl::atomic_prop*>
apf->insert(down_cast<const spot::ltl::atomic_prop*>
((*i)->clone()));
f->destroy();
delete tmp;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment