Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

qgar::GenEdge< TNODE, TEDGE > Class Template Reference
[Graphs and trees]

#include <qgarlib/GenEdge.H>

List of all members.


Detailed Description

template<class TNODE, class TEDGE>
class qgar::GenEdge< TNODE, TEDGE >

Edge of a parameterized graph containing (user-defined) data.

An edge includes:

The adjacent nodes are arbitrarily called the source and the target. The source (resp. target) is the first (resp. second) node given as argument to the constructor at the creation of the edge.

See class qgar::GenNode for nodes.

Warning:
Author:
Gérald Masini
Date:
July 29, 2004 17:18
Since:
Qgar 2.2

Definition at line 96 of file GenEdge.H.

Public Types

Types
typedef TEDGE edge_type
 Type of the data stored in an edge.
typedef edge_typeedge_type_reference
 Reference to qgar::GenEdge::edge_type.
typedef const edge_typeedge_type_const_reference
 Constant reference to qgar::GenEdge::edge_type.
typedef edge_typeedge_type_pointer
 Pointer to qgar::GenEdge::edge_type.
typedef const edge_typeedge_type_const_pointer
 Constant pointer to qgar::GenEdge::edge_type.
typedef TNODE node_type
 Type of the data stored in a node.
typedef node_typenode_type_reference
 Reference to qgar::GenEdge::node_type.
typedef const node_typenode_type_const_reference
 Constant reference to qgar::GenEdge::node_type.
typedef node_typenode_type_pointer
 Pointer to qgar::GenEdge::node_type.
typedef const node_typenode_type_const_pointer
 Constant pointer to qgar::GenEdge::node_type.

Public Member Functions

Constructors
 GenEdge (short int aFlag=0)
 Default constructor.
 GenEdge (edge_type_const_reference aData, short int aFlag=0)
 Initialize with data.
 GenEdge (GenNode< node_type, edge_type > *const aPSource, GenNode< node_type, edge_type > *const aPTarget, short int aFlag=0)
 Initialize with source and target.
 GenEdge (GenNode< node_type, edge_type > *const aPSource, GenNode< node_type, edge_type > *const aPTarget, edge_type_const_reference aData, short int aFlag=0)
 Initialize with data, source and target.
 GenEdge (const GenEdge< node_type, edge_type > &anEdge)
 Copy constructor.
Destructor
 ~GenEdge ()
 Non-virtual destructor.
Edge data
edge_type_const_reference accessData () const
 Get edge data.
edge_type data () const
 Get a copy of edge data.
void setData (edge_type_const_reference aData)
 Set edge data.
short int flag () const
 Get edge flag.
void setFlag (short int aFlag)
 Set edge flag.
Adjacent nodes
const GenNode< node_type,
edge_type > & 
accessSource () const
 Get source node.
GenNode< node_type, edge_typesource () const
 Get a copy of source node.
GenNode< node_type, edge_type > * pSource () const
 Get a pointer to source node.
const GenNode< node_type,
edge_type > & 
accessTarget () const
 Get target node.
GenNode< node_type, edge_typetarget () const
 Get a copy of target node.
GenNode< TNODE, TEDGE > * pTarget () const
 Get a pointer to target node.
void setPSource (GenNode< node_type, edge_type > *aPSource)
 Set (pointer to) source node.
void setPTarget (GenNode< node_type, edge_type > *aPTarget)
 Set (pointer to the) target node.
void setPNode (GenNode< node_type, edge_type > *aPNode)
 Set (pointer to) given node as source or target.
Operators
GenEdge< node_type, edge_type > & operator= (const GenEdge< node_type, edge_type > &anEdge)
 Assignment.
bool operator== (const GenEdge< node_type, edge_type > &anEdge)
 Equality.
bool operator!= (const GenEdge< node_type, edge_type > &anEdge)
 Inequality.

Protected Attributes

Representation of an edge
edge_type _data
 Data contained in the edge.
short int _flag
 Flag at client's disposal (default 0).
GenNode< node_type, edge_type > * _pSource
 Pointer to the source node.
GenNode< node_type, edge_type > * _pTarget
 Pointer to the target node.


Member Typedef Documentation

template<class TNODE, class TEDGE>
typedef TEDGE qgar::GenEdge< TNODE, TEDGE >::edge_type
 

Type of the data stored in an edge.

