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
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 assert(s < num_states());
176 graph_t::state get_init_state_number()
const
178 if (num_states() == 0)
179 const_cast<graph_t&
>(g_).new_state();
185 if (num_states() == 0)
186 const_cast<graph_t&
>(g_).new_state();
187 return state_from_number(init_number_);
199 if (this->iter_cache_)
204 this->iter_cache_ =
nullptr;
212 state_number(
const state* st)
const
214 auto s = down_cast<
const typename graph_t::state_storage_t*>(st);
219 const kripke_graph_state*
220 state_from_number(graph_t::state n)
const
226 state_from_number(graph_t::state n)
231 std::string format_state(
unsigned n)
const
233 std::stringstream ss;
240 return format_state(state_number(st));
249 edge_storage_t& edge_storage(
unsigned t)
254 const edge_storage_t edge_storage(
unsigned t)
const
259 unsigned new_state(bdd cond)
264 unsigned new_states(
unsigned n, bdd cond)
269 unsigned new_edge(
unsigned src,
unsigned dst)
275 typedef std::shared_ptr<kripke_graph> kripke_graph_ptr;
277 inline kripke_graph_ptr
278 make_kripke_graph(
const bdd_dict_ptr& d)
280 return std::make_shared<kripke_graph>(d);
virtual bdd cond() const override
Get the condition on the edge leading to this successor.
unsigned num_edges() const
The number of edges in the automaton.
Definition: graph.hh:639
virtual kripke_graph_state * clone() const override
Duplicate a state.
Definition: kripkegraph.hh:62
edge_storage_t & edge_storage(edge s)
return a reference to the storage of an edge
Definition: graph.hh:719
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 new_state(Args &&...args)
Create a new states.
Definition: graph.hh:650
Interface for a Kripke structure.
Definition: kripke.hh:90
unsigned num_states() const
The number of states in the automaton.
Definition: graph.hh:631
Abstract class for states.
Definition: twa.hh:43
Iterator code for Kripke structure.
Definition: kripke.hh:43
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
state new_states(unsigned n, Args &&...args)
Create n new states.
Definition: graph.hh:664
virtual bdd state_condition(const state *s) const override
Get the condition on the state.
Definition: kripkegraph.hh:244
virtual bool done() const override
Check whether the iteration is finished.
Definition: kripkegraph.hh:125
bool is_valid_edge(edge t) const
Test whether the given edge is valid.
Definition: graph.hh:889
edge new_edge(state src, out_state dst, Args &&...args)
Create a new edge.
Definition: graph.hh:760
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:183
state_storage_t & state_storage(state s)
return a reference to the storage of a state
Definition: graph.hh:679
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:238
state_storage_t::data_t & state_data(state s)
return the State_Data associated to a state
Definition: graph.hh:699
Definition: kripkegraph.hh:86