DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::iomanager::Queue< T > Class Template Referenceabstract

Implementations of the Queue class are responsible for relaying data between DAQModules within a DAQ Application. More...

#include <Queue.hpp>

Inheritance diagram for dunedaq::iomanager::Queue< T >:
[legend]
Collaboration diagram for dunedaq::iomanager::Queue< T >:
[legend]

Public Types

using value_t = T
 Type stored in the Queue.
 
using duration_t = std::chrono::milliseconds
 Base duration type for timeouts.
 
- Public Types inherited from dunedaq::opmonlib::MonitorableObject
using NodePtr = std::weak_ptr<MonitorableObject>
 
using NewNodePtr = std::shared_ptr<MonitorableObject>
 
using ElementId = std::string
 

Public Member Functions

 Queue (const std::string &name)
 Queue Constructor.
 
virtual bool can_push () const
 Determine whether the Queue may be pushed onto.
 
virtual bool can_pop () const
 Determine whether the Queue may be popped from.
 
virtual void push (value_t &&val, const duration_t &timeout)=0
 Push a value onto the Queue.
 
virtual void pop (value_t &val, const duration_t &timeout)=0
 Pop the first value off of the queue.
 
virtual bool try_push (value_t &&val, const duration_t &timeout)=0
 
virtual bool try_pop (value_t &val, const duration_t &timeout)=0
 
- Public Member Functions inherited from dunedaq::iomanager::QueueBase
 QueueBase (const std::string &name)
 QueueBase Constructor.
 
virtual size_t get_capacity () const =0
 Get the capacity (max size) of the queue.
 
virtual size_t get_num_elements () const =0
 
- Public Member Functions inherited from dunedaq::utilities::NamedObject
 NamedObject (const std::string &name)
 NamedObject Constructor.
 
 NamedObject (NamedObject const &)=delete
 NamedObject is not copy-constructible.
 
 NamedObject (NamedObject &&)=default
 NamedObject is move-constructible.
 
NamedObjectoperator= (NamedObject const &)=delete
 NamedObject is not copy-assignable.
 
NamedObjectoperator= (NamedObject &&)=default
 NamedObject is move-assignable.
 
virtual ~NamedObject ()=default
 Default virtual destructor.
 
const std::string & get_name () const final
 Get the name of this NamedObejct.
 
- Public Member Functions inherited from dunedaq::utilities::Named
 Named ()=default
 Named Constructor.
 
 Named (Named const &)=delete
 Named is not copy-constructible.
 
 Named (Named &&)=default
 Named is move-constructible.
 
Namedoperator= (Named const &)=delete
 Named is not copy-assignable.
 
Namedoperator= (Named &&)=default
 Named is move-assignable.
 
virtual ~Named ()=default
 Default virtual destructor.
 
- Public Member Functions inherited from dunedaq::opmonlib::MonitorableObject
 MonitorableObject (const MonitorableObject &)=delete
 
MonitorableObjectoperator= (const MonitorableObject &)=delete
 
 MonitorableObject (MonitorableObject &&)=delete
 
MonitorableObjectoperator= (MonitorableObject &&)=delete
 
virtual ~MonitorableObject ()=default
 
auto get_opmon_id () const noexcept
 
auto get_opmon_level () const noexcept
 

Private Member Functions

 Queue (const Queue &)=delete
 
Queueoperator= (const Queue &)=delete
 
 Queue (Queue &&)=default
 
Queueoperator= (Queue &&)=default
 

Additional Inherited Members

- Static Public Member Functions inherited from dunedaq::opmonlib::MonitorableObject
static bool publishable_metric (OpMonLevel entry, OpMonLevel system) noexcept
 
- Protected Member Functions inherited from dunedaq::iomanager::QueueBase
void generate_opmon_data () override
 Method to retrieve information (occupancy) from queues.
 
- Protected Member Functions inherited from dunedaq::opmonlib::MonitorableObject
 MonitorableObject ()=default
 
void register_node (ElementId name, NewNodePtr)
 
void publish (google::protobuf::Message &&, CustomOrigin &&co={}, OpMonLevel l=to_level(EntryOpMonLevel::kDefault)) const noexcept
 

Detailed Description

