TPIE

11a2c2d
tpie::pipelining::factory_base Class Reference

Base class of all pipelining factories. More...

#include <tpie/pipelining/factory_base.h>

Inherited by tpie::pipelining::bits::devirtualization_factory< Input, Output >, tpie::pipelining::bits::devirtualization_pull_factory< Input, Output >, tpie::pipelining::bits::passive_sorter_factory_input< T, pred_t, store_t >, tpie::pipelining::bits::passive_sorter_factory_output< T, pred_t, store_t >, tpie::pipelining::bits::sort_factory< pred_t, store_t >, tpie::pipelining::factory< R, T >, tpie::pipelining::parallel_bits::factory< fact_t >, tpie::pipelining::serialization_bits::passive_sorter_factory_input< Traits >, tpie::pipelining::serialization_bits::passive_sorter_factory_output< Traits >, tpie::pipelining::serialization_bits::sort_factory< pred_t >, tpie::pipelining::split_factory< I, OB, O >, tpie::pipelining::termfactory< R, T >, and tpie::pipelining::tfactory< R, Args< TT... >, T... >.

Public Member Functions

 factory_base (const factory_base &other)=delete
 
 factory_base (factory_base &&)=default
 
factory_baseoperator= (const factory_base &other)=delete
 
factory_baseoperator= (factory_base &&)=default
 
void memory (double amount) noexcept
 Set memory fraction for this node in the pipeline phase. More...
 
double memory () const noexcept
 Set memory fraction for this node in the pipeline phase. More...
 
void hook_initialization (factory_init_hook *hook)
 Add a node initialization hook. More...
 
void copy_hooks_to (factory_base &other) const
 Copy the hooks that have been added to this factory to another. More...
 
void init_node (node &r)
 \Brief Initialize node constructed in a subclass. More...
 
void init_sub_node (node &r)
 Initialize node constructed in a subclass. More...
 
void add_default_edge (node &r, const node &dest) const
 Used by pipe_base classes to set a default actor edge for ordinary push/pull nodes. More...
 
void add_default_edge (node &r, const node_token &dest) const
 Used by pipe_base classes to set a default actor edge for ordinary push/pull nodes. More...
 
void add_node_set_edges (node &r) const
 
void name (const std::string &n, priority_type p)
 Set name for this node. More...
 
void phase_name (const std::string &n, priority_type p)
 Set name for this phase. More...
 
void push_breadcrumb (const std::string &n)
 Set a prefix for the name of this node. More...
 
void set_destination_kind_push () noexcept
 Used by pipe_base classes to indicate that the default actor edge is a push edge. More...
 
void set_destination_kind_pull () noexcept
 Used by pipe_base classes to indicate that the default actor edge is a pull edge. More...
 
void add_to_set (node_set s)
 
void add_dependencies (node_set s)
 
void add_forwarding_dependencies (node_set s)
 
void forward (const std::string &key, any_noncopyable value)
 

Detailed Description

Base class of all pipelining factories.

The subclass must define an inner template struct named constructed, that takes one template parameter dest_t and defines an inner typedef named type that is the actual type of node constructed.

If the factory foo_factory constructs foo objects, then the type expression foo_factory::constructed<bar<baz> >::type should be equal to foo<bar<baz> >.

The subclass must also define a template const method named construct, that takes one template parameter dest_t, has the return type constructed<dest_t>::type and takes just one parameter dest of type dest_t.

If the factory constructs just one node descendent, then the factory should call the factory_base::init_node method with this node as parameter. For example see tpie/pipelining/factory_helpers.h.

If the factory constructs multiple node descendents, then the factory should call the factory_base::init_sub_node method for each of the nodes. For example see sort_factory_base in tpie/pipelining/sort.h.

Definition at line 73 of file factory_base.h.

Member Function Documentation

◆ add_default_edge() [1/2]

void tpie::pipelining::factory_base::add_default_edge ( node r,
const node dest 
) const

Used by pipe_base classes to set a default actor edge for ordinary push/pull nodes.

◆ add_default_edge() [2/2]

void tpie::pipelining::factory_base::add_default_edge ( node r,
const node_token dest 
) const

Used by pipe_base classes to set a default actor edge for ordinary push/pull nodes.

◆ copy_hooks_to()

void tpie::pipelining::factory_base::copy_hooks_to ( factory_base other) const

Copy the hooks that have been added to this factory to another.

◆ hook_initialization()

