TPIE

v1.1rc1-6-g0c97303
tpie::pipelining::virtual_chunk< Input, Output > Class Template Reference

Virtual chunk that has input and output. More...

#include <tpie/pipelining/virtual.h>

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

Public Member Functions

 virtual_chunk ()
 Constructor that leaves the virtual chunk unassigned. More...
 
template<typename fact_t >
 virtual_chunk (const pipe_middle< fact_t > &pipe, virtual_container *ctr=0)
 Constructor that recursively constructs a node and takes ownership of it. More...
 
template<typename Mid >
 virtual_chunk (const virtual_chunk< Input, Mid > &left, const virtual_chunk< Mid, Output > &right)
 Constructor that combines two virtual chunks. More...
 
template<typename fact_t >
virtual_chunkoperator= (const pipe_middle< fact_t > &pipe)
 Construct a node and assign it to this virtual chunk. More...
 
template<typename NextOutput >
virtual_chunk< Input, NextOutput > operator| (virtual_chunk< Output, NextOutput > dest)
 Connect this virtual chunk to another chunk. More...
 
virtual_chunk_end< Input > 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 Input, typename Output>
class tpie::pipelining::virtual_chunk< Input, Output >

Virtual chunk that has input and output.

Definition at line 276 of file virtual.h.

Constructor & Destructor Documentation

template<typename Input, typename Output>
tpie::pipelining::virtual_chunk< Input, Output >::virtual_chunk ( )
inline

Constructor that leaves the virtual chunk unassigned.

Definition at line 380 of file virtual.h.

381  : m_src(0)
382  , m_recv(0)
383  {}
template<typename Input, typename Output>
template<typename fact_t >
tpie::pipelining::virtual_chunk< Input, Output >::virtual_chunk ( const pipe_middle< fact_t > &  pipe,
virtual_container ctr = 0 
)
inline

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

Definition at line 390 of file virtual.h.

390  {
391  *this = pipe;
392  set_container(ctr);
393  }
template<typename Input, typename Output>
template<typename Mid >
tpie::pipelining::virtual_chunk< Input, Output >::virtual_chunk ( const virtual_chunk< Input, 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 401 of file virtual.h.

403  : virtual_chunk_base(left.get_node_map(), bits::virt_node::combine(left.get_node(), right.get_node()))
404  {
405  m_src = acc::get_source(left);
406  m_recv = acc::get_destination(right);
407  }
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 Input, typename Output>
template<typename fact_t >
virtual_chunk& tpie::pipelining::virtual_chunk< Input, Output >::operator= ( const pipe_middle< fact_t > &  pipe)
inline

Construct a node and assign it to this virtual chunk.

Definition at line 413 of file virtual.h.

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

413  {
414  if (this->m_node) {
415  log_error() << "Virtual chunk assigned twice" << std::endl;
416  throw tpie::exception("Virtual chunk assigned twice");
417  }
418  typedef typename fact_t::template constructed<recv_type>::type constructed_type;
419  recv_type temp(m_recv);
420  m_src = new bits::virtsrc_impl<constructed_type>(pipe.factory.construct(temp));
421  this->m_node = bits::virt_node::take_own(m_src);
422  this->m_segmap = temp.get_node_map();
423 
424  return *this;
425  }
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 Input, typename Output>
template<typename NextOutput >
virtual_chunk<Input, NextOutput> tpie::pipelining::virtual_chunk< Input, Output >::operator| ( virtual_chunk< Output, NextOutput >  dest)
inline

Connect this virtual chunk to another chunk.

Definition at line 431 of file virtual.h.

431  {
432  if (!*this) {
433  return *bits::assert_types_equal_and_return<Input, Output, virtual_chunk<Input, NextOutput> *>
434  ::go(&dest);
435  }
436  m_recv->set_destination(acc::get_source(dest));
437  return virtual_chunk<Input, NextOutput>(*this, dest);
438  }
template<typename Input, typename Output>
virtual_chunk_end<Input> tpie::pipelining::virtual_chunk< Input, Output >::operator| ( virtual_chunk_end< Output >  dest)
inline

Connect this virtual chunk to another chunk.

Definition at line 443 of file virtual.h.

443  {
444  if (!*this) {
445  return *bits::assert_types_equal_and_return<Input, Output, virtual_chunk_end<Input> *>
446  ::go(&dest);
447  }
448  m_recv->set_destination(acc::get_source(dest));
449  return virtual_chunk_end<Input>(*this, dest);
450  }
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: