TPIE

11a2c2d
tpie::pipelining::bits::pull_map_t< src_t, F > Class Template Reference

Inherits tpie::pipelining::node.

Public Types

enum  PLOT { PLOT_SIMPLIFIED_HIDE =1, PLOT_BUFFERED =2, PLOT_PARALLEL =4 }
 Options for how to plot this node. More...
 
enum  STATE {
  STATE_FRESH, STATE_IN_PREPARE, STATE_AFTER_PREPARE, STATE_IN_PROPAGATE,
  STATE_AFTER_PROPAGATE, STATE_IN_BEGIN, STATE_AFTER_BEGIN, STATE_IN_GO,
  STATE_IN_END, STATE_AFTER_END
}
 Used internally to check order of method calls. More...
 
typedef boost::optional< any_noncopyable & > maybeany_t
 

Public Member Functions

 pull_map_t (src_t src, const F &functor)
 
auto pull ()
 
bool can_pull ()
 
memory_size_type get_minimum_resource_usage (resource_type type) const
 Get the minimum amount of the resource declared by this node. More...
 
memory_size_type get_maximum_resource_usage (resource_type type) const
 Get the maximum amount of the resource declared by this node. More...
 
double get_resource_fraction (resource_type type) const
 Get the priority for the specific resource of this node. More...
 
memory_size_type get_available_of_resource (resource_type type) const
 Get the amount of the specific resource assigned to this node. More...
 
void set_minimum_resource_usage (resource_type type, memory_size_type usage)
 Called by implementers to declare minimum resource requirements. More...
 
void set_maximum_resource_usage (resource_type type, memory_size_type usage)
 Called by implementers to declare maximum resource requirements. More...
 
void set_resource_fraction (resource_type type, double f)
 Set the resource priority of this node. More...
 
virtual void resource_available_changed (resource_type, memory_size_type)
 Called by the resource manager to notify the node's available amount of resource has changed. More...
 
void _internal_set_available_of_resource (resource_type type, memory_size_type available)
 Used internally to assign the available resource to the node. More...
 
memory_size_type get_minimum_memory () const
 Get the minimum amount of memory declared by this node. More...
 
memory_size_type get_maximum_memory () const
 Get the maximum amount of memory declared by this node. More...
 
double get_memory_fraction () const
 Get the memory priority of this node. More...
 
memory_size_type get_available_memory () const
 Get the amount of memory assigned to this node. More...
 
void set_minimum_memory (memory_size_type minimumMemory)
 Called by implementers to declare minimum memory requirements. More...
 
void set_maximum_memory (memory_size_type maximumMemory)
 Called by implementers to declare maximum memory requirements. More...
 
void set_memory_fraction (double f)
 Set the memory priority of this node. More...
 
virtual void set_available_memory (memory_size_type availableMemory)
 Called by the memory manager to set the amount of memory assigned to this node. More...
 
memory_size_type get_used_memory () const
 Get the amount of memory currently used by this node. More...
 
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. More...
 
node_token::id_t get_id () const
 Get the internal node ID of this node (mainly for debugging purposes). More...
 
virtual void prepare ()
 Called before memory assignment but after depending phases have executed and ended. More...
 
virtual void propagate ()
 Propagate stream metadata. More...
 
virtual void begin ()
 Begin pipeline processing phase. More...
 
virtual bool is_go_free () const
 
virtual void go ()
 For initiator nodes, execute this phase by pushing all items to be pushed. More...
 
virtual void end ()
 End pipeline processing phase. More...
 
virtual bool can_evacuate ()
 Overridden by nodes that have data to evacuate. More...
 
virtual void evacuate ()
 Overridden by nodes that have data to evacuate. More...
 
priority_type get_name_priority ()
 Get the priority of this node's name. More...
 
const std::string & get_name ()
 Get this node's name. More...
 
void set_name (const std::string &name, priority_type priority=PRIORITY_USER)
 Set this node's name. More...
 
priority_type get_phase_name_priority ()
 Get the priority of this node's pdane name. More...
 
const std::string & get_phase_name ()
 Get this node's phase name. More...
 
void set_phase_name (const std::string &name, priority_type priority=PRIORITY_USER)
 Set this node's phase name. More...
 
void set_breadcrumb (const std::string &breadcrumb)
 Used internally when a pair_factory has a name set. More...
 
stream_size_type get_steps ()
 Used internally for progress indication. More...
 
stream_size_type get_steps_left ()
 
void set_progress_indicator (progress_indicator_base *pi)
 Used internally. Set the progress indicator to use. More...
 
progress_indicator_baseget_progress_indicator ()
 Used internally. Get the progress indicator used. More...
 
STATE get_state () const
 Used internally to check order of method calls. More...
 
void set_state (STATE s)
 Used internally to check order of method calls. More...
 
resource_type get_resource_being_assigned () const
 Used internally to check order of method calls. More...
 
void set_resource_being_assigned (resource_type type)
 Used internally to check order of method calls. More...
 
flags< PLOTget_plot_options () const
 Get options specified for plot(), as a combination of node::PLOT values. More...
 
void set_plot_options (flags< PLOT > options)
 Set options specified for plot(), as a combination of node::PLOT values. More...
 
void add_push_destination (const node_token &dest)
 Called by implementers to declare a push destination. More...
 
void add_push_destination (const node &dest)
 Called by implementers to declare a push destination. More...
 
void add_pull_source (const node_token &dest)
 Called by implementers to declare a pull source. More...
 
void add_pull_source (const node &dest)
 Called by implementers to declare a pull source. More...
 
void add_dependency (const node_token &dest)
 Called by implementers to declare a node dependency, that is, a requirement that another node has end() called before the begin() of this node. More...
 