Definition at line 110 of file GenEdge.H.

template<class TNODE, class TEDGE>
typedef const edge_type* qgar::GenEdge< TNODE, TEDGE >::edge_type_const_pointer
 

Constant pointer to qgar::GenEdge::edge_type.

Definition at line 130 of file GenEdge.H.

template<class TNODE, class TEDGE>
typedef const edge_type& qgar::GenEdge< TNODE, TEDGE >::edge_type_const_reference
 

Constant reference to qgar::GenEdge::edge_type.

Definition at line 120 of file GenEdge.H.

template<class TNODE, class TEDGE>
typedef edge_type* qgar::GenEdge< TNODE, TEDGE >::edge_type_pointer
 

Pointer to qgar::GenEdge::edge_type.

Definition at line 125 of file GenEdge.H.

template<class TNODE, class TEDGE>
typedef edge_type& qgar::GenEdge< TNODE, TEDGE >::edge_type_reference
 

Reference to qgar::GenEdge::edge_type.

Definition at line 115 of file GenEdge.H.

template<class TNODE, class TEDGE>
typedef TNODE qgar::GenEdge< TNODE, TEDGE >::node_type
 

Type of the data stored in a node.

Definition at line 135 of file GenEdge.H.

template<class TNODE, class TEDGE>
typedef const node_type* qgar::GenEdge< TNODE, TEDGE >::node_type_const_pointer
 

Constant pointer to qgar::GenEdge::node_type.

Definition at line 155 of file GenEdge.H.

template<class TNODE, class TEDGE>
typedef const node_type& qgar::GenEdge< TNODE, TEDGE >::node_type_const_reference
 

Constant reference to qgar::GenEdge::node_type.

Definition at line 145 of file GenEdge.H.

template<class TNODE, class TEDGE>
typedef node_type* qgar::GenEdge< TNODE, TEDGE >::node_type_pointer
 

Pointer to qgar::GenEdge::node_type.

Definition at line 150 of file GenEdge.H.

template<class TNODE, class TEDGE>
typedef node_type& qgar::GenEdge< TNODE, TEDGE >::node_type_reference
 

Reference to qgar::GenEdge::node_type.

Definition at line 140 of file GenEdge.H.


Constructor & Destructor Documentation

template<class TNODE, class TEDGE>
qgar::GenEdge< TNODE, TEDGE >::GenEdge short int  aFlag = 0  ) 
 

Default constructor.

The source and target of the edge are set to 0.

Parameters:
aFlag value of the node flag (default 0)

Definition at line 51 of file GenEdge.TCC.

template<class TNODE, class TEDGE>
qgar::GenEdge< TNODE, TEDGE >::GenEdge edge_type_const_reference  aData,
short int  aFlag = 0
 

Initialize with data.

The source and target of the edge are set to 0.

Parameters:
aData data to be contained in the edge
aFlag value of the node flag (default 0)

template<class TNODE, class TEDGE>
qgar::GenEdge< TNODE, TEDGE >::GenEdge GenNode< node_type, edge_type > *const   aPSource,
GenNode< node_type, edge_type > *const   aPTarget,
short int  aFlag = 0
 

Initialize with source and target.

Parameters:
aPSource a pointer to the source node (may be 0)
aPTarget a pointer to the target node (may be 0)
aFlag value of the node flag (default 0)

template<class TNODE, class TEDGE>
qgar::GenEdge< TNODE, TEDGE >::GenEdge GenNode< node_type, edge_type > *const   aPSource,
GenNode< node_type, edge_type > *const   aPTarget,
edge_type_const_reference  aData,
short int  aFlag = 0
 

Initialize with data, source and target.

Parameters:
aData data to be contained in the edge
aPSource a pointer to the source node (may be 0)
aPTarget a pointer to the target node (may be 0)
aFlag value of the node flag (default 0)

template<class TNODE, class TEDGE>
qgar::GenEdge< TNODE, TEDGE >::GenEdge const GenEdge< node_type, edge_type > &  anEdge  ) 
 

Copy constructor.

Parameters:
anEdge edge to be copied
Warning:
The constructor performs a shallow copy: The two nodes adjacent to the edge are not duplicated.
Todo:
This constructor performs a shallow copy. Could it perform a deep copy? Nodes adjacent to the edge would thus be copied, and then all edges adjacent to these nodes, and the nodes adjacent to these edges... and then the whole graph!...

