Sequence Chart Studio  svn HEAD revision
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DFSBMscGraphTraverser Class Reference

#include <dfs_bmsc_graph_traverser.h>

Inheritance diagram for DFSBMscGraphTraverser:
Inheritance graph
Collaboration diagram for DFSBMscGraphTraverser:
Collaboration graph

Public Member Functions

 DFSBMscGraphTraverser (const std::string &color_attribute="msc_graph_traverse_color")
 
virtual ~DFSBMscGraphTraverser ()
 
virtual void traverse (HMscPtr hmsc)
 
virtual void traverse (HMscNode *node)
 
virtual void cleanup_traversing_attributes ()
 
const MscElementPListListget_reached_elements ()
 
- Public Member Functions inherited from DFSListenersContainer
void add_node_finished_listener (NodeFinishedListenerP l)
 
void remove_node_finished_listeners ()
 
void add_white_node_found_listener (WhiteNodeFoundListenerP l)
 
void remove_white_node_found_listeners ()
 
void add_gray_node_found_listener (GrayNodeFoundListenerP l)
 
void remove_gray_node_found_listeners ()
 
void add_black_node_found_listener (BlackNodeFoundListenerP l)
 
void remove_black_node_found_listeners ()
 
void remove_all_listeners ()
 
virtual ~DFSListenersContainer ()
 

Protected Member Functions

virtual void cleanup_top_attributes ()
 
virtual bool traverse_node (HMscNode *node)
 
virtual bool traverse_successors (PredecessorNode *predecessor)
 
virtual bool is_processed (HMscNode *node)
 
virtual bool traverse_reference_node (ReferenceNode *node)
 
void set_color (HMscNode *n, NodeColor c)
 
NodeColorget_color (HMscNode *n)
 
virtual void push_top_attributes ()
 
virtual void white_node_found (HMscNode *n)
 
virtual void gray_node_found (HMscNode *n)
 
virtual void black_node_found (HMscNode *n)
 
virtual void node_finished (HMscNode *n)
 

Protected Attributes

HMscNodePListList m_colored_nodes
 
MscElementPListList m_reached_elements
 
std::string m_color_attribute
 
- Protected Attributes inherited from DFSListenersContainer
NodeFinishedListenerPList m_node_finished_listeners
 
WhiteNodeFoundListenerPList m_white_node_found_listeners
 
GrayNodeFoundListenerPList m_gray_node_found_listeners
 
BlackNodeFoundListenerPList m_black_node_found_listeners
 
GrayNodeFoundListenerPList m_grey_node_found_listeners
 

Detailed Description

Traverses all accessible HMscNodes in HMsc and referenced HMsc in depth first search manner.

HMsc is traversed like BMsc-graph (flattened version of HMsc - each ReferenceNode references only BMsc not HMsc), i.e. each HMsc is traversed as many times as it is referenced. If ReferenceNode references HMsc, this HMsc is traversed before successors of referencing node are processed.

HMscNodes of HMsc are during traversing in different states - with different color. WHITE color means that node wasn't traversed before. GRAY nodes are those which have been already traversed and they are just on the stack - not all successors of these events were processed. BLACK nodes are those which have been already traversed but aren't yet on the stack - all successors have been processed.

Note that not all HMscNodes must be traversed by this DFSBMscGraphTraverser, imagine HMscNode B which is accessible only from ReferenceNode A but A's HMsc hasn't got any end node.

Warning
Non-recursive HMsc is expected.

Definition at line 341 of file dfs_bmsc_graph_traverser.h.

Constructor & Destructor Documentation

DFSBMscGraphTraverser::DFSBMscGraphTraverser ( const std::string color_attribute = "msc_graph_traverse_color")
inline

To change default name of attribute which holds color of HMscNodes use color_attribute parameter.

Definition at line 350 of file dfs_bmsc_graph_traverser.h.

DFSBMscGraphTraverser::~DFSBMscGraphTraverser ( )
virtual

Calls cleanup_traversing_attributes

Definition at line 56 of file dfs_bmsc_graph_traverser.cpp.

References cleanup_traversing_attributes().

Member Function Documentation

void DFSBMscGraphTraverser::black_node_found ( HMscNode n)
protectedvirtual