void add_dependency (const node &dest)
 Called by implementers to declare a node dependency, that is, a requirement that another node has end() called before the begin() of this node. More...
 
void add_memory_share_dependency (const node_token &dest)
 Called by implementers to declare a node memory share dependency, that is, a requirement that another node has end() called before the begin() of this node, and memory shared between end() and begin() unless evacuate() is called. More...
 
void add_memory_share_dependency (const node &dest)
 Called by implementers to declare a node memory share dependency, that is, a requirement that another node has end() called before the begin() of this node, and memory shared between end() and begin() unless evacuate() is called. More...
 
template<typename T >
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. More...
 
void forward_any (std::string key, any_noncopyable value, memory_size_type k=std::numeric_limits< memory_size_type >::max())
 See node::forward. More...
 
bool can_fetch (std::string key)
 Find out if there is a piece of auxiliary data forwarded with a given name. More...
 
maybeany_t fetch_maybe (std::string key)
 Fetch piece of auxiliary data as any_noncopyable (the internal representation) wrapped in a boost::optional which is unitialized if the key is not found. More...
 
any_noncopyablefetch_any (std::string key)
 Fetch piece of auxiliary data as any_noncopyable (the internal representation). More...
 
template<typename T >
T & fetch (std::string key)
 Fetch piece of auxiliary data, expecting a given value type. More...
 
void no_forward_through ()
 Dissablow forwards through this node. More...
 
const node_tokenget_token () const
 Get the node_token that maps this node's ID to a pointer to this. More...
 
void set_steps (stream_size_type steps)
 Called by implementers that intend to call step(). More...
 
void step (stream_size_type steps=1)
 Step the progress indicator. More...
 
progress_indicator_baseproxy_progress_indicator ()
 Get a non-initialized progress indicator for use with external implementations. More...
 
bool can_pull () const
 For pull nodes, return true if there are more items to be pulled. More...
 
void push (const item_type &item)
 For push nodes, push the next item to this node. More...
 
void register_datastructure_usage (const std::string &name, double priority=1)
 Registers a datastructure. More...
 
void set_datastructure_memory_limits (const std::string &name, memory_size_type min, memory_size_type max=std::numeric_limits< memory_size_type >::max())
 Assign memory to a registered datastructure. More...
 
memory_size_type get_datastructure_memory (const std::string &name)
 Returns the memory assigned to a datastructure. More...
 
template<typename T >
void set_datastructure (const std::string &name, T datastructure)
 Returns a previously declared datastructure. More...
 
template<typename T >
T & get_datastructure (const std::string &name)
 Returns a previously declared datastructure. More...
 
void unset_datastructure (const std::string &name)
 
size_t buckets () const
 Count the number of memory buckets. More...
 
std::unique_ptr< memory_bucket > & bucket (size_t i)
 Access a memory bucket. More...
 
tpie::memory_bucket_ref allocator (size_t i=0)
 Return an allocator that counts memory usage within the node. More...
 

Detailed Description

template<typename src_t, typename F>
class tpie::pipelining::bits::pull_map_t< src_t, F >

Definition at line 109 of file map.h.

Member Enumeration Documentation

◆ PLOT

Options for how to plot this node.

Definition at line 84 of file node.h.

84  {
85  PLOT_SIMPLIFIED_HIDE=1,
86  PLOT_BUFFERED=2,
87  PLOT_PARALLEL=4
88  };

◆ STATE

Used internally to check order of method calls.

Definition at line 93 of file node.h.

93  {
94  STATE_FRESH,
95  STATE_IN_PREPARE,
96  STATE_AFTER_PREPARE,
97  STATE_IN_PROPAGATE,
98  STATE_AFTER_PROPAGATE,
99  STATE_IN_BEGIN,
100  STATE_AFTER_BEGIN,
101  STATE_IN_GO,
102  STATE_IN_END,
103  STATE_AFTER_END
104  };

Member Function Documentation

◆ _internal_set_available_of_resource()

void tpie::pipelining::node::_internal_set_available_of_resource ( resource_type  type,
memory_size_type  available 
)
inherited

Used internally to assign the available resource to the node.

◆ add_dependency() [1/2]

void tpie::pipelining::node::add_dependency ( const node dest)
inherited

Called by implementers to declare a node dependency, that is, a requirement that another node has end() called before the begin() of this node.

◆ add_dependency() [2/2]

void tpie::pipelining::node::add_dependency ( const node_token dest)
inherited

Called by implementers to declare a node dependency, that is, a requirement that another node has end() called before the begin() of this node.

◆ add_memory_share_dependency() [1/2]

void tpie::pipelining::node::add_memory_share_dependency ( const node dest)
inherited

Called by implementers to declare a node memory share dependency, that is, a requirement that another node has end() called before the begin() of this node, and memory shared between end() and begin() unless evacuate() is called.

◆ add_memory_share_dependency() [2/2]

void tpie::pipelining::node::add_memory_share_dependency ( const node_token dest)
inherited

Called by implementers to declare a node memory share dependency, that is, a requirement that another node has end() called before the begin() of this node, and memory shared between end() and begin() unless evacuate() is called.

◆ add_pull_source() [1/2]

void tpie::pipelining::node::add_pull_source ( const node dest)
inherited

Called by implementers to declare a pull source.

◆ add_pull_source() [2/2]

void tpie::pipelining::node::add_pull_source ( const node_token dest)
inherited

Called by implementers to declare a pull source.

◆ add_push_destination() [1/2]

void tpie::pipelining::node::add_push_destination ( const node dest)
inherited

Called by implementers to declare a push destination.

◆ add_push_destination() [2/2]