Definition at line 114 of file GenEdge.TCC.

template<class TNODE, class TEDGE>
qgar::GenEdge< TNODE, TEDGE >::~GenEdge  ) 
 

Non-virtual destructor.

Definition at line 134 of file GenEdge.TCC.


Member Function Documentation

template<class TNODE, class TEDGE>
const TEDGE & qgar::GenEdge< TNODE, TEDGE >::accessData  )  const [inline]
 

Get edge data.

Definition at line 149 of file GenEdge.TCC.

References qgar::GenEdge< TNODE, TEDGE >::_data.

template<class TNODE, class TEDGE>
const GenNode< TNODE, TEDGE > & qgar::GenEdge< TNODE, TEDGE >::accessSource  )  const [inline]
 

Get source node.

Definition at line 204 of file GenEdge.TCC.

References qgar::GenEdge< TNODE, TEDGE >::_pSource.

template<class TNODE, class TEDGE>
const GenNode< TNODE, TEDGE > & qgar::GenEdge< TNODE, TEDGE >::accessTarget  )  const [inline]
 

Get target node.

Definition at line 234 of file GenEdge.TCC.

References qgar::GenEdge< TNODE, TEDGE >::_pTarget.

template<class TNODE, class TEDGE>
TEDGE qgar::GenEdge< TNODE, TEDGE >::data  )  const [inline]
 

Get a copy of edge data.

Definition at line 159 of file GenEdge.TCC.

References qgar::GenEdge< TNODE, TEDGE >::_data.

template<class TNODE, class TEDGE>
short int qgar::GenEdge< TNODE, TEDGE >::flag  )  const [inline]
 

Get edge flag.

Definition at line 179 of file GenEdge.TCC.

References qgar::GenEdge< TNODE, TEDGE >::_flag.

template<class TNODE, class TEDGE>
bool qgar::GenEdge< TNODE, TEDGE >::operator!= const GenEdge< node_type, edge_type > &  anEdge  )  [inline]
 

Inequality.

Test if the data of the current edge do not compare equal to the data of given edge anEdge, using operator <b>== applying to objects of type TEDGE, The values of the flags are not taken into account.

Parameters:
anEdge an edge

Definition at line 336 of file GenEdge.TCC.

References qgar::GenEdge< TNODE, TEDGE >::_data.

template<class TNODE, class TEDGE>
GenEdge< TNODE, TEDGE > & qgar::GenEdge< TNODE, TEDGE >::operator= const GenEdge< node_type, edge_type > &  anEdge  ) 
 

Assignment.

Parameters:
anEdge edge to be assigned
Warning:
The function performs a shallow copy: The two nodes adjacent to the edge are not duplicated.
Todo:
This constructor performs a shallow copy. Could it perform a deep copy? Nodes adjacent to the edge would thus be copied, and then all edges adjacent to these nodes, and the nodes adjacent to these edges... and then the whole graph!...

Definition at line 307 of file GenEdge.TCC.

References qgar::GenEdge< TNODE, TEDGE >::_data, qgar::GenEdge< TNODE, TEDGE >::_flag, qgar::GenEdge< TNODE, TEDGE >::_pSource, and qgar::GenEdge< TNODE, TEDGE >::_pTarget.

template<class TNODE, class TEDGE>
bool qgar::GenEdge< TNODE, TEDGE >::operator== const GenEdge< node_type, edge_type > &  anEdge  )  [inline]
 

Equality.

Parameters:
anEdge an edge
Test if the data of the current edge compare equal to the data of given edge anEdge, using operator <b>== applying to objects of type TEDGE, The values of the flags are not taken into account.

Definition at line 326 of file GenEdge.TCC.

References qgar::GenEdge< TNODE, TEDGE >::_data.

template<class TNODE, class TEDGE>
GenNode< TNODE, TEDGE > * qgar::GenEdge< TNODE, TEDGE >::pSource  )  const [inline]
 

Get a pointer to source node.

Definition at line 224 of file GenEdge.TCC.

References qgar::GenEdge< TNODE, TEDGE >::_pSource.

template<class TNODE, class TEDGE>
GenNode< TNODE, TEDGE > * qgar::GenEdge< TNODE, TEDGE >::pTarget  )  const [inline]
 

Get a pointer to target node.

