Public Types | Public Member Functions | Private Attributes | List of all members
WireCell::Fanout< Data, Address > Class Template Reference

#include <Faninout.h>

Public Types

typedef Data result_type
 
typedef Address address_type
 
typedef std::deque< result_typedata_queue
 
typedef std::map< int, data_queuequeue_map
 
typedef boost::signals2::signal< result_type()> signal
 
typedef signal::slot_type slot
 

Public Member Functions

void connect (const slot &s)
 
void address (const address_type &addr)
 Register an address. More...
 
result_type operator() (const address_type &addr)
 

Private Attributes

signal m_signal
 
queue_map m_fan
 

Detailed Description

template<typename Data, typename Address = int>
class WireCell::Fanout< Data, Address >

A fanout which takes in Data from a connected slot and buffers it into set of addressable queues.

Definition at line 14 of file Faninout.h.

Member Typedef Documentation

template<typename Data, typename Address = int>
typedef Address WireCell::Fanout< Data, Address >::address_type

Definition at line 18 of file Faninout.h.

template<typename Data, typename Address = int>
typedef std::deque<result_type> WireCell::Fanout< Data, Address >::data_queue

Definition at line 19 of file Faninout.h.

template<typename Data, typename Address = int>
typedef std::map< int, data_queue > WireCell::Fanout< Data, Address >::queue_map

Definition at line 20 of file Faninout.h.

template<typename Data, typename Address = int>
typedef Data WireCell::Fanout< Data, Address >::result_type

Definition at line 17 of file Faninout.h.

template<typename Data, typename Address = int>
typedef boost::signals2::signal<result_type ()> WireCell::Fanout< Data, Address >::signal

Definition at line 23 of file Faninout.h.

template<typename Data, typename Address = int>
typedef signal::slot_type WireCell::Fanout< Data, Address >::slot

Definition at line 25 of file Faninout.h.

Member Function Documentation

template<typename Data, typename Address = int>
void WireCell::Fanout< Data, Address >::address ( const address_type addr)
inline

Register an address.

Definition at line 31 of file Faninout.h.

31  {
32  m_fan[addr] = data_queue();
33  }
std::deque< result_type > data_queue
Definition: Faninout.h:19
constexpr std::enable_if_t< are_cv_compatible< TO, FROM >::value, std::add_pointer_t< std::remove_pointer_t< TO > > > addr(FROM &from)
Definition: ensurePointer.h:35
queue_map m_fan
Definition: Faninout.h:53
template<typename Data, typename Address = int>
void WireCell::Fanout< Data, Address >::connect ( const slot s)
inline

Definition at line 28 of file Faninout.h.

28 { m_signal.connect(s); }
signal m_signal
Definition: Faninout.h:52
static QCString * s
Definition: config.cpp:1042
template<typename Data, typename Address = int>
result_type WireCell::Fanout< Data, Address >::operator() ( const address_type addr)
inline

Return a data from the given address. If the address has not yet been registered it will be but any previously returned data will not be seen.

Definition at line 38 of file Faninout.h.

38  {
39  data_queue& dq = m_fan[addr];
40  if (!dq.size()) {
42  for (auto it = m_fan.begin(); it != m_fan.end(); ++it) {
43  it->second.push_back(dat);
44  }
45  }
46  result_type dat = dq.front();
47  dq.pop_front();
48  return dat;
49  }
std::deque< result_type > data_queue
Definition: Faninout.h:19
signal m_signal
Definition: Faninout.h:52
constexpr std::enable_if_t< are_cv_compatible< TO, FROM >::value, std::add_pointer_t< std::remove_pointer_t< TO > > > addr(FROM &from)
Definition: ensurePointer.h:35
Data result_type
Definition: Faninout.h:17
queue_map m_fan
Definition: Faninout.h:53

Member Data Documentation

template<typename Data, typename Address = int>
queue_map WireCell::Fanout< Data, Address >::m_fan
private

Definition at line 53 of file Faninout.h.

template<typename Data, typename Address = int>
signal WireCell::Fanout< Data, Address >::m_signal
private

Definition at line 52 of file Faninout.h.


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