void tpie::pipelining::node::add_push_destination ( const node_token dest)
inherited

Called by implementers to declare a push destination.

◆ allocator()

tpie::memory_bucket_ref tpie::pipelining::node::allocator ( size_t  i = 0)
inlineinherited

Return an allocator that counts memory usage within the node.

Definition at line 787 of file node.h.

787  {
788  return tpie::memory_bucket_ref(bucket(i).get());
789  }

◆ begin()

virtual void tpie::pipelining::node::begin ( )
inlinevirtualinherited

Begin pipeline processing phase.

The implementation may pull() from a pull destination in begin(), and it may push() to a push destination.

The pipelining framework calls begin() on the nodes in the actor graph in a reverse topological order. The framework calls node::begin() on a node after calling begin() on its pull and push destinations.

The default implementation does nothing.

Reimplemented in tpie::pipelining::parallel_bits::producer< T1, T2 >, tpie::pipelining::bits::pull_unique_t< src_t, equal_t >, tpie::pipelining::bits::unique_t< dest_t, equal_t >, tpie::pipelining::bits::named_output_t< T >, tpie::pipelining::serialization_bits::buffer_input_t< T >, tpie::pipelining::bits::sort_output_t< pred_t, dest_t, store_t >, tpie::pipelining::serialization_bits::reverser_input_t< T >, tpie::pipelining::bits::sort_pull_output_t< T, pred_t, store_t >, tpie::pipelining::join< T >::sink_impl, tpie::pipelining::bits::buffer_input_t< T >, tpie::pipelining::bits::pull_peek_t< source_t >, tpie::pipelining::serialization_bits::sort_output_base< Traits >, tpie::pipelining::bits::pull_input_vector_t< T, A >, tpie::pipelining::bits::chunker_t< dest_t >, tpie::pipelining::bits::reverser_input_t< T >, tpie::pipelining::bits::ostream_logger_t< dest_t >, tpie::pipelining::bits::ami_input_t< dest_t >, tpie::pipelining::bits::virtpullrecv< T >, tpie::pipelining::bits::virtrecv< Output >, and tpie::pipelining::bits::virtrecv< T >.

Definition at line 298 of file node.h.

298  {
299  }

Referenced by tpie::pipelining::bits::ostream_logger_t< dest_t >::begin().

◆ bucket()

std::unique_ptr<memory_bucket>& tpie::pipelining::node::bucket ( size_t  i)
inlineinherited

Access a memory bucket.

Definition at line 778 of file node.h.

778  {
779  if (m_buckets.size() <= i) m_buckets.resize(i+1);
780  if (!m_buckets[i]) m_buckets[i].reset(new memory_bucket());
781  return m_buckets[i];
782  }

◆ buckets()

size_t tpie::pipelining::node::buckets ( ) const
inlineinherited

Count the number of memory buckets.

Definition at line 773 of file node.h.

773 {return m_buckets.size();}

◆ can_evacuate()

virtual bool tpie::pipelining::node::can_evacuate ( )
inlinevirtualinherited

Overridden by nodes that have data to evacuate.

Definition at line 334 of file node.h.

334  {
335  return false;
336  }

◆ can_fetch()

bool tpie::pipelining::node::can_fetch ( std::string  key)
inlineinherited

Find out if there is a piece of auxiliary data forwarded with a given name.

Definition at line 588 of file node.h.

588  {
589  return bool(fetch_maybe(key));
590  }

◆ can_pull()

bool tpie::pipelining::node::can_pull ( ) const
inlineinherited

For pull nodes, return true if there are more items to be pulled.

◆ end()

virtual void tpie::pipelining::node::end ( )
inlinevirtualinherited

End pipeline processing phase.

The implementation may pull() from a pull destination in end(), and it may push() to a push destination.

The pipelining framework calls end() on the nodes in the pipeline graph in a topological order. The framework calls node::end() on a node before its pull and push destinations.

The default implementation does nothing, so it does not matter if the implementation calls the parent end().

Reimplemented in tpie::pipelining::parallel_bits::producer< T1, T2 >, tpie::pipelining::serialization_bits::buffer_pull_output_t< T >, tpie::pipelining::serialization_bits::buffer_output_t< dest_t >, tpie::pipelining::bits::named_output_t< T >, tpie::pipelining::serialization_bits::buffer_input_t< T >, tpie::pipelining::bits::internal_reverser_pull_output_t< T >, tpie::pipelining::serialization_bits::reverser_pull_output_t< T >, tpie::pipelining::bits::named_pull_input_t< T >, tpie::pipelining::bits::reverser_pull_output_t< T >, tpie::pipelining::serialization_bits::reverser_output_t< dest_t >, tpie::pipelining::bits::sort_output_t< pred_t, dest_t, store_t >, tpie::pipelining::bits::pull_reverse_input_t< T >, tpie::pipelining::bits::internal_reverser_output_t< dest_t >, tpie::pipelining::bits::pull_input_t< T >, tpie::pipelining::serialization_bits::reverser_input_t< T >, tpie::pipelining::bits::buffer_output_t< dest_t >, tpie::pipelining::bits::sort_pull_output_t< T, pred_t, store_t >, tpie::pipelining::bits::reverser_output_t< dest_t >, tpie::pipelining::bits::buffer_input_t< T >, tpie::pipelining::serialization_bits::sort_output_base< Traits >, tpie::pipelining::bits::input_t< dest_t >, tpie::pipelining::bits::buffer_pull_output_t< T >, tpie::pipelining::bits::chunker_t< dest_t >, tpie::pipelining::bits::internal_buffer_pull_output_t< T >, tpie::pipelining::bits::reverser_input_t< T >, tpie::pipelining::bits::ordered_merge_t< dest_t, fact_t, comp_t >, tpie::pipelining::bits::ostream_logger_t< dest_t >, and tpie::pipelining::bits::count_consecutive_t< dest_t >.

