dlvhex  2.5.0
EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT > Class Template Reference

The EvalGraph template manages a generic evaluation graph: it takes care of a correct join order among in-edges of units,. More...

#include <include/dlvhex2/EvalGraph.h>

Collaboration diagram for EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >:

Data Structures

struct  EvalUnitDepPropertyBundle
 Couples an EvalUnitDep with its properties. More...
struct  EvalUnitPropertyBundle
 Couples an EvalUnit with its properties. More...
struct  Impl
 Helper for printing a single EvalUnit in dot format. More...
class  Observer
 Observer. More...

Public Types

typedef EvalUnitPropertyBaseT EvalUnitPropertyBase
typedef EvalUnitDepPropertyBaseT EvalUnitDepPropertyBase
typedef boost::adjacency_list
< boost::vecS, boost::vecS,
boost::bidirectionalS,
EvalUnitPropertyBundle,
EvalUnitDepPropertyBundle
EvalGraphInt
typedef boost::graph_traits
< EvalGraphInt
Traits
typedef
EvalGraphInt::vertex_descriptor 
EvalUnit
typedef
EvalGraphInt::edge_descriptor 
EvalUnitDep
typedef Traits::vertex_iterator EvalUnitIterator
typedef Traits::edge_iterator DependencyIterator
typedef Traits::out_edge_iterator PredecessorIterator
typedef Traits::in_edge_iterator SuccessorIterator
typedef boost::shared_ptr
< Observer
ObserverPtr

Public Member Functions

 EvalGraph ()
 Constructor.
 EvalGraph (const EvalGraph &other)
 Copy-constructor.
const EvalGraphIntgetInt () const
EvalUnit addUnit (const EvalUnitPropertyBundle &prop)
 Adds an evaluation unit with properties.
EvalUnitDep addDependency (EvalUnit u1, EvalUnit u2, const EvalUnitDepPropertyBundle &prop)
 Adds a dependency.
void addObserver (ObserverPtr o)
 Adds an observer.
void eraseObserver (ObserverPtr o)
 Removes an observer.
std::pair< EvalUnitIterator,
EvalUnitIterator
getEvalUnits () const
 Retrieves all evaluation units.
std::pair< PredecessorIterator,
PredecessorIterator
getPredecessors (EvalUnit u) const
std::pair< SuccessorIterator,
SuccessorIterator
getSuccessors (EvalUnit u) const
 Successors are eval units we provide input to, edges are dependencies, so successors are at incoming edges.
const EvalUnitDepPropertyBundlepropsOf (EvalUnitDep d) const
 Retrieves the properties of an evaluation unit dependency.
EvalUnitDepPropertyBundlepropsOf (EvalUnitDep d)
 Retrieves the properties of an evaluation unit dependency.
const EvalUnitPropertyBundlepropsOf (EvalUnit u) const
 Retrieves the properties of an evaluation unit.
EvalUnitPropertyBundlepropsOf (EvalUnit u)
 Retrieves the properties of an evaluation unit.
EvalUnit sourceOf (EvalUnitDep d) const
 Retrieves the source unit of a depedency.
EvalUnit targetOf (EvalUnitDep d) const
 Retrieves the target unit of a depedency.
unsigned countEvalUnits () const
 Returns the number of evaluation units.
unsigned countEvalUnitDeps () const
 Returns the number of dependencies.
void writeGraphViz (std::ostream &o, bool verbose) const
 Output graph as graphviz source (dot file).

Private Attributes

EvalGraphInt eg
std::set< ObserverPtrobservers

Detailed Description

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
class EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >

The EvalGraph template manages a generic evaluation graph: it takes care of a correct join order among in-edges of units,.

Definition at line 62 of file EvalGraph.h.


Member Typedef Documentation

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
typedef Traits::edge_iterator EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::DependencyIterator

Definition at line 137 of file EvalGraph.h.

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, EvalUnitPropertyBundle, EvalUnitDepPropertyBundle> EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::EvalGraphInt

Definition at line 131 of file EvalGraph.h.

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
typedef EvalGraphInt::vertex_descriptor EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::EvalUnit

Definition at line 134 of file EvalGraph.h.

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
typedef EvalGraphInt::edge_descriptor EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::EvalUnitDep

Definition at line 135 of file EvalGraph.h.

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
typedef EvalUnitDepPropertyBaseT EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::EvalUnitDepPropertyBase

Definition at line 69 of file EvalGraph.h.

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
typedef Traits::vertex_iterator EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::EvalUnitIterator

Definition at line 136 of file EvalGraph.h.

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
typedef EvalUnitPropertyBaseT EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::EvalUnitPropertyBase

Definition at line 68 of file EvalGraph.h.

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
typedef boost::shared_ptr<Observer> EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::ObserverPtr

Definition at line 154 of file EvalGraph.h.

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
typedef Traits::out_edge_iterator EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::PredecessorIterator

Definition at line 138 of file EvalGraph.h.

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
typedef Traits::in_edge_iterator EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::SuccessorIterator

Definition at line 139 of file EvalGraph.h.

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
typedef boost::graph_traits<EvalGraphInt> EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::Traits

Definition at line 132 of file EvalGraph.h.


Constructor & Destructor Documentation

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::EvalGraph ( ) [inline]

Constructor.

