internal::node_cache< T, M > Class Template Reference

A node_cache maintains a std::queue of elements of type T. Each operation is protected by a lock. More...

`#include <_flow_graph_cache_impl.h>`

Inheritance diagram for internal::node_cache< T, M >:
Collaboration diagram for internal::node_cache< T, M >:

## Public Types

typedef size_t | size_type

## Public Member Functions

bool | empty ()
void | add (T &n)
void | remove (T &n)
void | clear ()

## Protected Types

typedef M | mutex_type

## Protected Member Functions

bool | internal_empty ()
size_type | internal_size ()
void | internal_push (T &n)
T & | internal_pop ()

## Protected Attributes

mutex_type | my_mutex
std::queue< T * > | my_q

## Detailed Description

### template<typename T, typename M = spin_mutex>
class internal::node_cache< T, M >

A node_cache maintains a std::queue of elements of type T. Each operation is protected by a lock.

Definition at line 30 of file _flow_graph_cache_impl.h.

## Member Typedef Documentation

## mutex_type

template<typename T, typename M = spin_mutex>

typedef M internal::node_cache< T, M >::mutex_type

protected

Definition at line 89 of file _flow_graph_cache_impl.h.

## size_type

template<typename T, typename M = spin_mutex>

typedef size_t internal::node_cache< T, M >::size_type

Definition at line 33 of file _flow_graph_cache_impl.h.

## Member Function Documentation

## add()

template<typename T, typename M = spin_mutex>

void internal::node_cache< T, M >::add | ( | T & | n | ) |

inline

Definition at line 40 of file _flow_graph_cache_impl.h.

{
typename mutex_type::scoped_lock lock( my_mutex );
internal_push(n);
}

Referenced by internal::reserving_port< T >::handle_operations(), and internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::handle_operations().

Here is the caller graph for this function:

## clear()

template<typename T, typename M = spin_mutex>

void internal::node_cache< T, M >::clear | ( |  | ) |

inline

Definition at line 54 of file _flow_graph_cache_impl.h.

{
while( !my_q.empty()) (void)my_q.pop();
#if TBB_DEPRECATED_FLOW_NODE_EXTRACTION
my_built_predecessors.clear();
#endif
}

Referenced by tbb::flow::interface11::function_node< Input, Output, Policy, Allocator >::reset_node(), and internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::reset_receiver().

Here is the caller graph for this function:

## empty()

template<typename T, typename M = spin_mutex>

bool internal::node_cache< T, M >::empty | ( |  | ) |

inline

Definition at line 35 of file _flow_graph_cache_impl.h.

{
typename mutex_type::scoped_lock lock( my_mutex );
return internal_empty();
}

Referenced by internal::reserving_port< T >::handle_operations(), tbb::flow::interface11::function_node< Input, Output, Policy, Allocator >::reset_node(), internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::reset_receiver(), and internal::reserving_port< T >::reset_receiver().

Here is the caller graph for this function:

## internal_empty()

template<typename T, typename M = spin_mutex>

bool internal::node_cache< T, M >::internal_empty | ( |  | ) |

inline protected

Definition at line 97 of file _flow_graph_cache_impl.h.

{
return my_q.empty();
}

Referenced by internal::node_cache< sender< T >, M >::empty().

Here is the caller graph for this function:

## internal_pop()

template<typename T, typename M = spin_mutex>

T& internal::node_cache< T, M >::internal_pop | ( |  | ) |

inline protected

Definition at line 112 of file _flow_graph_cache_impl.h.

{
T *v = my_q.front();
my_q.pop();
return *v;
}

Referenced by internal::node_cache< sender< T >, M >::remove().

Here is the caller graph for this function:

## internal_push()

template<typename T, typename M = spin_mutex>

void internal::node_cache< T, M >::internal_push | ( | T & | n | ) |

inline protected

Definition at line 107 of file _flow_graph_cache_impl.h.

{
my_q.push(&n);
}

Referenced by internal::node_cache< sender< T >, M >::add(), and internal::node_cache< sender< T >, M >::remove().

Here is the caller graph for this function:

## internal_size()

template<typename T, typename M = spin_mutex>

size_type internal::node_cache< T, M >::internal_size | ( |  | ) |

inline protected

Definition at line 102 of file _flow_graph_cache_impl.h.

{
return my_q.size();
}

Referenced by internal::node_cache< sender< T >, M >::remove().

Here is the caller graph for this function:

## remove()

template<typename T, typename M = spin_mutex>

void internal::node_cache< T, M >::remove | ( | T & | n | ) |

inline

Definition at line 45 of file _flow_graph_cache_impl.h.

{
typename mutex_type::scoped_lock lock( my_mutex );
for ( size_t i = internal_size(); i != 0; --i ) {
T &s = internal_pop();
if ( &s == &n ) return; // only remove one predecessor per request
internal_push(s);
}
}

Referenced by internal::reserving_port< T >::handle_operations(), and internal::function_input_base< Input, Policy, Allocator, multifunction_input< Input, internal::wrap_tuple_elements< tbb::flow::tuple_size< Output >::value, internal::multifunction_output, Output >::type, Policy, Allocator > >::handle_operations().

Here is the caller graph for this function:

## Member Data Documentation

## my_mutex

template<typename T, typename M = spin_mutex>

mutex_type internal::node_cache< T, M >::my_mutex

protected

Definition at line 90 of file _flow_graph_cache_impl.h.

Referenced by internal::node_cache< sender< T >, M >::add(), internal::node_cache< sender< T >, M >::empty(), and internal::node_cache< sender< T >, M >::remove().

## my_q

template<typename T, typename M = spin_mutex>

std::queue< T * > internal::node_cache< T, M >::my_q

protected

Definition at line 91 of file _flow_graph_cache_impl.h.

Referenced by internal::node_cache< sender< T >, M >::clear(), internal::node_cache< sender< T >, M >::internal_empty(), internal::node_cache< sender< T >, M >::internal_pop(), internal::node_cache< sender< T >, M >::internal_push(), and internal::node_cache< sender< T >, M >::internal_size().

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

- _flow_graph_cache_impl.h

internal::node_cache::my_q
std::queue< T * > my_q
Definition: _flow_graph_cache_impl.h:91
internal::node_cache::internal_size
size_type internal_size()
Definition: _flow_graph_cache_impl.h:102
internal::node_cache::internal_empty
bool internal_empty()
Definition: _flow_graph_cache_impl.h:97
internal::node_cache::internal_pop
T & internal_pop()
Definition: _flow_graph_cache_impl.h:112
internal::node_cache::my_mutex
mutex_type my_mutex
Definition: _flow_graph_cache_impl.h:90
lock
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void * lock
Definition: ittnotify_static.h:121
s
void const char const char int ITT_FORMAT __itt_group_sync s
Definition: ittnotify_static.h:91
internal::node_cache::internal_push
void internal_push(T &n)
Definition: _flow_graph_cache_impl.h:107

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.