Definition at line 328 of file node.h.

328  {
329  }

Referenced by tpie::pipelining::bits::count_consecutive_t< dest_t >::end(), and tpie::pipelining::bits::ostream_logger_t< dest_t >::end().

◆ evacuate()

virtual void tpie::pipelining::node::evacuate ( )
inlinevirtualinherited

Overridden by nodes that have data to evacuate.

Definition at line 341 of file node.h.

341  {
342  }

◆ fetch()

template<typename T >
T& tpie::pipelining::node::fetch ( std::string  key)
inlineinherited

Fetch piece of auxiliary data, expecting a given value type.

Definition at line 609 of file node.h.

609  {
610  any_noncopyable &item = fetch_any(key);
611  try {
612  return any_cast<T>(item);
613  } catch (const bad_any_noncopyable_cast & e) {
614  std::stringstream ss;
615  ss << "Trying to fetch key '" << key << "' of type "
616  << typeid(T).name() << " but forwarded data was of type "
617  << item.type().name() << ". Message was: " << e.what();
618  throw invalid_argument_exception(ss.str());
619  }
620  }

◆ fetch_any()

any_noncopyable& tpie::pipelining::node::fetch_any ( std::string  key)
inherited

Fetch piece of auxiliary data as any_noncopyable (the internal representation).

◆ fetch_maybe()

maybeany_t tpie::pipelining::node::fetch_maybe ( std::string  key)
inherited

Fetch piece of auxiliary data as any_noncopyable (the internal representation) wrapped in a boost::optional which is unitialized if the key is not found.

◆ forward()

template<typename T >
void tpie::pipelining::node::forward ( std::string  key,
value,
memory_size_type  k = std::numeric_limits<memory_size_type>::max() 
)
inlineinherited

Called by implementers to forward auxiliary data to successors.

If explicitForward is false, the data will not override data forwarded with explicitForward == true.

Parameters
keyThe key of forwarded data
valueThe value of forwarded data
kThe maximum distance to forward the distance. If there are more than k nodes between the forwarding nodes and another node b. b will not be able to fetch the data. Defaults to infinity.

Definition at line 563 of file node.h.

563  {
564  forward_any(key, any_noncopyable(std::move(value)), k);
565  }

Referenced by tpie::pipelining::bits::reverser_input_t< T >::end(), tpie::pipelining::bits::buffer_input_t< T >::end(), tpie::pipelining::bits::ami_input_t< dest_t >::propagate(), tpie::pipelining::bits::input_vector_t< dest_t, T, A >::propagate(), tpie::pipelining::bits::buffer_pull_output_t< T >::propagate(), tpie::pipelining::bits::range_t< dest_t >::propagate(), tpie::pipelining::bits::sort_output_base< push_type< dest_t >::type, pred_t, store_t >::propagate(), tpie::pipelining::bits::input_t< dest_t >::propagate(), tpie::pipelining::bits::ami_input_stack_t< dest_t >::propagate(), tpie::pipelining::serialization_bits::sort_output_base< Traits >::propagate(), tpie::pipelining::bits::pull_input_vector_t< T, A >::propagate(), tpie::pipelining::bits::internal_buffer_input_t< T >::propagate(), tpie::pipelining::bits::internal_reverser_input_t< T >::propagate(), tpie::pipelining::bits::ami_pull_input_stack_t< T >::propagate(), tpie::pipelining::bits::named_input_t< dest_t >::propagate(), tpie::pipelining::bits::reverser_output_t< dest_t >::propagate(), tpie::pipelining::bits::buffer_output_t< dest_t >::propagate(), tpie::pipelining::bits::pull_input_t< T >::propagate(), tpie::pipelining::bits::internal_reverser_output_t< dest_t >::propagate(), tpie::pipelining::bits::pull_reverse_input_t< T >::propagate(), tpie::pipelining::bits::zero_source_t< T >::propagate(), tpie::pipelining::bits::reverser_pull_output_t< T >::propagate(), tpie::pipelining::bits::named_pull_input_t< T >::propagate(), and tpie::pipelining::bits::internal_reverser_pull_output_t< T >::propagate().

◆ forward_any()

void tpie::pipelining::node::forward_any ( std::string  key,
any_noncopyable  value,
memory_size_type  k = std::numeric_limits< memory_size_type >::max() 
)
inherited

◆ get_available_memory()

memory_size_type tpie::pipelining::node::get_available_memory ( ) const
inlineinherited

Get the amount of memory assigned to this node.

Definition at line 199 of file node.h.

199  {
200  return get_available_of_resource(MEMORY);
201  }

◆ get_available_of_resource()

memory_size_type tpie::pipelining::node::get_available_of_resource ( resource_type  type) const
inlineinherited

Get the amount of the specific resource assigned to this node.

Definition at line 137 of file node.h.

137  {
138  return m_parameters.resource_parameters[type].available;
139  }

◆ get_datastructure()

template<typename T >
T& tpie::pipelining::node::get_datastructure ( const std::string &  name)
inlineinherited

Returns a previously declared datastructure.

Parameters
namethe name of the datastructure
Template Parameters
thetype of the datastructure

Definition at line 737 of file node.h.

737  {
738  bits::node_map::datastructuremap_t & structures = get_node_map()->find_authority()->get_datastructures();
739  bits::node_map::datastructuremap_t::iterator i = structures.find(name);
740 
741  if(i == structures.end())
742  throw tpie::exception("attempted to get non-registered datastructure");
743 
744  return any_cast<T>(i->second.second);
745  }