template<class T>
class dunedaq::iomanager::Queue< T >

Implementations of the Queue class are responsible for relaying data between DAQModules within a DAQ Application.

Note that while the Queue class itself is not templated on a data type (so it can be included in generic containers), all implementations should be.

Definition at line 39 of file Queue.hpp.

Member Typedef Documentation

◆ duration_t

template<class T >
using dunedaq::iomanager::Queue< T >::duration_t = std::chrono::milliseconds

Base duration type for timeouts.

Definition at line 43 of file Queue.hpp.

◆ value_t

template<class T >
using dunedaq::iomanager::Queue< T >::value_t = T

Type stored in the Queue.

Definition at line 42 of file Queue.hpp.

Constructor & Destructor Documentation

◆ Queue() [1/3]

template<class T >
dunedaq::iomanager::Queue< T >::Queue ( const std::string & name)
inlineexplicit

Queue Constructor.

Parameters
nameName of the Queue instance

Definition at line 49 of file Queue.hpp.

50 : QueueBase(name)
51 {}
QueueBase(const std::string &name)
QueueBase Constructor.
Definition QueueBase.hpp:45

◆ Queue() [2/3]

template<class T >
dunedaq::iomanager::Queue< T >::Queue ( const Queue< T > & )
privatedelete

◆ Queue() [3/3]

template<class T >
dunedaq::iomanager::Queue< T >::Queue ( Queue< T > && )
privatedefault

Member Function Documentation

◆ can_pop()

template<class T >
virtual bool dunedaq::iomanager::Queue< T >::can_pop ( ) const
inlinevirtual

Determine whether the Queue may be popped from.

Returns
True if the queue is not empty, false if it is

Reimplemented in dunedaq::iomanager::FollyQueue< T, FollyQueueType >, and dunedaq::iomanager::StdDeQueue< T >.

Definition at line 65 of file Queue.hpp.

65{ return this->get_num_elements() > 0; }
virtual size_t get_num_elements() const =0

◆ can_push()

template<class T >
virtual bool dunedaq::iomanager::Queue< T >::can_push ( ) const
inlinevirtual

Determine whether the Queue may be pushed onto.

Returns
True if the queue is not full, false if it is

Reimplemented in dunedaq::iomanager::FollyQueue< T, FollyQueueType >, and dunedaq::iomanager::StdDeQueue< T >.

Definition at line 58 of file Queue.hpp.

58{ return this->get_num_elements() < this->get_capacity(); }
virtual size_t get_capacity() const =0
Get the capacity (max size) of the queue.

◆ operator=() [1/2]

template<class T >
Queue & dunedaq::iomanager::Queue< T >::operator= ( const Queue< T > & )
privatedelete

◆ operator=() [2/2]

template<class T >
Queue & dunedaq::iomanager::Queue< T >::operator= ( Queue< T > && )
privatedefault

◆ pop()

template<class T >
virtual void dunedaq::iomanager::Queue< T >::pop ( value_t & val,
const duration_t & timeout )
pure virtual

Pop the first value off of the queue.

Parameters
valReference to the value that is popped from the queue
timeoutTimeout for the pop operation

This is a pure virtual function If pop takes longer than the timeout, implementations should throw an exception

Implemented in dunedaq::iomanager::FollyQueue< T, FollyQueueType >, and dunedaq::iomanager::StdDeQueue< T >.

◆ push()

template<class T >
virtual void dunedaq::iomanager::Queue< T >::push ( value_t && val,
const duration_t & timeout )
pure virtual

Push a value onto the Queue.

Parameters
valValue to push (rvalue)
timeoutTimeout for the push operation.

This is a pure virtual function. If push takes longer than the timeout, implementations should throw an exception.

Implemented in dunedaq::iomanager::FollyQueue< T, FollyQueueType >, and dunedaq::iomanager::StdDeQueue< T >.

◆ try_pop()

template<class T >
virtual bool dunedaq::iomanager::Queue< T >::try_pop ( value_t & val,
const duration_t & timeout )
pure virtual

◆ try_push()

template<class T >
virtual bool dunedaq::iomanager::Queue< T >::try_push ( value_t && val,
const duration_t & timeout )
pure virtual

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