util::stream::Chain Class Reference

#include <chain.hh>

Collaboration diagram for util::stream::Chain:

Collaboration graph
[legend]

List of all members.

Classes

struct  CheckForRun

Public Member Functions

 Chain (const ChainConfig &config)
 ~Chain ()
void ActivateProgress ()
void SetProgressTarget (uint64_t target)
std::size_t EntrySize () const
std::size_t BlockSize () const
std::size_t BlockCount () const
ChainPosition Add ()
template<class Worker >
CheckForRun< Worker >::type & operator>> (const Worker &worker)
template<class Worker >
CheckForRun< Worker >::type & operator>> (const boost::reference_wrapper< Worker > &worker)
void CompleteLoop ()
Chainoperator>> (const Recycler &)
Chainoperator>> (const WriteAndRecycle &writer)
Chainoperator>> (const PWriteAndRecycle &writer)
void Wait (bool release_memory=true)
void Start ()
bool Running () const


Detailed Description

Represents a sequence of workers, through which blocks can pass.

Definition at line 111 of file chain.hh.


Constructor & Destructor Documentation

util::stream::Chain::Chain ( const ChainConfig config  )  [explicit]

Constructs a configured Chain.

Parameters:
config Specifies how to configure the Chain.

Definition at line 36 of file chain.cc.

References util::stream::ChainConfig::block_count, util::stream::ChainConfig::entry_size, util::stream::ChainConfig::total_memory, and UTIL_THROW_IF.

util::stream::Chain::~Chain (  ) 

Destructs a Chain.

This method waits for the chain's threads to complete, and frees the memory held by this chain.

Definition at line 44 of file chain.cc.

References Wait().

Here is the call graph for this function:


Member Function Documentation

void util::stream::Chain::ActivateProgress (  )  [inline]

Definition at line 134 of file chain.hh.

References util::stream::MultiProgress::Activate(), and Running().

Here is the call graph for this function:

ChainPosition util::stream::Chain::Add (  ) 

Two ways to add to the chain: Add() or operator>>.

Definition at line 48 of file chain.cc.

References util::stream::ChainConfig::block_count, Running(), and Start().

Referenced by util::stream::operator>>(), and operator>>().

Here is the call graph for this function:

Here is the caller graph for this function:

std::size_t util::stream::Chain::BlockCount (  )  const [inline]

Number of blocks going through the Chain.

Definition at line 164 of file chain.hh.

References util::stream::ChainConfig::block_count.

Referenced by util::stream::RewindableStream::Init().

Here is the caller graph for this function:

std::size_t util::stream::Chain::BlockSize (  )  const [inline]

void util::stream::Chain::CompleteLoop (  )  [inline]

Definition at line 202 of file chain.hh.

References util::stream::kRecycle.

Referenced by operator>>(), and Wait().

Here is the caller graph for this function:

std::size_t util::stream::Chain::EntrySize (  )  const [inline]

Chain & util::stream::Chain::operator>> ( const PWriteAndRecycle writer  ) 

Definition at line 60 of file chain.cc.

Chain & util::stream::Chain::operator>> ( const WriteAndRecycle writer  ) 

Adds a WriteAndRecycle worker to this chain, and runs that worker in a new Thread owned by this chain.

Definition at line 55 of file chain.cc.

Chain& util::stream::Chain::operator>> ( const Recycler  )  [inline]

Adds a Recycler worker to this chain, and runs that worker in a new Thread owned by this chain.

Definition at line 210 of file chain.hh.

References CompleteLoop().

Here is the call graph for this function:

template<class Worker >
CheckForRun<Worker>::type& util::stream::Chain::operator>> ( const boost::reference_wrapper< Worker > &  worker  )  [inline]

Adds a new worker to this chain (but avoids copying that worker), and runs that worker in a new Thread owned by this chain.

The worker must have a Run method that accepts a position argument.

See also:
Thread::operator()()

Definition at line 193 of file chain.hh.

References Add().

Here is the call graph for this function:

template<class Worker >
CheckForRun<Worker>::type& util::stream::Chain::operator>> ( const Worker worker  )  [inline]

Adds a new worker to this chain, and runs that worker in a new Thread owned by this chain.

The worker must have a Run method that accepts a position argument.

See also:
Thread::operator()()

Definition at line 179 of file chain.hh.

References Add().

Here is the call graph for this function:

bool util::stream::Chain::Running (  )  const [inline]

Definition at line 228 of file chain.hh.

Referenced by ActivateProgress(), and Add().

Here is the caller graph for this function:

void util::stream::Chain::SetProgressTarget ( uint64_t  target  )  [inline]

Definition at line 139 of file chain.hh.

References util::stream::MultiProgress::SetTarget().

Referenced by util::stream::Sort< Compare, Combine >::Output().

Here is the call graph for this function:

Here is the caller graph for this function:

void util::stream::Chain::Start (  ) 

Definition at line 84 of file chain.cc.

References util::stream::ChainConfig::block_count, util::scoped_base< T, Closer >::get(), util::MallocOrThrow(), util::scoped_base< T, Closer >::reset(), and Wait().

Referenced by Add().

Here is the call graph for this function:

Here is the caller graph for this function:

void util::stream::Chain::Wait ( bool  release_memory = true  ) 

Definition at line 65 of file chain.cc.

References util::stream::ChainConfig::block_count, CompleteLoop(), util::stream::MultiProgress::Finished(), and util::scoped_base< T, Closer >::reset().

Referenced by util::stream::BlockingSort(), util::stream::Sort< Compare, Combine >::Merge(), Start(), and ~Chain().

Here is the call graph for this function:

Here is the caller graph for this function:


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

Generated on Thu Jul 6 00:34:53 2017 for Moses by  doxygen 1.5.9