◆ get_datastructure_memory()

memory_size_type tpie::pipelining::node::get_datastructure_memory ( const std::string &  name)
inherited

Returns the memory assigned to a datastructure.

Parameters
namethe name of the datastructure

◆ get_id()

node_token::id_t tpie::pipelining::node::get_id ( ) const
inlineinherited

Get the internal node ID of this node (mainly for debugging purposes).

Definition at line 258 of file node.h.

258  {
259  return token.id();
260  }

◆ get_maximum_memory()

memory_size_type tpie::pipelining::node::get_maximum_memory ( ) const
inlineinherited

Get the maximum amount of memory declared by this node.

Defaults to maxint when no maximum has been set.

Definition at line 185 of file node.h.

185  {
186  return get_maximum_resource_usage(MEMORY);
187  }

◆ get_maximum_resource_usage()

memory_size_type tpie::pipelining::node::get_maximum_resource_usage ( resource_type  type) const
inlineinherited

Get the maximum amount of the resource declared by this node.

Defaults to maxint when no maximum has been set.

Definition at line 123 of file node.h.

123  {
124  return m_parameters.resource_parameters[type].maximum;
125  }

◆ get_memory_fraction()

double tpie::pipelining::node::get_memory_fraction ( ) const
inlineinherited

Get the memory priority of this node.

Definition at line 192 of file node.h.

192  {
193  return get_resource_fraction(MEMORY);
194  }

◆ get_minimum_memory()

memory_size_type tpie::pipelining::node::get_minimum_memory ( ) const
inlineinherited

Get the minimum amount of memory declared by this node.

Defaults to zero when no minimum has been set.

Definition at line 177 of file node.h.

177  {
178  return get_minimum_resource_usage(MEMORY);
179  }

◆ get_minimum_resource_usage()

memory_size_type tpie::pipelining::node::get_minimum_resource_usage ( resource_type  type) const
inlineinherited

Get the minimum amount of the resource declared by this node.

Defaults to zero when no minimum has been set.

Definition at line 115 of file node.h.

115  {
116  return m_parameters.resource_parameters[type].minimum;
117  }

◆ get_name()

const std::string& tpie::pipelining::node::get_name ( )
inherited

Get this node's name.

For purposes of pipeline debugging and phase naming for progress indicator breadcrumbs.

◆ get_name_priority()

priority_type tpie::pipelining::node::get_name_priority ( )
inlineinherited

Get the priority of this node's name.

For purposes of pipeline debugging and phase naming for progress indicator breadcrumbs.

Definition at line 348 of file node.h.

348  {
349  return m_parameters.namePriority;
350  }

◆ get_node_map()

bits::node_map::ptr tpie::pipelining::node::get_node_map ( ) const
inlineinherited

Get the local node map, mapping node IDs to node pointers for all the nodes reachable from this one.

Definition at line 250 of file node.h.

250  {
251  return token.get_map();
252  }

Referenced by tpie::pipelining::virtual_chunk< Input, Output >::operator=(), and tpie::pipelining::virtual_chunk_pull< Input, Output >::operator=().

◆ get_phase_name()

const std::string& tpie::pipelining::node::get_phase_name ( )
inherited

Get this node's phase name.

For purposes of pipeline debugging and phase naming for progress indicator breadcrumbs.

◆ get_phase_name_priority()

priority_type tpie::pipelining::node::get_phase_name_priority ( )
inlineinherited

Get the priority of this node's pdane name.

For purposes of pipeline debugging and phase naming for progress indicator breadcrumbs.

Definition at line 368 of file node.h.

368  {
369  return m_parameters.phaseNamePriority;
370  }

◆ get_plot_options()

flags<PLOT> tpie::pipelining::node::get_plot_options ( ) const
inlineinherited

Get options specified for plot(), as a combination of node::PLOT values.

Definition at line 450 of file node.h.

450  {
451  return m_plotOptions;
452  }

◆ get_progress_indicator()

progress_indicator_base* tpie::pipelining::node::get_progress_indicator ( )
inlineinherited

Used internally. Get the progress indicator used.

Definition at line 414 of file node.h.

414  {
415  return m_pi;
416  }

◆ get_resource_being_assigned()

resource_type tpie::pipelining::node::get_resource_being_assigned ( ) const
inlineinherited

Used internally to check order of method calls.

Definition at line 435 of file node.h.

435  {
436  return m_resourceBeingAssigned;
437  }

◆ get_resource_fraction()

double tpie::pipelining::node::get_resource_fraction ( resource_type  type) const
inlineinherited

Get the priority for the specific resource of this node.

Definition at line 130 of file node.h.

130  {
131  return m_parameters.resource_parameters[type].fraction;
132  }

◆ get_state()

STATE tpie::pipelining::node::get_state ( ) const
inlineinherited

Used internally to check order of method calls.

Definition at line 421 of file node.h.

421  {
422  return m_state;
423  }

◆ get_steps()

stream_size_type tpie::pipelining::node::get_steps ( )
inlineinherited

Used internally for progress indication.

Get the number of times the node expects to call step() at most.

Definition at line 396 of file node.h.

396  {
397  return m_parameters.stepsTotal;
398  }

◆ get_token()

const node_token& tpie::pipelining::node::get_token ( ) const
inlineinherited

Get the node_token that maps this node's ID to a pointer to this.

Definition at line 631 of file node.h.

631  {
632  return token;
633  }

◆ get_used_memory()

memory_size_type tpie::pipelining::node::get_used_memory ( ) const
inlineinherited

Get the amount of memory currently used by this node.

Definition at line 239 of file node.h.

239  {
240  memory_size_type ans=0;
241  for (const auto & p: m_buckets)
242  if (p) ans += p->count;
243  return ans;
244  }

