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().
This commit is contained in:
parent
e6e416e1e1
commit
4f1535c8fe
7 changed files with 12 additions and 20 deletions
|
|
@ -31,7 +31,6 @@
|
||||||
#include "common_range.hh"
|
#include "common_range.hh"
|
||||||
#include "common_cout.hh"
|
#include "common_cout.hh"
|
||||||
|
|
||||||
#include "ltlast/atomic_prop.hh"
|
|
||||||
#include "ltlenv/defaultenv.hh"
|
#include "ltlenv/defaultenv.hh"
|
||||||
#include "misc/random.hh"
|
#include "misc/random.hh"
|
||||||
|
|
||||||
|
|
@ -242,8 +241,7 @@ parse_opt(int key, char* arg, struct argp_state* as)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aprops.insert(static_cast<const spot::ltl::atomic_prop*>
|
aprops.insert(spot::ltl::default_environment::instance().require(arg));
|
||||||
(spot::ltl::default_environment::instance().require(arg)));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@
|
||||||
#include "common_r.hh"
|
#include "common_r.hh"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "ltlast/atomic_prop.hh"
|
|
||||||
#include "ltlast/multop.hh"
|
#include "ltlast/multop.hh"
|
||||||
#include "ltlast/unop.hh"
|
#include "ltlast/unop.hh"
|
||||||
#include "ltlvisit/randomltl.hh"
|
#include "ltlvisit/randomltl.hh"
|
||||||
|
|
@ -156,7 +155,7 @@ remove_some_props(spot::ltl::atomic_prop_set& s)
|
||||||
|
|
||||||
while (n--)
|
while (n--)
|
||||||
{
|
{
|
||||||
spot::ltl::atomic_prop_set::iterator i = s.begin();
|
auto i = s.begin();
|
||||||
std::advance(i, spot::mrand(s.size()));
|
std::advance(i, spot::mrand(s.size()));
|
||||||
s.erase(i);
|
s.erase(i);
|
||||||
}
|
}
|
||||||
|
|
@ -260,8 +259,7 @@ parse_opt(int key, char* arg, struct argp_state* as)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aprops.insert(static_cast<const spot::ltl::atomic_prop*>
|
aprops.insert(spot::ltl::default_environment::instance().require(arg));
|
||||||
(spot::ltl::default_environment::instance().require(arg)));
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return ARGP_ERR_UNKNOWN;
|
return ARGP_ERR_UNKNOWN;
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "ltlast/atomic_prop.hh"
|
|
||||||
#include "defaultenv.hh"
|
#include "defaultenv.hh"
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
|
|
@ -32,7 +31,7 @@ namespace spot
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
const formula*
|
const atomic_prop*
|
||||||
default_environment::require(const std::string& s)
|
default_environment::require(const std::string& s)
|
||||||
{
|
{
|
||||||
return atomic_prop::instance(s, *this);
|
return atomic_prop::instance(s, *this);
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
# define SPOT_LTLENV_DEFAULTENV_HH
|
# define SPOT_LTLENV_DEFAULTENV_HH
|
||||||
|
|
||||||
# include "environment.hh"
|
# include "environment.hh"
|
||||||
|
# include "ltlast/atomic_prop.hh"
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
|
|
@ -41,7 +42,7 @@ namespace spot
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~default_environment();
|
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;
|
virtual const std::string& name() const;
|
||||||
|
|
||||||
/// Get the sole instance of spot::ltl::default_environment.
|
/// Get the sole instance of spot::ltl::default_environment.
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,7 @@ namespace spot
|
||||||
{
|
{
|
||||||
std::ostringstream p;
|
std::ostringstream p;
|
||||||
p << 'p' << i;
|
p << 'p' << i;
|
||||||
res.insert(static_cast<const spot::ltl::atomic_prop*>
|
res.insert(e.require(p.str()));
|
||||||
(e.require(p.str())));
|
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -386,7 +386,7 @@ checked_main(int argc, char** argv)
|
||||||
bool opt_stutterize = false;
|
bool opt_stutterize = false;
|
||||||
bool spin_comments = false;
|
bool spin_comments = false;
|
||||||
const char* hoa_opt = 0;
|
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::ltl::atomic_prop_set* unobservables = 0;
|
||||||
spot::tgba_ptr system_aut = 0;
|
spot::tgba_ptr system_aut = 0;
|
||||||
auto dict = spot::make_bdd_dict();
|
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;");
|
const char* tok = strtok(argv[formula_index] + 2, ", \t;");
|
||||||
while (tok)
|
while (tok)
|
||||||
{
|
{
|
||||||
unobservables->insert
|
unobservables->insert(env.require(tok));
|
||||||
(static_cast<const spot::ltl::atomic_prop*>(env.require(tok)));
|
|
||||||
tok = strtok(0, ", \t;");
|
tok = strtok(0, ", \t;");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,6 @@
|
||||||
#include "tgbaalgos/save.hh"
|
#include "tgbaalgos/save.hh"
|
||||||
#include "tgbaalgos/stats.hh"
|
#include "tgbaalgos/stats.hh"
|
||||||
#include "ltlenv/defaultenv.hh"
|
#include "ltlenv/defaultenv.hh"
|
||||||
#include "ltlast/atomic_prop.hh"
|
|
||||||
#include "tgbaalgos/dotty.hh"
|
#include "tgbaalgos/dotty.hh"
|
||||||
#include "tgbaparse/public.hh"
|
#include "tgbaparse/public.hh"
|
||||||
#include "misc/random.hh"
|
#include "misc/random.hh"
|
||||||
|
|
@ -586,7 +585,7 @@ main(int argc, char** argv)
|
||||||
|
|
||||||
spot::option_map options;
|
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;
|
spot::ltl::atomic_prop_set* ap = new spot::ltl::atomic_prop_set;
|
||||||
auto dict = spot::make_bdd_dict();
|
auto dict = spot::make_bdd_dict();
|
||||||
|
|
||||||
|
|
@ -794,8 +793,7 @@ main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ap->insert(static_cast<const spot::ltl::atomic_prop*>
|
ap->insert(env.require(argv[argn]));
|
||||||
(env.require(argv[argn])));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -886,7 +884,7 @@ main(int argc, char** argv)
|
||||||
spot::ltl::atomic_prop_collect(f);
|
spot::ltl::atomic_prop_collect(f);
|
||||||
for (spot::ltl::atomic_prop_set::iterator i = tmp->begin();
|
for (spot::ltl::atomic_prop_set::iterator i = tmp->begin();
|
||||||
i != tmp->end(); ++i)
|
i != tmp->end(); ++i)
|
||||||
apf->insert(dynamic_cast<const spot::ltl::atomic_prop*>
|
apf->insert(down_cast<const spot::ltl::atomic_prop*>
|
||||||
((*i)->clone()));
|
((*i)->clone()));
|
||||||
f->destroy();
|
f->destroy();
|
||||||
delete tmp;
|
delete tmp;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue