map
associating letters to transitions targets.
More...
#include <dfa_map.h>
Public Types | |
typedef CharTraits | char_traits |
Character traits describing char_type. | |
typedef CharTraits::char_type | char_type |
The type of the transitions letters. | |
typedef unsigned int | state_type |
The type of the automaton-states identifiers. | |
typedef Tag | tag_type |
The type of the data attached to states. | |
Public Member Functions | |
const_iterator | begin () const |
void | copy_state (state_type from, state_type to) |
Makes the state to an exact copy of the state from . | |
void | del_state (state_type s) |
Destroyes the state s . | |
state_type | duplicate_state (state_type q) |
Allocates an exact copy of the state q . | |
const_iterator | end () const |
char & | final (state_type s) |
bool | final (state_type s) const |
state_type | initial () const |
void | initial (state_type s) |
Sets the initial state of the automaton to s . | |
state_type | new_state () |
Allocates a new state structure. | |
unsigned long | state_count () const |
const tag_type & | tag (state_type s) const |
tag_type & | tag (state_type s) |
unsigned long | trans_count () const |
map
associating letters to transitions targets.
It is a pretty versatile container: access, insertion and deletion of a transition are computed in logarithmic time and it is rather efficient at depth- and breadth-first traversals without being too memory-consuming.
It is a good space/time tradeoff and should be used whenever no assumption can be made on the nature of the data to be processed.
The ordering used for instanciating the map
uses the one defined by the character traits CharTraits::lt()
.
Parameter | Description | Default | Requirements |
---|---|---|---|
CharTraits | Character traits describing the letters that the transitions bear. | plain | CharTraits is a model of Alphabet |
Tag | The type of the data attached to states. | empty_tag |
const_iterator begin | ( | ) | const [inherited] |
state_type
arranged in an undefined order (probably in allocation order but that is not a requirement). void copy_state | ( | state_type | from, | |
state_type | to | |||
) | [inherited] |
Makes the state to
an exact copy of the state from
.
The tag and the transitions of to
are destroyed and the new ones are copy-constructed from those of from
.
from
has been returned by a previous call to new_state()
to
has been returned by a previous call to new_state()
void del_state | ( | state_type | s | ) | [inherited] |
Destroyes the state s
.
The tag and the transitions are destroyed.
s
has been returned by a previous call to new_state()
state_type duplicate_state | ( | state_type | q | ) | [inherited] |
Allocates an exact copy of the state q
.
q
has been returned by a previous call to new_state()
const_iterator end | ( | ) | const [inherited] |
char& final | ( | state_type | s | ) | [inherited] |
true
sets the state s
to be a final state and if assigned false
sets s
to be a non-final state. s
has been returned by a previous call to new_state()
bool final | ( | state_type | s | ) | const [inherited] |
true
if s
is a final state. s
has been returned by a previous call to new_state()
state_type initial | ( | ) | const [inherited] |
Referenced by DFA_base< Sigma_, Tag_, std::vector< pair< Sigma_::char_traits::char_type, unsigned int > > >::del_state().
void initial | ( | state_type | s | ) | [inherited] |
Sets the initial state of the automaton to s
.
s
has been returned by a previous call to new_state()
initial() == s
state_type new_state | ( | ) | [inherited] |
Allocates a new state structure.
The newly created state is non-final and has no transitions. The tag is default-constructed.
unsigned long state_count | ( | ) | const [inherited] |
const tag_type& tag | ( | state_type | s | ) | const [inherited] |
s
s
has been returned by a previous call to new_state()
tag_type& tag | ( | state_type | s | ) | [inherited] |
s
s
has been returned by a previous call to new_state()
unsigned long trans_count | ( | ) | const [inherited] |