#include <chain.hh>
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 () |
Chain & | operator>> (const Recycler &) |
Chain & | operator>> (const WriteAndRecycle &writer) |
Chain & | operator>> (const PWriteAndRecycle &writer) |
void | Wait (bool release_memory=true) |
void | Start () |
bool | Running () const |
Definition at line 111 of file chain.hh.
util::stream::Chain::Chain | ( | const ChainConfig & | config | ) | [explicit] |
Constructs a configured Chain.
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 | ( | ) |
void util::stream::Chain::ActivateProgress | ( | ) | [inline] |
Definition at line 134 of file chain.hh.
References util::stream::MultiProgress::Activate(), and Running().
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>>().
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().
std::size_t util::stream::Chain::BlockSize | ( | ) | const [inline] |
Gets the inital valid size for blocks in this chain.
Definition at line 157 of file chain.hh.
Referenced by util::stream::Stream::Init(), util::stream::RewindableStream::Init(), util::stream::LineInput::Run(), util::stream::PWriteAndRecycle::Run(), util::stream::WriteAndRecycle::Run(), util::stream::PRead::Run(), util::stream::Read::Run(), and util::stream::Recycler::Run().
void util::stream::Chain::CompleteLoop | ( | ) | [inline] |
Definition at line 202 of file chain.hh.
References util::stream::kRecycle.
Referenced by operator>>(), and Wait().
std::size_t util::stream::Chain::EntrySize | ( | ) | const [inline] |
Gets the number of bytes in each record of a Block.
Definition at line 148 of file chain.hh.
References util::stream::ChainConfig::entry_size.
Referenced by util::stream::Stream::Init(), util::stream::RewindableStream::Init(), util::stream::BlockSorter< Compare >::Run(), util::stream::MergingReader< Compare, Combine >::Run(), util::stream::PRead::Run(), util::stream::Read::Run(), and util::stream::CountRecords::Run().
Chain & util::stream::Chain::operator>> | ( | const PWriteAndRecycle & | writer | ) |
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.
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().
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.
Definition at line 193 of file chain.hh.
References Add().
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.
Definition at line 179 of file chain.hh.
References Add().
bool util::stream::Chain::Running | ( | ) | const [inline] |
Definition at line 228 of file chain.hh.
Referenced by ActivateProgress(), and Add().
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().
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().
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().