◆ go()

virtual void tpie::pipelining::node::go ( )
inlinevirtualinherited

For initiator nodes, execute this phase by pushing all items to be pushed.

For non-initiator nodes, the default implementation throws a not_initiator_node exception.

Reimplemented in tpie::pipelining::bits::pull_source_t< dest_t, fact_t >, tpie::pipelining::serialization_bits::buffer_output_t< dest_t >, tpie::pipelining::bits::pull_output_t< source_t >, tpie::pipelining::bits::pull_output_iterator_t< dest_t, IT >, tpie::pipelining::bits::push_input_iterator_t< dest_t, IT >, tpie::pipelining::serialization_bits::reverser_output_t< dest_t >, tpie::pipelining::bits::sort_output_t< pred_t, dest_t, store_t >, tpie::pipelining::serialization_bits::sort_output_t< Traits, dest_t >, tpie::pipelining::bits::internal_reverser_output_t< dest_t >, tpie::pipelining::bits::sort_pull_output_t< T, pred_t, store_t >, tpie::pipelining::serialization_bits::sort_pull_output_t< Traits >, tpie::pipelining::bits::buffer_output_t< dest_t >, tpie::pipelining::bits::reverser_output_t< dest_t >, tpie::pipelining::bits::named_input_t< dest_t >, tpie::pipelining::bits::input_t< dest_t >, tpie::pipelining::bits::ami_input_stack_t< dest_t >, tpie::pipelining::bits::range_t< dest_t >, tpie::pipelining::serialization_bits::input_t< dest_t >, tpie::pipelining::bits::input_vector_t< dest_t, T, A >, tpie::pipelining::bits::ami_input_t< dest_t >, and tpie::pipelining::bits::scanf_ints_t< dest_t >.

Definition at line 308 of file node.h.

308  {
309  log_warning() << "node subclass " << typeid(*this).name()
310  << " is not an initiator node" << std::endl;
311  throw not_initiator_node();
312  }

References tpie::log_warning().

◆ no_forward_through()

void tpie::pipelining::node::no_forward_through ( )
inherited

Dissablow forwards through this node.

◆ prepare()

virtual void tpie::pipelining::node::prepare ( )
inlinevirtualinherited

Called before memory assignment but after depending phases have executed and ended.

The implementer may use fetch and forward in this phase. The implementer does not have to call the super prepare-method; its default implementation is empty.

Reimplemented in tpie::pipelining::bits::preparer_t< dest_t, F >, tpie::pipelining::join< T >::source_impl< dest_t >, tpie::pipelining::split< T >::source_impl< dest_t >, and tpie::pipelining::bits::Forwarder< dest_t >.

Definition at line 268 of file node.h.

268  {
269  }

◆ propagate()

virtual void tpie::pipelining::node::propagate ( )
inlinevirtualinherited

Propagate stream metadata.

The implementation may fetch() and forward() metadata such as number of items or the size of a single item.

The pipelining framework calls propagate() on the nodes in the item flow graph in a topological order.

The default implementation does nothing.

Reimplemented in tpie::pipelining::bits::pull_source_t< dest_t, fact_t >, tpie::pipelining::serialization_bits::buffer_pull_output_t< T >, tpie::pipelining::serialization_bits::buffer_output_t< dest_t >, tpie::pipelining::bits::propagater_t< dest_t, F >, tpie::pipelining::serialization_bits::buffer_input_t< T >, tpie::pipelining::bits::internal_reverser_pull_output_t< T >, tpie::pipelining::serialization_bits::reverser_pull_output_t< T >, tpie::pipelining::bits::named_pull_input_t< T >, tpie::pipelining::bits::reverser_pull_output_t< T >, tpie::pipelining::serialization_bits::reverser_output_t< dest_t >, tpie::pipelining::bits::zero_source_t< T >, tpie::pipelining::bits::pull_reverse_input_t< T >, tpie::pipelining::bits::internal_reverser_output_t< dest_t >, tpie::pipelining::bits::pull_input_t< T >, tpie::pipelining::serialization_bits::reverser_input_t< T >, tpie::pipelining::bits::buffer_output_t< dest_t >, tpie::pipelining::bits::reverser_output_t< dest_t >, tpie::pipelining::bits::named_input_t< dest_t >, tpie::pipelining::bits::ami_pull_input_stack_t< T >, tpie::pipelining::bits::internal_reverser_input_t< T >, tpie::pipelining::bits::internal_buffer_input_t< T >, tpie::pipelining::bits::pull_input_vector_t< T, A >, tpie::pipelining::serialization_bits::sort_output_base< Traits >, tpie::pipelining::bits::ami_input_stack_t< dest_t >, tpie::pipelining::bits::input_t< dest_t >, tpie::pipelining::bits::sort_output_base< T, pred_t, store_t >, tpie::pipelining::bits::sort_output_base< push_type< dest_t >::type, pred_t, store_t >, tpie::pipelining::serialization_bits::input_t< dest_t >, tpie::pipelining::bits::buffer_pull_output_t< T >, tpie::pipelining::bits::internal_buffer_pull_output_t< T >, tpie::pipelining::bits::input_vector_t< dest_t, T, A >, tpie::pipelining::bits::ami_input_t< dest_t >, and tpie::pipelining::bits::range_t< dest_t >.

Definition at line 282 of file node.h.

282  {
283  }

◆ proxy_progress_indicator()

progress_indicator_base* tpie::pipelining::node::proxy_progress_indicator ( )
inherited

Get a non-initialized progress indicator for use with external implementations.

When step() is called on a proxying progress indicator, step() is called on the node according to the number of steps declared in progress_indicator_base::init() and in node::set_steps().