void tpie::pipelining::factory_base::hook_initialization ( factory_init_hook hook)

Add a node initialization hook.

When a node is instantiated in construct(), the given hook will get a chance to do some additional initialization.

◆ init_node()

void tpie::pipelining::factory_base::init_node ( node r)

\Brief Initialize node constructed in a subclass.

This lets the user define a name or memory fraction for this certain node in the pipeline phase, and it lets initialization hooks do their thing.

If more than one node is constructed in the subclass in construct(), the implementation should use init_sub_node instead.

◆ init_sub_node()

void tpie::pipelining::factory_base::init_sub_node ( node r)

Initialize node constructed in a subclass.

This lets the user define a name or memory fraction for this certain node in the pipeline phase, and it lets initialization hooks do their thing.

If just one node is constructed in the subclass in construct(), the implementation should use init_node instead.

◆ memory() [1/2]

double tpie::pipelining::factory_base::memory ( ) const
inlinenoexcept

Set memory fraction for this node in the pipeline phase.

In the absence of minimum and maximum memory requirements set by node implementations, the memory assigned to the node will be proportional to the amount parameter which sets the memory priority of this node in relation to the rest of the phase.

See also
factory_base::memory(double)
memory(double)
bits::pipe_base::memory()

Definition at line 99 of file factory_base.h.

99  {
100  return m_amount;
101  }

◆ memory() [2/2]

void tpie::pipelining::factory_base::memory ( double  amount)
inlinenoexcept

Set memory fraction for this node in the pipeline phase.

In the absence of minimum and maximum memory requirements set by node implementations, the memory assigned to the node will be proportional to the amount parameter which sets the memory priority of this node in relation to the rest of the phase.

See also
factory_base::memory(double)
bits::pipe_base::memory(double)

Definition at line 87 of file factory_base.h.

87  {
88  m_amount = amount;
89  m_set = true;
90  }

Referenced by tpie::pipelining::bits::pipe_base< pipe_begin< fact_t > >::memory().

◆ name()

void tpie::pipelining::factory_base::name ( const std::string &  n,
priority_type  p 
)
inline

Set name for this node.

The name is used in the GraphViz plot generated by pipeline::plot.

The name priority given in the second argument should indicate how important this node is for the current phase, and is used in naming the progress indicator for this phase. The node with the highest priority name gets to name the entire phase.

See also
factory_base::name
bits::pipe_base::name

Definition at line 160 of file factory_base.h.

160  {
161  m_name = n;
162  m_namePriority = p;
163  }

Referenced by tpie::pipelining::bits::pipe_base< pipe_begin< fact_t > >::name().

◆ phase_name()

void tpie::pipelining::factory_base::phase_name ( const std::string &  n,
priority_type  p 
)
inline

Set name for this phase.

The maximal priority phase name given for a phase wins.

See also
factory_base::phase_name
bits::pipe_base::phase_name

Definition at line 171 of file factory_base.h.

171  {
172  m_phaseName = n;
173  m_phaseNamePriority = p;
174  }

Referenced by tpie::pipelining::bits::pipe_base< pipe_begin< fact_t > >::phase_name().

◆ push_breadcrumb()

void tpie::pipelining::factory_base::push_breadcrumb ( const std::string &  n)
inline

Set a prefix for the name of this node.

The name is used in the GraphViz plot generated by pipeline::plot.

See also
factory_base::push_breadcrumb
bits::pipe_base::breadcrumb

Definition at line 183 of file factory_base.h.

183  {
184  if (m_breadcrumbs.empty()) m_breadcrumbs = n;
185  else m_breadcrumbs = n + " | " + m_breadcrumbs;
186  }

Referenced by tpie::pipelining::bits::pipe_base< pipe_begin< fact_t > >::breadcrumb().

◆ set_destination_kind_pull()

void tpie::pipelining::factory_base::set_destination_kind_pull ( )
inlinenoexcept

Used by pipe_base classes to indicate that the default actor edge is a pull edge.

Definition at line 200 of file factory_base.h.

200  {
201  m_destinationKind = destination_kind::pull;
202  }

◆ set_destination_kind_push()

void tpie::pipelining::factory_base::set_destination_kind_push ( )
inlinenoexcept

Used by pipe_base classes to indicate that the default actor edge is a push edge.

Definition at line 192 of file factory_base.h.

192  {
193  m_destinationKind = destination_kind::push;
194  }

Referenced by tpie::pipelining::pipe_middle< fact_t >::operator|().


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