TPIE

v1.1rc1-6-g0c97303
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 (const 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= (const 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)
 
 operator bool ()
 
void operator() (stream_size_type items, progress_indicator_base &pi, memory_size_type mem)
 Invoke the pipeline. More...
 
void plot (std::ostream &out)
 Generate a GraphViz plot of the actor graph. More...
 
double memory () const
 
node_map::ptr get_node_map () const
 
void forward_any (std::string key, const boost::any &value)
 
bool can_fetch (std::string key)
 
boost::any fetch_any (std::string key)
 

Protected Attributes

virt_node::ptr m_node
 
node_map::ptr m_segmap
 
double m_memory
 

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 280 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 478 of file virtual.h.

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

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

Definition at line 487 of file virtual.h.

487  {
488  *this = pipe;
489  set_container(ctr);
490  }
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 498 of file virtual.h.

500  : virtual_chunk_base(left.get_node_map(),
501  bits::virt_node::combine(left.get_node(), right.get_node()))
502  {
503  m_recv = acc::get_destination(right);
504  }
static ptr combine(ptr left, ptr right)
Aggregate ownership of virt_nodes.
Definition: virtual.h:199

Member Function Documentation

void tpie::pipelining::bits::pipeline_base::operator() ( stream_size_type  items,
progress_indicator_base pi,
memory_size_type  mem 
)
inherited

Invoke the pipeline.

template<typename Output>
template<typename fact_t >
virtual_chunk_begin& tpie::pipelining::virtual_chunk_begin< Output >::operator= ( const pipe_begin< fact_t > &  pipe)
inline

Construct a node and assign it to this virtual chunk.

Definition at line 510 of file virtual.h.

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

510  {
511  if (this->m_node) {
512  log_error() << "Virtual chunk assigned twice" << std::endl;
513  throw tpie::exception("Virtual chunk assigned twice");
514  }
515  typedef typename fact_t::template constructed<recv_type>::type constructed_type;
516  recv_type temp(m_recv);
517  this->m_node = bits::virt_node::take_own(new constructed_type(pipe.factory.construct(temp)));
518  this->m_segmap = m_recv->get_node_map();
519  return *this;
520  }
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:119
static ptr take_own(node *pipe)
Take std::new-ownership of given node.
Definition: virtual.h:189
logstream & log_error()
Return logstream for writing error log messages.
Definition: tpie_log.h:104
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 526 of file virtual.h.

526  {
527  if (!*this) throw virtual_chunk_missing_begin();
528  if (!dest) {
529  return *bits::assert_types_equal_and_return<Output, NextOutput, virtual_chunk_begin<NextOutput> *>
530  ::go(this);
531  }
532  m_recv->set_destination(acc::get_source(dest));
533  return virtual_chunk_begin<NextOutput>(*this, dest);
534  }
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 539 of file virtual.h.

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

539  {
540  if (!*this) throw virtual_chunk_missing_begin();
541  if (!dest) throw virtual_chunk_missing_end();
542  m_recv->set_destination(acc::get_source(dest));
543  return virtual_chunk_base(this->m_segmap,
544  bits::virt_node::combine(get_node(), dest.get_node()));
545  }
static ptr combine(ptr left, ptr right)
Aggregate ownership of virt_nodes.
Definition: virtual.h:199
void tpie::pipelining::bits::pipeline_base::plot ( std::ostream &  out)
inherited

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).


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