TPIE

2362a60
tpie::pipelining::virtual_chunk_begin< Output > Class Template Reference

Virtual chunk that has no input (that is, virtual producer). More...

#include <tpie/pipelining/virtual.h>

Inherits tpie::pipelining::bits::virtual_chunk_base.

Public Member Functions

 virtual_chunk_begin ()
 Constructor that leaves the virtual chunk unassigned. More...
 
template<typename fact_t >
 virtual_chunk_begin (pipe_begin< fact_t > &&pipe, virtual_container *ctr=0)
 Constructor that recursively constructs a node and takes ownership of it. More...
 
template<typename Mid >
 virtual_chunk_begin (const virtual_chunk_begin< Mid > &left, const virtual_chunk< Mid, Output > &right)
 Constructor that combines two virtual chunks. More...
 
template<typename fact_t >
virtual_chunk_beginoperator= (pipe_begin< fact_t > &&pipe)
 Construct a node and assign it to this virtual chunk. More...
 
template<typename NextOutput >
virtual_chunk_begin< NextOutput > operator| (virtual_chunk< Output, NextOutput > dest)
 Connect this virtual chunk to another chunk. More...
 
virtual_chunk_base operator| (virtual_chunk_end< Output > dest)
 Connect this virtual chunk to another chunk. More...
 
virt_node::ptr get_node () const
 
void set_container (virtual_container *ctr)
 
bool empty () const
 
void operator() (stream_size_type items, progress_indicator_base &pi, memory_size_type filesAvailable, memory_size_type mem, const char *file, const char *function)
 Invoke the pipeline. More...
 
void operator() (stream_size_type items, progress_indicator_base &pi, memory_size_type mem, const char *file, const char *function)
 Invoke the pipeline with amount of available files automatically configured. More...
 
double memory () const
 
void order_before (pipeline_base &other)
 
void plot (std::ostream &out)
 Generate a GraphViz plot of the pipeline. More...
 
void plot_full (std::ostream &out)
 Generate a GraphViz plot of the actor graph. More...
 
void forward_any (std::string key, any_noncopyable value)
 
bool can_fetch (std::string key)
 
any_noncopyablefetch_any (std::string key)
 
node_map::ptr get_node_map () const
 
void output_memory (std::ostream &o) const
 
size_t uid () const
 

Protected Attributes

virt_node::ptr m_node
 
double m_memory
 
node_map::ptr m_nodeMap
 
size_t m_uid
 

Friends

class bits::access
 

Detailed Description

template<typename Output>
class tpie::pipelining::virtual_chunk_begin< Output >

Virtual chunk that has no input (that is, virtual producer).

Definition at line 287 of file virtual.h.

Constructor & Destructor Documentation

template<typename Output>
tpie::pipelining::virtual_chunk_begin< Output >::virtual_chunk_begin ( )
inline

Constructor that leaves the virtual chunk unassigned.

Definition at line 505 of file virtual.h.

506  : m_recv(0)
507  {}
template<typename Output>
template<typename fact_t >
tpie::pipelining::virtual_chunk_begin< Output >::virtual_chunk_begin ( pipe_begin< fact_t > &&  pipe,
virtual_container ctr = 0 
)
inline

Constructor that recursively constructs a node and takes ownership of it.

Definition at line 514 of file virtual.h.

514  {
515  *this = std::forward<pipe_begin<fact_t>>(pipe);
516  set_container(ctr);
517  }
template<typename Output>
template<typename Mid >
tpie::pipelining::virtual_chunk_begin< Output >::virtual_chunk_begin ( const virtual_chunk_begin< Mid > &  left,
const virtual_chunk< Mid, Output > &  right 
)
inline

Constructor that combines two virtual chunks.

Assumes that the virtual nodes are already connected. You should not use this constructor directly; instead, use the pipe operator.

Definition at line 525 of file virtual.h.

527  : virtual_chunk_base(left.get_node_map(),
528  bits::virt_node::combine(left.get_node(), right.get_node()))
529  {
530  m_recv = acc::get_destination(right);
531  }
static ptr combine(ptr left, ptr right)
Aggregate ownership of virt_nodes.
Definition: virtual.h:206

Member Function Documentation

void tpie::pipelining::bits::pipeline_base::operator() ( stream_size_type  items,
progress_indicator_base pi,
memory_size_type  filesAvailable,
memory_size_type  mem,
const char *  file,
const char *  function 
)
inherited

Invoke the pipeline.

Referenced by tpie::pipelining::bits::pipeline_base::operator()().

