spot  2.8.1
Public Member Functions | List of all members
spot::twa_graph_state Struct Reference

Graph-based representation of a TωA. More...

#include <spot/twa/twagraph.hh>

Inheritance diagram for spot::twa_graph_state:
Collaboration diagram for spot::twa_graph_state:

Public Member Functions

 twa_graph_state (const twa_graph_state &) noexcept
 
twa_graph_stateoperator= (const twa_graph_state &) noexcept
 
virtual int compare (const spot::state *other) const override
 Compares two states (that come from the same automaton). More...
 
virtual size_t hash () const override
 Hash a state. More...
 
virtual twa_graph_stateclone () const override
 Duplicate a state. More...
 
virtual void destroy () const override
 Release a state. More...
 

Detailed Description

Graph-based representation of a TωA.

In a twa_graph, states are usually denoted by their number. However if the on-the-fly interface is used, it returns pointer to instances of the twa_graph_state class.

Member Function Documentation

◆ clone()

virtual twa_graph_state* spot::twa_graph_state::clone ( ) const
inlineoverridevirtual

Duplicate a state.

Implements spot::state.

◆ compare()

virtual int spot::twa_graph_state::compare ( const spot::state other) const
inlineoverridevirtual

Compares two states (that come from the same automaton).

This method returns an integer less than, equal to, or greater than zero if this is found, respectively, to be less than, equal to, or greater than other according to some implicit total order.

This method should not be called to compare states from different automata.

See also
spot::state_ptr_less_than

Implements spot::state.

◆ destroy()

virtual void spot::twa_graph_state::destroy ( ) const
inlineoverridevirtual

Release a state.

Methods from the tgba or twa_succ_iterator always return a new state that you should deallocate with this function. Before Spot 0.7, you had to "delete" your state directly. Starting with Spot 0.7, you should update your code to use this function instead. destroy() usually calls delete, except in subclasses that destroy() to allow better memory management (e.g., no memory allocation for explicit automata).

Reimplemented from spot::state.

◆ hash()

virtual size_t spot::twa_graph_state::hash ( ) const
inlineoverridevirtual

Hash a state.

This method returns an integer that can be used as a hash value for this state.

Note that the hash value is guaranteed to be unique for all equal states (in compare()'s sense) for only as long as one of these states exists. So it's OK to use a spot::state as a key in a hash_map because the mere use of the state as a key in the hash will ensure the state continues to exist.

However if you create the state, get its hash key, delete the state, recreate the same state, and get its hash key, you may obtain two different hash keys if the same state were not already used elsewhere. In practice this weird situation can occur only when the state is BDD-encoded, because BDD numbers (used to build the hash value) can be reused for other formulas. That probably doesn't matter, since the hash value is meant to be used in a hash_map, but it had to be noted.

Implements spot::state.


The documentation for this struct was generated from the following file:

Please direct any question, comment, or bug report to the Spot mailing list at spot@lrde.epita.fr.
Generated on Fri Feb 27 2015 10:00:07 for spot by doxygen 1.8.13