stack_cursor Class Template Reference

A forward_cursor storing its path in a stack of cursors. More...

#include <cursor.h>

Inherits astl::stack_cursor_concept.

List of all members.

Public Types

typedef ForwardCursor::char_traits char_traits
 Character traits describing char_type.
typedef ForwardCursor::char_type char_type
 The type of the transitions letters.
typedef ForwardCursor::state_type state_type
 The type of the automaton-states identifiers.
typedef ForwardCursor::tag_type tag_type
 The type of the data attached to states.

Public Member Functions

state_type aim () const
 Returns the aim state of the pointed transition.
bool aim_final () const
 Returns true if the aim state of the transition that this cursor points to is final.
tag_type aim_tag () const
 Returns the data attached to the aim state of the pointed transition.
bool backward ()
 Pops the stack top and return false if the resulting stack is empty.
bool exists (const char_type &a) const
 Returns true if an outgoing transition labeled with a exists.
bool find (const char_type &a)
 Makes this cursor point to the transition labeled with a.
bool first ()
 Makes this cursor point to the first element of the transitions sequence of the source state.
bool forward (const char_type &a)
 Moves along the outgoing transition labeled with a if defined, otherwise moves to sink state and returns false.
void forward ()
 Moves forward along the pointed transition and the resulting cursor is pushed onto the stack.
char_type letter () const
 Returns the letter on the pointed transition.
bool next ()
 Moves this cursor to the next element of the transitions sequence of the source state.
bool sink () const
 Returns true if this cursor points to the sink state.
state_type sink_state () const
 Returns the sink state identifier.
state_type src () const
 Returns the identifier of the state that this cursor points to.
bool src_final () const
 Returns true if the state that this cursor points to is final.
tag_type src_tag () const
 Returns the data attached to the state that this cursor points to.
 stack_cursor ()
 Creates a cursor with an empty stack.
 stack_cursor (const ForwardCursor &x)
 Creates a cursor with a stack containing x.
const ForwardCursor & top () const
 Returns the stack top.


Detailed Description

template<typename ForwardCursor, typename StackContainer = vector<ForwardCursor>>
class astl::stack_cursor< ForwardCursor, StackContainer >

A forward_cursor storing its path in a stack of cursors.

Each forward move along a transition pushes a new forward_cursor onto the stack top and an extra method backward() allows to pop. The depth-first traversal cursor dfirst_cursor relies on the stack_cursor

Template parameters
ParameterDescriptionDefaultRequirements
ForwardCursor The type of the cursors that are stored on the stackForwardCursor is a model of forward cursor
StackContainer The type of the sequential container managing the stackvector<ForwardCursor> StackContainer is a model of back insertion sequence and StackContainer::value_type is ForwardCursor
Model of
cursor, transition cursor, forward cursor, stack cursor
Associated Helper Functions
stackc()

Member Function Documentation

state_type aim (  )  const

Returns the aim state of the pointed transition.

Precondition:
The stack is not empty.

The cursor shall have been set to point to a defined transition beforehand by successfully calling first, next or find

Referenced by DFA_min_hash::insert().

bool aim_final (  )  const

Returns true if the aim state of the transition that this cursor points to is final.

Precondition:
The stack is not empty.

tag_type aim_tag (  )  const

Returns the data attached to the aim state of the pointed transition.

Precondition:
The stack is not empty.

bool backward (  ) 

Pops the stack top and return false if the resulting stack is empty.

Precondition:
The stack is not empty

Referenced by DFA_min_hash::insert().

bool exists ( const char_type a  )  const

Returns true if an outgoing transition labeled with a exists.

Precondition:
The stack is not empty

bool find ( const char_type a  ) 

Makes this cursor point to the transition labeled with a.

Returns true if such a transition exists, otherwise the pointed transition is undefined.

Precondition:
The stack is not empty

Referenced by DFA_min_hash::insert().

bool first (  ) 

Makes this cursor point to the first element of the transitions sequence of the source state.

Returns true if such an element exists (if any transition is defined), otherwise the pointed transition is undefined.

Precondition:
The stack is not empty

bool forward ( const char_type a  ) 

Moves along the outgoing transition labeled with a if defined, otherwise moves to sink state and returns false.

The resulting cursor is pushed onto the stack.

Precondition:
The stack is not empty

void forward (  ) 

Moves forward along the pointed transition and the resulting cursor is pushed onto the stack.

Precondition:
The stack is not empty.

The cursor shall have been set to point to a defined transition beforehand by successfully calling first, next or find

Referenced by DFA_min_hash::insert().

char_type letter (  )  const

Returns the letter on the pointed transition.

Precondition:
The stack is not empty.

The cursor shall have been set to point to a defined transition beforehand by successfully calling first, next or find

Referenced by DFA_min_hash::insert().

bool next (  ) 

Moves this cursor to the next element of the transitions sequence of the source state.

Returns true if such an element exists (the cursor is not at the end of the sequence), otherwise the pointed transition is undefined.

Precondition:
The stack is not empty.

The cursor shall have been set to point to a defined transition beforehand by successfully calling first, next or find

bool sink (  )  const

Returns true if this cursor points to the sink state.

Precondition:
The stack is not empty

state_type sink_state (  )  const

Returns the sink state identifier.

Precondition:
The stack is not empty.

state_type src (  )  const

Returns the identifier of the state that this cursor points to.

Precondition:
The stack is not empty.

The stack is not empty.

Referenced by DFA_min_hash::insert().

bool src_final (  )  const

Returns true if the state that this cursor points to is final.

Precondition:
The stack is not empty.

tag_type src_tag (  )  const

Returns the data attached to the state that this cursor points to.

Precondition:
The stack is not empty.

const ForwardCursor& top (  )  const

Returns the stack top.

Precondition:
The stack is not empty


Generated on Sun Mar 8 02:41:36 2009 for ASTL by  doxygen 1.5.7.1