void tpie::pipelining::bits::pipeline_base::operator() ( stream_size_type  items,
progress_indicator_base pi,
memory_size_type  mem,
const char *  file,
const char *  function 
)
inlineinherited

Invoke the pipeline with amount of available files automatically configured.

Definition at line 123 of file pipeline.h.

References tpie::get_file_manager(), and tpie::pipelining::bits::pipeline_base::operator()().

125  {
126  operator()(items, pi, get_file_manager().available(), mem, file, function);
127  }
void operator()(stream_size_type items, progress_indicator_base &pi, memory_size_type filesAvailable, memory_size_type mem, const char *file, const char *function)
Invoke the pipeline.
file_manager & get_file_manager()
Return a reference to the file manager.
template<typename Output>
template<typename fact_t >
virtual_chunk_begin& tpie::pipelining::virtual_chunk_begin< Output >::operator= ( pipe_begin< fact_t > &&  pipe)
inline

Construct a node and assign it to this virtual chunk.

Definition at line 537 of file virtual.h.

References tpie::pipelining::node::get_node_map(), tpie::log_error(), and tpie::pipelining::bits::virt_node::take_own().

537  {
538  if (this->m_node) {
539  log_error() << "Virtual chunk assigned twice" << std::endl;
540  throw tpie::exception("Virtual chunk assigned twice");
541  }
542  typedef typename fact_t::template constructed<recv_type>::type constructed_type;
543  recv_type temp(m_recv);
544  this->m_nodeMap = m_recv->get_node_map();
545  fact_t f = std::move(pipe.factory);
546  f.set_destination_kind_push();
547  this->m_node = bits::virt_node::take_own(new constructed_type(f.construct(std::move(temp))));
548  return *this;
549  }
bits::node_map::ptr get_node_map() const
Get the local node map, mapping node IDs to node pointers for all the nodes reachable from this one...
Definition: node.h:251
static ptr take_own(node *pipe)
Take std::new-ownership of given node.
Definition: virtual.h:196
logstream & log_error()
Return logstream for writing error log messages.
Definition: tpie_log.h:147
template<typename Output>
template<typename NextOutput >
virtual_chunk_begin<NextOutput> tpie::pipelining::virtual_chunk_begin< Output >::operator| ( virtual_chunk< Output, NextOutput >  dest)
inline

Connect this virtual chunk to another chunk.

Definition at line 555 of file virtual.h.

555  {
556  if (empty()) throw virtual_chunk_missing_begin();
557  if (dest.empty()) {
558  return *bits::assert_types_equal_and_return<Output, NextOutput, virtual_chunk_begin<NextOutput> *>
559  ::go(this);
560  }
561  m_recv->set_destination(acc::get_source(dest));
562  return virtual_chunk_begin<NextOutput>(*this, dest);
563  }
template<typename Output>
virtual_chunk_base tpie::pipelining::virtual_chunk_begin< Output >::operator| ( virtual_chunk_end< Output >  dest)
inline

Connect this virtual chunk to another chunk.

Definition at line 568 of file virtual.h.

References tpie::pipelining::bits::virt_node::combine().

568  {
569  if (empty()) throw virtual_chunk_missing_begin();
570  if (dest.empty()) throw virtual_chunk_missing_end();
571  m_recv->set_destination(acc::get_source(dest));
572  return virtual_chunk_base(this->m_nodeMap,
573  bits::virt_node::combine(get_node(), dest.get_node()));
574  }
static ptr combine(ptr left, ptr right)
Aggregate ownership of virt_nodes.
Definition: virtual.h:206
void tpie::pipelining::bits::pipeline_base_base::plot ( std::ostream &  out)
inlineinherited

Generate a GraphViz plot of the pipeline.

When rendered with dot, GraphViz will place the nodes in the topological order of the item flow graph with items flowing from the top downwards.

Thus, a downwards arrow in the plot is a push edge, and an upwards arrow is a pull edge (assuming no cycles in the item flow graph).

Compared to plot_full, sorts, buffers and reversers will be represented as one node in the graph as apposed to 3 or 2. Nodes added by virtual wrapping will not be showed at all

Definition at line 65 of file pipeline.h.

65 {plot_impl(out, false);}
void tpie::pipelining::bits::pipeline_base_base::plot_full ( std::ostream &  out)
inlineinherited

Generate a GraphViz plot of the actor graph.

When rendered with dot, GraphViz will place the nodes in the topological order of the item flow graph with items flowing from the top downwards.

Thus, a downwards arrow in the plot is a push edge, and an upwards arrow is a pull edge (assuming no cycles in the item flow graph).

Definition at line 77 of file pipeline.h.

77 {plot_impl(out, true);}

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