TPIE

11a2c2d
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>

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=nullptr)
 Constructor that recursively constructs a node and takes ownership of it. 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...
 
 operator bool () const noexcept
 Test if it is not an empty chunk. More...
 

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

Constructor & Destructor Documentation

◆ virtual_chunk_begin() [1/2]

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

Constructor that leaves the virtual chunk unassigned.

Definition at line 644 of file virtual.h.

645  : m_output(nullptr)
646  {}

◆ virtual_chunk_begin() [2/2]

template<typename Output >
template<typename fact_t >
tpie::pipelining::virtual_chunk_begin< Output >::virtual_chunk_begin ( pipe_begin< fact_t > &&  pipe,
virtual_container ctr = nullptr 
)
inline

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

Definition at line 653 of file virtual.h.

653  {
654  *this = std::forward<pipe_begin<fact_t>>(pipe);
655  set_container(ctr);
656  }

Member Function Documentation

◆ operator bool()

template<typename Output >
tpie::pipelining::virtual_chunk_begin< Output >::operator bool ( ) const
inlineexplicitnoexcept

Test if it is not an empty chunk.

Definition at line 705 of file virtual.h.

705  {
706  return m_output != nullptr;
707  }

◆ operator=()

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

662  {
663  if (this->m_node) {
664  log_error() << "Virtual chunk assigned twice" << std::endl;
665  throw tpie::exception("Virtual chunk assigned twice");
666  }
667  typedef typename fact_t::template constructed_type<output_type> constructed_type;
668  output_type temp(m_output);
669  this->m_nodeMap = m_output->get_node_map();
670  fact_t f = std::move(pipe.factory);
671  f.set_destination_kind_push();
672  this->m_node = bits::virt_node::take_own(new constructed_type(f.construct(std::move(temp))));
673  return *this;
674  }

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

◆ operator|() [1/2]

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

680  {
681  if (empty()) throw virtual_chunk_missing_begin();
682  if (dest.empty()) {
683  return *bits::assert_types_equal_and_return<Output, NextOutput, virtual_chunk_begin<NextOutput> *>
684  ::go(this);
685  }
686  m_output->set_destination(acc::get_input(dest));
687  return acc::construct<virtual_chunk_begin<NextOutput>>(*this, dest);
688  }

◆ operator|() [2/2]

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

693  {
694  if (empty()) throw virtual_chunk_missing_begin();
695  if (dest.empty()) throw virtual_chunk_missing_end();
696  m_output->set_destination(acc::get_input(dest));
697  return acc::construct<virtual_chunk_base>(
698  this->m_nodeMap,
699  bits::virt_node::combine(get_node(), dest.get_node()));
700  }

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


The documentation for this class was generated from the following file:
tpie::pipelining::bits::virt_node::take_own
static ptr take_own(node *pipe)
Take std::new-ownership of given node.
Definition: virtual.h:309
tpie::log_error
logstream & log_error()
Return logstream for writing error log messages.
Definition: tpie_log.h:148
tpie::pipelining::node::get_node_map
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:250
tpie::exception
Definition: exception.h:33
tpie::pipelining::bits::virt_node::combine
static ptr combine(ptr left, ptr right)
Aggregate ownership of virt_nodes.
Definition: virtual.h:319