Go to the documentation of this file.
24 #ifndef __TPIE_PIPELINING_BUFFER_H__
25 #define __TPIE_PIPELINING_BUFFER_H__
27 #include <tpie/pipelining/node.h>
28 #include <tpie/pipelining/factory_helpers.h>
29 #include <tpie/pipelining/pipe_base.h>
30 #include <tpie/file_stream.h>
47 set_name(
"Fetching items", PRIORITY_SIGNIFICANT);
54 m_queue_ptr = fetch<tpie::maybe<file_stream<T> > *>(
"queue");
55 m_queue = &**m_queue_ptr;
57 forward(
"items", m_queue->size());
61 bool can_pull()
const {
62 return m_queue->can_read();
67 return m_queue->
read();
70 virtual void end()
override {
71 (*m_queue_ptr).destruct();
88 set_name(
"Storing items", PRIORITY_INSIGNIFICANT);
99 void push(
const T & item) {
100 m_queue->write(item);
109 std::shared_ptr<node> m_output;
115 template <
typename dest_t>
121 : dest(std::move(dest))
127 set_name(
"Buffer", PRIORITY_INSIGNIFICANT);
133 m_queue_ptr = fetch<tpie::maybe<file_stream<item_type> > *>(
"queue");
134 m_queue = &**m_queue_ptr;
135 forward(
"items", m_queue->size());
141 while (m_queue->can_read()) {
142 dest.push(m_queue->
read());
162 template <
typename T>
209 #endif // __TPIE_PIPELINING_BUFFER_H__
pipelining/factory_base.h Base class of pipelining factories
void propagate() override
Propagate stream metadata.
Plain old file_stream buffer.
const T & read()
Reads next item from stream if can_read() == true.
void end() override
End pipeline processing phase.
void set_minimum_memory(memory_size_type minimumMemory)
Called by implementers to declare minimum memory requirements.
Class to deduce the item_type of a node of type T.
void set_plot_options(flags< PLOT > options)
Set options specified for plot(), as a combination of node::PLOT values.
void forward(std::string key, T value, memory_size_type k=std::numeric_limits< memory_size_type >::max())
Called by implementers to forward auxiliary data to successors.
void add_push_destination(const node_token &dest)
Called by implementers to declare a push destination.
@ compression_normal
Compress some blocks according to available resources (time, memory).
pipe_middle< split_factory< bits::buffer_input_t, node, bits::buffer_output_t > > buffer
The buffer node inserts a phase boundary into the pipeline by writing items to disk.
void set_name(const std::string &name, priority_type priority=PRIORITY_USER)
Set this node's name.
void set_minimum_resource_usage(resource_type type, memory_size_type usage)
Called by implementers to declare minimum resource requirements.
void step(stream_size_type steps=1)
Step the progress indicator.
void set_steps(stream_size_type steps)
Called by implementers that intend to call step().
@ access_sequential
Sequential access is intended.
void add_dependency(const node_token &dest)
Called by implementers to declare a node dependency, that is, a requirement that another node has end...
void destruct()
Invokes the deconstructor on the object contained.
void propagate() override
Propagate stream metadata.
pipe_end< termfactory< bits::output_t< T >, file_stream< T > & > > output(file_stream< T > &fs)
A pipelining node that writes the pushed items to a file stream.
node()
Default constructor, using a new node_token.
void go() override
For initiator nodes, execute this phase by pushing all items to be pushed.
virtual void end() override
End pipeline processing phase.