* src/misc/optionmap.cc, src/misc/optionmap.hh (option_map): New class.

* src/misc/Makefile.am: Add it.
* src/tgbaalgos/emptiness.cc, src/tgbaalgos/emptiness.hh: Add option
facilities to the classes emptiness_check and emptiness_result
* src/tgbaalgos/magic.cc, src/tgbaalgos/magic.hh,
src/tgbaalgos/se05.cc, src/tgbaalgos/se05.hh: Compute optionnaly
accepting runs from stack.
* src/tgbatest/randtgba.cc: Make this option public.
This commit is contained in:
Denis Poitrenaud 2005-02-07 15:18:41 +00:00
parent e812e1926f
commit 661dee8633
13 changed files with 578 additions and 95 deletions

View file

@ -22,9 +22,11 @@
#ifndef SPOT_TGBAALGOS_EMPTINESS_HH
# define SPOT_TGBAALGOS_EMPTINESS_HH
#include <map>
#include <list>
#include <iosfwd>
#include <bdd.h>
#include "misc/optionmap.hh"
#include "tgba/state.hh"
#include "emptiness_stats.hh"
@ -74,8 +76,13 @@ namespace spot
class emptiness_check_result
{
public:
emptiness_check_result(const tgba* a)
: a_(a)
emptiness_check_result(const tgba* a, option_map o = option_map())
: a_(a), o_(o)
{
}
virtual
~emptiness_check_result()
{
}
@ -100,19 +107,43 @@ namespace spot
return a_;
}
/// Return the options parametrizing how the accepting run is computed.
const option_map&
options() const
{
return o_;
}
/// Modify the options parametrizing how the accepting run is computed.
const char*
parse_options(char* options)
{
option_map old(o_);
const char* s = o_.parse_options(options);
options_updated(old);
return s;
}
/// Return statistics, if available.
virtual const unsigned_statistics* statistics() const;
protected:
/// React when options are modified.
virtual void options_updated(const option_map& old)
{
(void)old;
}
const tgba* a_; ///< The automaton.
option_map o_; ///< The options
};
/// Common interface to emptiness check algorithms.
class emptiness_check
{
public:
emptiness_check(const tgba* a)
: a_(a)
emptiness_check(const tgba* a, option_map o = option_map())
: a_(a), o_(o)
{
}
virtual ~emptiness_check();
@ -124,6 +155,23 @@ namespace spot
return a_;
}
/// Return the options parametrizing how the emptiness check is realized.
const option_map&
options() const
{
return o_;
}
/// Modify the options parametrizing how the accepting run is realized.
const char*
parse_options(char* options)
{
option_map old(o_);
const char* s = o_.parse_options(options);
options_updated(old);
return s;
}
/// \brief Check whether the automaton contain an accepting run.
///
/// Return 0 if the automaton accept no run. Return an instance
@ -142,8 +190,15 @@ namespace spot
/// Print statistics, if any.
virtual std::ostream& print_stats(std::ostream& os) const;
/// React when options are modified.
virtual void options_updated(const option_map& old)
{
(void)old;
}
protected:
const tgba* a_; ///< The automaton.
option_map o_; ///< The options
};
/// @}