23 #include <spot/kripke/kripke.hh>
24 #include <spot/graph/graph.hh>
55 virtual size_t hash()
const override
58 reinterpret_cast<const char*
>(
this) - static_cast<const char*>(
nullptr);
89 typedef typename Graph::edge edge;
90 typedef typename Graph::state_data_t state;
96 const typename Graph::state_storage_t* s):
107 void recycle(
const typename Graph::state_storage_t* s)
121 p_ = g_->edge_storage(p_).next_succ;
125 virtual bool done()
const override
132 SPOT_ASSERT(!done());
134 (&g_->state_data(g_->edge_storage(p_).dst));
148 mutable unsigned init_number_;
151 :
kripke(d), init_number_(0)
157 get_dict()->unregister_all_my_variables(
this);
160 unsigned num_states()
const
165 unsigned num_edges()
const
170 void set_init_state(graph_t::state s)
172 if (SPOT_UNLIKELY(s >= num_states()))
173 throw std::invalid_argument
174 (
"set_init_state() called with nonexisiting state");
178 graph_t::state get_init_state_number()
const
181 if (num_states() == 0)
182 throw std::runtime_error(
"kripke has no state at all");
188 return state_from_number(get_init_state_number());
200 if (this->iter_cache_)
205 this->iter_cache_ =
nullptr;
213 state_number(
const state* st)
const
215 auto s = down_cast<
const typename graph_t::state_storage_t*>(st);
220 const kripke_graph_state*
221 state_from_number(graph_t::state n)
const
227 state_from_number(graph_t::state n)
232 std::string format_state(
unsigned n)
const
234 std::stringstream ss;
241 return format_state(state_number(st));
252 edge_storage_t& edge_storage(
unsigned t)
257 const edge_storage_t edge_storage(
unsigned t)
const
262 unsigned new_state(bdd cond)
267 unsigned new_states(
unsigned n, bdd cond)
272 unsigned new_edge(
unsigned src,
unsigned dst)
278 typedef std::shared_ptr<kripke_graph> kripke_graph_ptr;
280 inline kripke_graph_ptr
281 make_kripke_graph(
const bdd_dict_ptr& d)
283 return std::make_shared<kripke_graph>(d);
virtual bdd cond() const override
Get the condition on the edge leading to this successor.
virtual kripke_graph_state * clone() const override
Duplicate a state.
Definition: kripkegraph.hh:62
state_storage_t & state_storage(state s)
return a reference to the storage of a state
Definition: graph.hh:700
Kripke Structure.
Definition: kripkegraph.hh:141
virtual kripke_graph_state * dst() const override
Get the destination state of the current edge.
Definition: kripkegraph.hh:130
state_storage_t::data_t & state_data(state s)
return the State_Data associated to a state
Definition: graph.hh:718
Interface for a Kripke structure.
Definition: kripke.hh:90
state new_states(unsigned n, Args &&...args)
Create n new states.
Definition: graph.hh:685
edge_storage_t & edge_storage(edge s)
return a reference to the storage of an edge
Definition: graph.hh:736
Abstract class for states.
Definition: twa.hh:50
Iterator code for Kripke structure.
Definition: kripke.hh:43
unsigned num_edges() const
The number of edges in the automaton.
Definition: graph.hh:654
Concrete class for kripke_graph states.
Definition: kripkegraph.hh:30
virtual bool next() override
Jump to the next successor (if any).
Definition: kripkegraph.hh:119
virtual size_t hash() const override
Hash a state.
Definition: kripkegraph.hh:55
virtual void destroy() const override
Release a state.
Definition: kripkegraph.hh:67
virtual bool first() override
Position the iterator on the first successor (if any).
Definition: kripkegraph.hh:113
edge new_edge(state src, state dst, Args &&...args)
Create a new edge.
Definition: graph.hh:773
bool is_valid_edge(edge t) const
Test whether the given edge is valid.
Definition: graph.hh:970
virtual bdd state_condition(const state *s) const override
Get the condition on the state.
Definition: kripkegraph.hh:245
virtual bool done() const override
Check whether the iteration is finished.
Definition: kripkegraph.hh:125
virtual kripke_graph_succ_iterator< graph_t > * succ_iter(const spot::state *st) const override
Allow to get an iterator on the state we passed in parameter.
Definition: kripkegraph.hh:194
virtual const kripke_graph_state * get_init_state() const override
Get the initial state of the automaton.
Definition: kripkegraph.hh:186
virtual int compare(const spot::state *other) const override
Compares two states (that come from the same automaton).
Definition: kripkegraph.hh:42
virtual std::string format_state(const state *st) const override
Format the state as a string for printing.
Definition: kripkegraph.hh:239
state new_state(Args &&...args)
Create a new states.
Definition: graph.hh:671
unsigned num_states() const
The number of states in the automaton.
Definition: graph.hh:646
Definition: kripkegraph.hh:86