Called when black HMscNode is found.

Reimplemented from DFSListenersContainer.

Definition at line 175 of file dfs_bmsc_graph_traverser.cpp.

References DFSListenersContainer::black_node_found(), and m_reached_elements.

Referenced by is_processed(), and DFSInnerHMscTraverser::traverse_node().

void DFSBMscGraphTraverser::cleanup_top_attributes ( )
protectedvirtual

Cleans up traversing attributes from the top of m_colored_nodes

Definition at line 188 of file dfs_bmsc_graph_traverser.cpp.

References m_color_attribute, m_colored_nodes, m_reached_elements, and top.

Referenced by DFSHMscTraverser::cleanup_traversing_attributes(), cleanup_traversing_attributes(), and traverse_reference_node().

void DFSBMscGraphTraverser::cleanup_traversing_attributes ( )
virtual
NodeColor & DFSBMscGraphTraverser::get_color ( HMscNode n)
protected

Returns value of color attribute.

If attribute isn't set it is set to default value WHITE.

Definition at line 204 of file dfs_bmsc_graph_traverser.cpp.

References MscElement::get_attribute(), m_color_attribute, m_colored_nodes, and WHITE.

Referenced by is_processed(), set_color(), and DFSInnerHMscTraverser::traverse_node().

const MscElementPListList& DFSBMscGraphTraverser::get_reached_elements ( )
inline
void DFSBMscGraphTraverser::gray_node_found ( HMscNode n)
protectedvirtual

Called when gray HMscNode is found.

Reimplemented from DFSListenersContainer.

Definition at line 169 of file dfs_bmsc_graph_traverser.cpp.

References DFSListenersContainer::gray_node_found(), and m_reached_elements.

Referenced by is_processed(), and DFSInnerHMscTraverser::traverse_node().

bool DFSBMscGraphTraverser::is_processed ( HMscNode node)
protectedvirtual

Returns true iff node is just processed false otherwise

Definition at line 139 of file dfs_bmsc_graph_traverser.cpp.

References BLACK, black_node_found(), get_color(), GRAY, and gray_node_found().

Referenced by NodeFinder::traverse_node(), and traverse_node().

void DFSBMscGraphTraverser::node_finished ( HMscNode n)
protectedvirtual

Called when all successors of e are processed.

Reimplemented from DFSListenersContainer.

Definition at line 181 of file dfs_bmsc_graph_traverser.cpp.

References BLACK, m_reached_elements, DFSListenersContainer::node_finished(), and set_color().

Referenced by DFSInnerHMscTraverser::traverse_node(), NodeFinder::traverse_node(), and traverse_node().

void DFSBMscGraphTraverser::push_top_attributes ( )
protectedvirtual
void DFSBMscGraphTraverser::set_color ( HMscNode n,
NodeColor  c 
)
protected
void DFSBMscGraphTraverser::traverse ( HMscPtr  hmsc)
virtual
void DFSBMscGraphTraverser::traverse ( HMscNode node)
virtual
bool DFSBMscGraphTraverser::traverse_node ( HMscNode node)
protectedvirtual
bool DFSBMscGraphTraverser::traverse_reference_node ( ReferenceNode node)
protectedvirtual
bool DFSBMscGraphTraverser::traverse_successors ( PredecessorNode predecessor)
protectedvirtual
void DFSBMscGraphTraverser::white_node_found ( HMscNode n)
protectedvirtual

Member Data Documentation

std::string DFSBMscGraphTraverser::m_color_attribute
protected

Color attribute's name

Definition at line 423 of file dfs_bmsc_graph_traverser.h.

Referenced by cleanup_top_attributes(), and get_color().

HMscNodePListList DFSBMscGraphTraverser::m_colored_nodes
protected

Holds nodes with set color attribute

Definition at line 391 of file dfs_bmsc_graph_traverser.h.

Referenced by cleanup_top_attributes(), cleanup_traversing_attributes(), get_color(), and push_top_attributes().

MscElementPListList DFSBMscGraphTraverser::m_reached_elements
protected

The documentation for this class was generated from the following files:

SourceForge.net Logo
Generated on Fri Jan 15 2016 16:26:58 for Sequence Chart Studio by  doxygen