23 #include <spot/kripke/kripke.hh>
24 #include <spot/graph/graph.hh>
54 virtual size_t hash()
const override
57 reinterpret_cast<const char*
>(
this) - static_cast<const char*>(
nullptr);
88 typedef typename Graph::edge edge;
89 typedef typename Graph::state_data_t state;
95 const typename Graph::state_storage_t* s):
106 void recycle(
const typename Graph::state_storage_t* s)
120 p_ = g_->edge_storage(p_).next_succ;
124 virtual bool done()
const override
131 SPOT_ASSERT(!done());
133 (&g_->state_data(g_->edge_storage(p_).dst));
147 mutable unsigned init_number_;
150 :
kripke(d), init_number_(0)
156 get_dict()->unregister_all_my_variables(
this);
159 unsigned num_states()
const
164 unsigned num_edges()
const
169 void set_init_state(graph_t::state s)
171 if (SPOT_UNLIKELY(s >= num_states()))
172 throw std::invalid_argument
173 (
"set_init_state() called with nonexisiting state");
177 graph_t::state get_init_state_number()
const
180 if (num_states() == 0)
181 throw std::runtime_error(
"kripke has no state at all");
187 return state_from_number(get_init_state_number());
198 if (this->iter_cache_)
203 this->iter_cache_ =
nullptr;
211 state_number(
const state* st)
const
213 auto s = down_cast<
const typename graph_t::state_storage_t*>(st);
217 const kripke_graph_state*
218 state_from_number(graph_t::state n)
const
224 state_from_number(graph_t::state n)
229 std::string format_state(
unsigned n)
const
231 std::stringstream ss;
238 return format_state(state_number(st));
248 edge_storage_t& edge_storage(
unsigned t)
253 const edge_storage_t edge_storage(
unsigned t)
const
258 unsigned new_state(bdd cond)
263 unsigned new_states(
unsigned n, bdd cond)
268 unsigned new_edge(
unsigned src,
unsigned dst)
274 typedef std::shared_ptr<kripke_graph> kripke_graph_ptr;
276 inline kripke_graph_ptr
277 make_kripke_graph(
const bdd_dict_ptr& d)
279 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:61
state_storage_t & state_storage(state s)
return a reference to the storage of a state
Definition: graph.hh:712
Kripke Structure.
Definition: kripkegraph.hh:140
virtual kripke_graph_state * dst() const override
Get the destination state of the current edge.
Definition: kripkegraph.hh:129
state_storage_t::data_t & state_data(state s)
return the State_Data associated to a state
Definition: graph.hh:730
Interface for a Kripke structure.
Definition: kripke.hh:90
state new_states(unsigned n, Args &&...args)
Create n new states.
Definition: graph.hh:697
edge_storage_t & edge_storage(edge s)
return a reference to the storage of an edge
Definition: graph.hh:748
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:118
virtual size_t hash() const override
Hash a state.
Definition: kripkegraph.hh:54
virtual void destroy() const override
Release a state.
Definition: kripkegraph.hh:66
virtual bool first() override
Position the iterator on the first successor (if any).
Definition: kripkegraph.hh:112
edge new_edge(state src, state dst, Args &&...args)
Create a new edge.
Definition: graph.hh:785
bool is_valid_edge(edge t) const
Test whether the given edge is valid.
Definition: graph.hh:982
virtual bdd state_condition(const state *s) const override
Get the condition on the state.
Definition: kripkegraph.hh:242
virtual bool done() const override
Check whether the iteration is finished.
Definition: kripkegraph.hh:124
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:193
virtual const kripke_graph_state * get_init_state() const override
Get the initial state of the automaton.
Definition: kripkegraph.hh:185
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:236
state new_state(Args &&...args)
Create a new states.
Definition: graph.hh:683
unsigned num_states() const
The number of states in the automaton.
Definition: graph.hh:646
Definition: kripkegraph.hh:85