◆ push()

void tpie::pipelining::node::push ( const item_type item)
inlineinherited

For push nodes, push the next item to this node.

◆ register_datastructure_usage()

void tpie::pipelining::node::register_datastructure_usage ( const std::string &  name,
double  priority = 1 
)
inherited

Registers a datastructure.

Parameters
namethe name of the datastructure
prioritythe priority that should be given to this datastructure when assigning memory

◆ resource_available_changed()

virtual void tpie::pipelining::node::resource_available_changed ( resource_type  ,
memory_size_type   
)
inlinevirtualinherited

Called by the resource manager to notify the node's available amount of resource has changed.

Reimplemented in tpie::pipelining::bits::sort_output_base< T, pred_t, store_t >, and tpie::pipelining::bits::sort_output_base< push_type< dest_t >::type, pred_t, store_t >.

Definition at line 165 of file node.h.

165  {
166  }

◆ set_available_memory()

virtual void tpie::pipelining::node::set_available_memory ( memory_size_type  availableMemory)
inlinevirtualinherited

Called by the memory manager to set the amount of memory assigned to this node.

Reimplemented in tpie::pipelining::serialization_bits::sort_output_base< Traits >.

Definition at line 232 of file node.h.

232  {
233  unused(availableMemory);
234  }

References tpie::unused().

◆ set_breadcrumb()

void tpie::pipelining::node::set_breadcrumb ( const std::string &  breadcrumb)
inlineinherited

Used internally when a pair_factory has a name set.

Definition at line 388 of file node.h.

388  {
389  m_parameters.name = m_parameters.name.empty() ? breadcrumb : (breadcrumb + " | " + m_parameters.name);
390  }

◆ set_datastructure()

template<typename T >
void tpie::pipelining::node::set_datastructure ( const std::string &  name,
datastructure 
)
inlineinherited

Returns a previously declared datastructure.

Parameters
namethe name of the datastructure
datastructurethe datastructure itself

Definition at line 721 of file node.h.

721  {
722  bits::node_map::datastructuremap_t & structures = get_node_map()->find_authority()->get_datastructures();
723  bits::node_map::datastructuremap_t::iterator i = structures.find(name);
724 
725  if(i == structures.end())
726  throw tpie::exception("attempted to set non-registered datastructure");
727 
728  i->second.second = move_if_movable<T>(datastructure);
729  }

◆ set_datastructure_memory_limits()

void tpie::pipelining::node::set_datastructure_memory_limits ( const std::string &  name,
memory_size_type  min,
memory_size_type  max = std::numeric_limits< memory_size_type >::max() 
)
inherited

Assign memory to a registered datastructure.

Parameters
namethe name of the datastructure
minthe minimum amount of memory required by the datastructure
maxthe maximum amount of memory used by the datastructure

◆ set_maximum_memory()

void tpie::pipelining::node::set_maximum_memory ( memory_size_type  maximumMemory)
inlineinherited

Called by implementers to declare maximum memory requirements.

To signal that you don't want any memory, set minimum memory and the memory fraction to zero.

Definition at line 216 of file node.h.

216  {
217  set_maximum_resource_usage(MEMORY, maximumMemory);
218  }

Referenced by tpie::pipelining::bits::sort_output_base< push_type< dest_t >::type, pred_t, store_t >::propagate(), and tpie::pipelining::serialization_bits::sort_output_base< Traits >::propagate().

◆ set_maximum_resource_usage()

void tpie::pipelining::node::set_maximum_resource_usage ( resource_type  type,
memory_size_type  usage 
)
inherited

Called by implementers to declare maximum resource requirements.

To signal that you don't want to use this resource, set minimum resource usage and the resource fraction to zero.

◆ set_memory_fraction()

void tpie::pipelining::node::set_memory_fraction ( double  f)
inlineinherited

Set the memory priority of this node.

Memory is distributed proportionally to the priorities of the nodes in the given phase.

Definition at line 224 of file node.h.

224  {
225  set_resource_fraction(MEMORY, f);
226  }

Referenced by tpie::pipelining::bits::sort_output_base< push_type< dest_t >::type, pred_t, store_t >::propagate(), and tpie::pipelining::serialization_bits::sort_output_base< Traits >::propagate().

◆ set_minimum_memory()

void tpie::pipelining::node::set_minimum_memory ( memory_size_type  minimumMemory)
inlineinherited

Called by implementers to declare minimum memory requirements.

Definition at line 206 of file node.h.

206  {
207  set_minimum_resource_usage(MEMORY, minimumMemory);
208  }

Referenced by tpie::pipelining::bits::sort_output_base< push_type< dest_t >::type, pred_t, store_t >::propagate(), and tpie::pipelining::serialization_bits::sort_output_base< Traits >::propagate().

◆ set_minimum_resource_usage()

void tpie::pipelining::node::set_minimum_resource_usage ( resource_type  type,
memory_size_type  usage 
)
inherited

Called by implementers to declare minimum resource requirements.

◆ set_name()

void tpie::pipelining::node::set_name ( const std::string &  name,
priority_type  priority = PRIORITY_USER 
)
inherited

Set this node's name.

For purposes of pipeline debugging and phase naming for progress indicator breadcrumbs.

◆ set_phase_name()

void tpie::pipelining::node::set_phase_name ( const std::string &  name,
priority_type  priority = PRIORITY_USER 
)
inherited

Set this node's phase name.

For purposes of pipeline debugging and phase naming for progress indicator breadcrumbs.

◆ set_plot_options()

void tpie::pipelining::node::set_plot_options ( flags< PLOT options)
inlineinherited

Set options specified for plot(), as a combination of node::PLOT values.