Definition at line 254 of file GenEdge.TCC.

References qgar::GenEdge< TNODE, TEDGE >::_pTarget.

template<class TNODE, class TEDGE>
void qgar::GenEdge< TNODE, TEDGE >::setData edge_type_const_reference  aData  )  [inline]
 

Set edge data.

Parameters:
aData data to be contained in the edge

template<class TNODE, class TEDGE>
void qgar::GenEdge< TNODE, TEDGE >::setFlag short int  aFlag  )  [inline]
 

Set edge flag.

Parameters:
aFlag value to assign to the flag

Definition at line 189 of file GenEdge.TCC.

References qgar::GenEdge< TNODE, TEDGE >::_flag.

template<class TNODE, class TEDGE>
void qgar::GenEdge< TNODE, TEDGE >::setPNode GenNode< node_type, edge_type > *  aPNode  )  [inline]
 

Set (pointer to) given node as source or target.

The given node becomes the source of the current edge if the source is free. Otherwise, the given node becomes the target of the current edge.

Parameters:
aPNode pointer to a node (may be 0)

template<class TNODE, class TEDGE>
void qgar::GenEdge< TNODE, TEDGE >::setPSource GenNode< node_type, edge_type > *  aPSource  )  [inline]
 

Set (pointer to) source node.

Parameters:
aPSource pointer to a node (may be 0)

template<class TNODE, class TEDGE>
void qgar::GenEdge< TNODE, TEDGE >::setPTarget GenNode< node_type, edge_type > *  aPTarget  )  [inline]
 

Set (pointer to the) target node.

Parameters:
aPTarget pointer to a node (may be 0)

template<class TNODE, class TEDGE>
GenNode< TNODE, TEDGE > qgar::GenEdge< TNODE, TEDGE >::source  )  const [inline]
 

Get a copy of source node.

Definition at line 214 of file GenEdge.TCC.

References qgar::GenEdge< TNODE, TEDGE >::_pSource.

template<class TNODE, class TEDGE>
GenNode< TNODE, TEDGE > qgar::GenEdge< TNODE, TEDGE >::target  )  const [inline]
 

Get a copy of target node.

Definition at line 244 of file GenEdge.TCC.

References qgar::GenEdge< TNODE, TEDGE >::_pTarget.


Member Data Documentation

template<class TNODE, class TEDGE>
edge_type qgar::GenEdge< TNODE, TEDGE >::_data [protected]
 

Data contained in the edge.

Definition at line 402 of file GenEdge.H.

Referenced by qgar::GenEdge< TNODE, TEDGE >::accessData(), qgar::GenEdge< TNODE, TEDGE >::data(), qgar::GenEdge< TNODE, TEDGE >::operator!=(), qgar::GenEdge< TNODE, TEDGE >::operator=(), and qgar::GenEdge< TNODE, TEDGE >::operator==().

template<class TNODE, class TEDGE>
short int qgar::GenEdge< TNODE, TEDGE >::_flag [protected]
 

Flag at client's disposal (default 0).

Definition at line 407 of file GenEdge.H.

Referenced by qgar::GenEdge< TNODE, TEDGE >::flag(), qgar::GenEdge< TNODE, TEDGE >::operator=(), and qgar::GenEdge< TNODE, TEDGE >::setFlag().

template<class TNODE, class TEDGE>
GenNode<node_type, edge_type>* qgar::GenEdge< TNODE, TEDGE >::_pSource [protected]
 

Pointer to the source node.

Definition at line 412 of file GenEdge.H.

Referenced by qgar::GenEdge< TNODE, TEDGE >::accessSource(), qgar::GenEdge< TNODE, TEDGE >::operator=(), qgar::GenEdge< TNODE, TEDGE >::pSource(), and qgar::GenEdge< TNODE, TEDGE >::source().

template<class TNODE, class TEDGE>
GenNode<node_type, edge_type>* qgar::GenEdge< TNODE, TEDGE >::_pTarget [protected]
 

Pointer to the target node.

Definition at line 417 of file GenEdge.H.

Referenced by qgar::GenEdge< TNODE, TEDGE >::accessTarget(), qgar::GenEdge< TNODE, TEDGE >::operator=(), qgar::GenEdge< TNODE, TEDGE >::pTarget(), and qgar::GenEdge< TNODE, TEDGE >::target().


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