graph::Arc< EdgeContent > Struct Template Reference

Type of a undirected edge (or arc). More...

#include <edge.h>

List of all members.

Public Types

typedef EdgeContent content_t
typedef Edge< EdgeContent > edge_t
typedef edge_identity_t identity_t
 Type of the identity of a vertex.

Public Member Functions

 Arc (identity_t src, identity_t tgt, EdgeContent *c1, EdgeContent *c2)
 Full constructor -> should never be called by the user.
 Arc (const Arc &copy)
 Copy constructor.
 Arc ()
 Cosntruct an empty (null) arc.
Arc inv () const
 Returns the opposite arc.
bool isNull () const
 Test if the content is null.
 operator bool () const
 AN arc evaluates to true if it contains some data.
 operator edge_t () const
 Convert the current arc into the corresponding edge.
EdgeContent & operator* () const
 Reference the content of the arc.
Arc operator- () const
 Unary '-' operator synchronize edges and returns opposite arc.
EdgeContent * operator-> () const
 Reference the content of the arc as a pointer.
identity_t source () const
 Returns the identifier of the source of the edge.
void sync () const
 Synchronize both sides of the arc.
identity_t target () const
 Returns the identifier of the target of the edge.
 ~Arc ()
 Destroy and copy the content of the arcs.

Protected Attributes

identity_t _source
identity_t _target
EdgeContent * main
EdgeContent * other

Detailed Description

template<typename EdgeContent>
struct graph::Arc< EdgeContent >

Type of a undirected edge (or arc).

When an arc is destroyed, the content of the main edge is copied in the other one.

Note that you should never keep an arc! Is is meant for temporary usage. This is why there is no copy constructor or operator=.

Definition at line 271 of file edge.h.


Member Typedef Documentation

template<typename EdgeContent >
typedef edge_identity_t graph::Arc< EdgeContent >::identity_t

Type of the identity of a vertex.

Definition at line 276 of file edge.h.


Constructor & Destructor Documentation

template<typename EdgeContent >
graph::Arc< EdgeContent >::Arc (  )  [inline]

Cosntruct an empty (null) arc.

Definition at line 371 of file edge.h.

Referenced by graph::Arc< EdgeContent >::inv().

00372     : _source(0)
00373     , _target(0)
00374     , main(0)
00375     , other(0)
00376   {}

template<typename EdgeContent >
graph::Arc< EdgeContent >::Arc ( const Arc< EdgeContent > &  copy  )  [inline]

Copy constructor.

Definition at line 387 of file edge.h.

00388     : _source(copy._source)
00389     , _target(copy._target)
00390     , main(copy.main)
00391     , other(copy.other)
00392   {}

template<typename EdgeContent >
graph::Arc< EdgeContent >::Arc ( identity_t  src,
identity_t  tgt,
EdgeContent *  c1,
EdgeContent *  c2 
) [inline]

Full constructor -> should never be called by the user.

Definition at line 379 of file edge.h.

00380     : _source(src)
00381     , _target(tgt)
00382     , main(e1)
00383     , other(e2)
00384   {}

template<typename EdgeContent >
graph::Arc< EdgeContent >::~Arc (  )  [inline]

Destroy and copy the content of the arcs.

Definition at line 324 of file edge.h.

References graph::Arc< EdgeContent >::sync().

00324 { sync(); }


Member Function Documentation

template<typename EdgeContent >
Arc< EdgeContent > graph::Arc< EdgeContent >::inv (  )  const [inline]

Returns the opposite arc.

Careful, it is not synchronized!

Definition at line 396 of file edge.h.

References graph::Arc< EdgeContent >::Arc().

Referenced by graph::Arc< EdgeContent >::operator-().

00397   {
00398     return Arc(_target, _source, other, main);
00399   }

template<typename EdgeContent >
bool graph::Arc< EdgeContent >::isNull (  )  const [inline]

Test if the content is null.

Definition at line 329 of file edge.h.

00329 { return main == 0; }

template<typename EdgeContent >
graph::Arc< EdgeContent >::operator bool (  )  const [inline]

AN arc evaluates to true if it contains some data.

Definition at line 334 of file edge.h.

00334 { return main != 0; }

template<typename EdgeContent >
graph::Arc< EdgeContent >::operator edge_t (  )  const [inline]

Convert the current arc into the corresponding edge.

Definition at line 304 of file edge.h.

00305       {
00306         return edge_t(_source, _target, main);
00307       }

template<typename EdgeContent >
EdgeContent& graph::Arc< EdgeContent >::operator* (  )  const [inline]

Reference the content of the arc.

Definition at line 339 of file edge.h.

00339 { return *main; }

template<typename EdgeContent >
Arc graph::Arc< EdgeContent >::operator- (  )  const [inline]

Unary '-' operator synchronize edges and returns opposite arc.

Definition at line 319 of file edge.h.

References graph::Arc< EdgeContent >::inv().

00319 { return inv(); }

template<typename EdgeContent >
EdgeContent* graph::Arc< EdgeContent >::operator-> (  )  const [inline]

Reference the content of the arc as a pointer.

Definition at line 343 of file edge.h.

00343 { return main; }

template<typename EdgeContent >
identity_t graph::Arc< EdgeContent >::source (  )  const [inline]

Returns the identifier of the source of the edge.

Note:
You should rather use the VVGraph::source() method that returns the source vertex.

Definition at line 351 of file edge.h.

00351 { return _source; }

template<typename EdgeContent >
void graph::Arc< EdgeContent >::sync (  )  const [inline]

Synchronize both sides of the arc.

Definition at line 363 of file edge.h.

References graph::copy_symmetric().

Referenced by graph::Arc< EdgeContent >::~Arc().

00363 {  if(main) copy_symmetric(*other, *main); }

template<typename EdgeContent >
identity_t graph::Arc< EdgeContent >::target (  )  const [inline]

Returns the identifier of the target of the edge.

Note:
You should rather use the VVGraph::target() method that returns the target vertex.

Definition at line 358 of file edge.h.

00358 { return _target; }


The documentation for this struct was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Fri May 31 15:38:08 2013 for VVE by  doxygen 1.6.3