Definition at line 168 of file EvalGraph.h.

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::EvalGraph ( const EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT > &  other)

Copy-constructor.

This is not implemented on purpose (=linker error) because it is forbidden to use (it cannot be private as this would cause concept checks to fail (TODO: check why clang produces such bad error messages in this case).

Parameters:
otherSecond EvalGraph.

Member Function Documentation

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
EvalUnitDep EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::addDependency ( EvalUnit  u1,
EvalUnit  u2,
const EvalUnitDepPropertyBundle prop 
) [inline]
template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
void EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::addObserver ( ObserverPtr  o) [inline]

Adds an observer.

Parameters:
oObserver to add.

Definition at line 223 of file EvalGraph.h.

References EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::observers.

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
EvalUnit EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::addUnit ( const EvalUnitPropertyBundle prop) [inline]

Adds an evaluation unit with properties.

Parameters:
propEvaluation unit and properties to add.

Definition at line 181 of file EvalGraph.h.

References EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::eg, and EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::observers.

Referenced by BOOST_FIXTURE_TEST_CASE(), EvalGraphBuilder::createEvalUnit(), and main().

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
unsigned EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::countEvalUnitDeps ( ) const [inline]

Returns the number of dependencies.

Returns:
Number of dependencies.

Definition at line 314 of file EvalGraph.h.

References EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::eg.

Referenced by main().

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
unsigned EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::countEvalUnits ( ) const [inline]

Returns the number of evaluation units.

Returns:
Number of evaluation units.

Definition at line 307 of file EvalGraph.h.

References EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::eg.

Referenced by main().

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
void EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::eraseObserver ( ObserverPtr  o) [inline]

Removes an observer.

Parameters:
oObserver to remove.

Definition at line 229 of file EvalGraph.h.

References EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::observers.

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
std::pair<EvalUnitIterator, EvalUnitIterator> EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::getEvalUnits ( ) const [inline]

Retrieves all evaluation units.

Returns:
Pair of begin and end iterator.

Definition at line 236 of file EvalGraph.h.

References EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::eg.

Referenced by BOOST_FIXTURE_TEST_CASE(), main(), and writeEgMgGraphViz().

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
const EvalGraphInt& EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::getInt ( ) const [inline]
template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
std::pair<PredecessorIterator, PredecessorIterator> EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::getPredecessors ( EvalUnit  u) const [inline]
template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
std::pair<SuccessorIterator, SuccessorIterator> EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::getSuccessors ( EvalUnit  u) const [inline]

Successors are eval units we provide input to, edges are dependencies, so successors are at incoming edges.

Parameters:
uEvaluation unit.
Returns:
Successors of u represented by a pair of begin and end iterator.

Definition at line 254 of file EvalGraph.h.

References EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::eg.

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
const EvalUnitDepPropertyBundle& EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::propsOf ( EvalUnitDep  d) const [inline]

Retrieves the properties of an evaluation unit dependency.

Parameters:
dEvalUnitDep.
Returns:
Properties of d.

Definition at line 262 of file EvalGraph.h.

References EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::eg.

Referenced by EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::addDependency(), EvalGraphBuilder::createEvalUnit(), and writeEgMgGraphViz().

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
EvalUnitDepPropertyBundle& EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::propsOf ( EvalUnitDep  d) [inline]

Retrieves the properties of an evaluation unit dependency.

Parameters:
dEvalUnitDep.
Returns:
Properties of d.

Definition at line 270 of file EvalGraph.h.

References EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::eg.

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
const EvalUnitPropertyBundle& EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::propsOf ( EvalUnit  u) const [inline]

Retrieves the properties of an evaluation unit.

Parameters:
uEvalUnit.
Returns:
Properties of u.

Definition at line 277 of file EvalGraph.h.

References EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::eg.

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
EvalUnitPropertyBundle& EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::propsOf ( EvalUnit  u) [inline]

Retrieves the properties of an evaluation unit.

Parameters:
uEvalUnit.
Returns:
Properties of u.

Definition at line 285 of file EvalGraph.h.

References EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::eg.

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
EvalUnit EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::sourceOf ( EvalUnitDep  d) const [inline]

Retrieves the source unit of a depedency.

Parameters:
dEvalUnitDep.
Returns:
Source unit of d.

Definition at line 292 of file EvalGraph.h.

References EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::eg.

template<typename EvalUnitPropertyBaseT = none_t, typename EvalUnitDepPropertyBaseT = none_t>
EvalUnit EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::targetOf ( EvalUnitDep  d) const [inline]

Retrieves the target unit of a depedency.

Parameters:
dEvalUnitDep.
Returns:
Target unit of d.

Definition at line 300 of file EvalGraph.h.

References EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::eg.

template<typename EvalUnitPropertyBaseT , typename EvalUnitDepPropertyBaseT >
void EvalGraph< EvalUnitPropertyBaseT, EvalUnitDepPropertyBaseT >::writeGraphViz ( std::ostream &  o,
bool  verbose 
) const

Output graph as graphviz source (dot file).

Helper for printing the graph in dot format.

Parameters:
oStream to print the graph to.
verboseTrue to include more information.
oStream to write to.
verboseTrue to include more detailed information.

Definition at line 366 of file EvalGraph.h.

References graphviz::escape().


Field Documentation


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