Definition at line 458 of file node.h.

458  {
459  m_plotOptions = options;
460  }

◆ set_progress_indicator()

void tpie::pipelining::node::set_progress_indicator ( progress_indicator_base pi)
inlineinherited

Used internally. Set the progress indicator to use.

Definition at line 407 of file node.h.

407  {
408  m_pi = pi;
409  }

◆ set_resource_being_assigned()

void tpie::pipelining::node::set_resource_being_assigned ( resource_type  type)
inlineinherited

Used internally to check order of method calls.

Definition at line 442 of file node.h.

442  {
443  m_resourceBeingAssigned = type;
444  }

◆ set_resource_fraction()

void tpie::pipelining::node::set_resource_fraction ( resource_type  type,
double  f 
)
inherited

Set the resource priority of this node.

Resources are distributed proportionally to the priorities of the nodes in the given phase.

◆ set_state()

void tpie::pipelining::node::set_state ( STATE  s)
inlineinherited

Used internally to check order of method calls.

Definition at line 428 of file node.h.

428  {
429  m_state = s;
430  }

◆ set_steps()

void tpie::pipelining::node::set_steps ( stream_size_type  steps)
inherited

Called by implementers that intend to call step().

Parameters
stepsThe number of times step() is called at most.

Referenced by tpie::pipelining::bits::ami_input_t< dest_t >::propagate(), tpie::pipelining::bits::input_vector_t< dest_t, T, A >::propagate(), tpie::pipelining::bits::buffer_pull_output_t< T >::propagate(), tpie::pipelining::serialization_bits::input_t< dest_t >::propagate(), tpie::pipelining::bits::range_t< dest_t >::propagate(), tpie::pipelining::bits::sort_output_base< push_type< dest_t >::type, pred_t, store_t >::propagate(), tpie::pipelining::bits::input_t< dest_t >::propagate(), tpie::pipelining::bits::ami_input_stack_t< dest_t >::propagate(), tpie::pipelining::serialization_bits::sort_output_base< Traits >::propagate(), tpie::pipelining::bits::ami_pull_input_stack_t< T >::propagate(), tpie::pipelining::bits::named_input_t< dest_t >::propagate(), tpie::pipelining::bits::reverser_output_t< dest_t >::propagate(), tpie::pipelining::bits::buffer_output_t< dest_t >::propagate(), tpie::pipelining::bits::pull_input_t< T >::propagate(), tpie::pipelining::bits::internal_reverser_output_t< dest_t >::propagate(), tpie::pipelining::bits::pull_reverse_input_t< T >::propagate(), tpie::pipelining::serialization_bits::reverser_output_t< dest_t >::propagate(), tpie::pipelining::bits::named_pull_input_t< T >::propagate(), tpie::pipelining::serialization_bits::reverser_pull_output_t< T >::propagate(), tpie::pipelining::serialization_bits::buffer_output_t< dest_t >::propagate(), tpie::pipelining::serialization_bits::buffer_pull_output_t< T >::propagate(), and tpie::pipelining::bits::pull_source_t< dest_t, fact_t >::propagate().

◆ step()


The documentation for this class was generated from the following file:
tpie::pipelining::node::forward_any
void forward_any(std::string key, any_noncopyable value, memory_size_type k=std::numeric_limits< memory_size_type >::max())
See node::forward.
tpie::pipelining::node::get_minimum_resource_usage
memory_size_type get_minimum_resource_usage(resource_type type) const
Get the minimum amount of the resource declared by this node.
Definition: node.h:115
tpie::pipelining::node::fetch_maybe
maybeany_t fetch_maybe(std::string key)
Fetch piece of auxiliary data as any_noncopyable (the internal representation) wrapped in a boost::op...
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::pipelining::node::get_available_of_resource
memory_size_type get_available_of_resource(resource_type type) const
Get the amount of the specific resource assigned to this node.
Definition: node.h:137
tpie::memory_bucket_ref
Class storring a reference to a memory bucket.
Definition: memory.h:334
tpie::exception
Definition: exception.h:33
tpie::pipelining::node::set_maximum_resource_usage
void set_maximum_resource_usage(resource_type type, memory_size_type usage)
Called by implementers to declare maximum resource requirements.
tpie::unused
void unused(const T &x)
Declare that a variable is unused on purpose.
Definition: util.h:42
tpie::log_warning
logstream & log_warning()
Return logstream for writing warning log messages.
Definition: tpie_log.h:158
tpie::pipelining::node::get_resource_fraction
double get_resource_fraction(resource_type type) const
Get the priority for the specific resource of this node.
Definition: node.h:130
tpie::progress_indicator_base::step
void step(stream_size_type step=1)
Record an increment to the indicator and advance the indicator.
Definition: progress_indicator_base.h:91
tpie::pipelining::node::fetch_any
any_noncopyable & fetch_any(std::string key)
Fetch piece of auxiliary data as any_noncopyable (the internal representation).
tpie::pipelining::node::get_maximum_resource_usage
memory_size_type get_maximum_resource_usage(resource_type type) const
Get the maximum amount of the resource declared by this node.
Definition: node.h:123
tpie::pipelining::node::set_minimum_resource_usage
void set_minimum_resource_usage(resource_type type, memory_size_type usage)
Called by implementers to declare minimum resource requirements.
tpie::pipelining::node::set_resource_fraction
void set_resource_fraction(resource_type type, double f)
Set the resource priority of this node.
tpie::pipelining::node::bucket
std::unique_ptr< memory_bucket > & bucket(size_t i)
Access a memory bucket.
Definition: node.h:778
tpie::pipelining::node::get_state
STATE get_state() const
Used internally to check order of method calls.
Definition: node.h:421