queue_cursor Class Template Reference

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

#include <cursor.h>

Inherits astl::queue_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 dequeue ()
 Dequeues a forward cursor and return false if the resulting queue 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)
 Returns the sink state identifier.
bool first ()
 Makes this cursor point to the first element of the transitions sequence of the source state and enqueues the resulting forward cursor.
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.
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 and enqueues the resulting cursor.
 queue_cursor ()
 Creates a cursor with an empty queue.
 queue_cursor (const ForwardCursor &x)
 Creates a cursor with a queue containing x.
bool sink () const
 Returns true if this cursor points to the sink state.
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.


Detailed Description

template<typename ForwardCursor, typename QueueContainer = deque<ForwardCursor>>
class astl::queue_cursor< ForwardCursor, QueueContainer >

A forward_cursor storing its path in a queue of cursors.

Each move through the sequence of the outgoing transitions of the source state (next()) enqueues a forward cursor. An extra method dequeue() allows to dequeue and to implement the breadth-first traversal.

Template parameters
ParameterDescriptionDefaultRequirements
ForwardCursor The type of the cursors that are stored in the queueForwardCursor is a model of forward cursor
QueueContainer The type of the sequential container managing the queuedeque<ForwardCursor> QueueContainer is a model of front and back insertion sequence and QueueContainer::value_type is ForwardCursor
Model of
cursor, transition cursor, forward cursor, queue cursor
Associated Helper Functions
queuec()

Member Function Documentation

state_type aim (  )  const

Returns the aim state of the pointed transition.

Precondition:
The queue is not empty.

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

bool aim_final (  )  const

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

Precondition:
The queue is not empty

tag_type aim_tag (  )  const

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

Precondition:
The queue is not empty.

bool dequeue (  ) 

Dequeues a forward cursor and return false if the resulting queue is empty.

Precondition:
The queue is not empty

bool exists ( const char_type a  )  const

Returns true if an outgoing transition labeled with a exists.

Precondition:
The queue is not empty

bool first (  ) 

Makes this cursor point to the first element of the transitions sequence of the source state and enqueues the resulting forward cursor.

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

Precondition:
The queue 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.

Precondition:
The queue is not empty

void forward (  ) 

Moves forward along the pointed transition.

Precondition:
The queue is not empty.

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

char_type letter (  )  const

Returns the letter on the pointed transition.

.

Precondition:
The queue is not empty.

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

bool next (  ) 

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

Returns true if such an element exists (the cursor is not at the end of the sequence), otherwise dequeues a forward cursor and returns false.

Precondition:
The queue 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 queue is not empty

state_type src (  )  const

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

Precondition:
The queue is not empty

bool src_final (  )  const

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

Precondition:
The queue is not empty

tag_type src_tag (  )  const

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

Precondition:
The queue is not empty.


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