DUDS
Distributed Update of Data from Something
duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs > Class Template Reference

Queues mesurement signals for later processing. More...

#include <MeasurementSignalQueue.hpp>

Inheritance diagram for duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >:
Collaboration diagram for duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >:

Classes

struct  SignalData
 Stores the information from a new or old measurement signal. More...
 

Public Types

typedef std::list< SignalDataEventList
 The list type used to store information from incoming signals. More...
 
enum  EventType { NewMeasurement, OldMeasurement }
 
typedef GenericInstrument< SVT, SQT, TVT, TQT > Instrument
 
typedef duds::data::GenericMeasurement< SVT, SQT, TVT, TQT > Measurement
 
- Public Types inherited from duds::hardware::GenericMeasurementSignalSink< SVT, SQT, TVT, TQT >
typedef GenericInstrument< SVT, SQT, TVT, TQT > Instrument
 
typedef duds::data::GenericMeasurement< SVT, SQT, TVT, TQT > Measurement
 
typedef boost::signals2::signal< void(const std::shared_ptr< Instrument > &, const std::shared_ptr< const Measurement > &) > MesurementSignal
 The type used for event listeners that are told of measurments. More...
 

Public Member Functions

 GenericMeasurementSignalQueue ()=default
 
 GenericMeasurementSignalQueue (const GenericMeasurementSignalQueue &sq)
 
 GenericMeasurementSignalQueue (GenericMeasurementSignalQueue &&sq)
 
void clear ()
 Clear the signal data stored internally. More...
 
EventList copy () const
 Returns a copy of the signal events stored internally. More...
 
void copy (EventList &copy) const
 Creates a copy of the ignal events stored internally. More...
 
EventList move ()
 Returns a move-constructed list of the signal events stored internally. More...
 
void move (EventList &copy)
 Move-assigns to a given list the signal events stored internally. More...
 
GenericMeasurementSignalQueueoperator= (const GenericMeasurementSignalQueue &sq)
 
GenericMeasurementSignalQueueoperator= (GenericMeasurementSignalQueue &&sq)
 
SignalData popBack ()
 Pop signal data from the end (newest side) of the internal list and return that data. More...
 
SignalData popFront ()
 Pop signal data from the front (oldest side) of the internal list and return that data. More...
 
void pushBack (const SignalData &sd)
 Push signal data onto the end (newest side) of the internal list. More...
 
void pushFront (const SignalData &sd)
 Push signal data onto the front (oldest side) of the internal list. More...
 
void swap (GenericMeasurementSignalQueue &sq)
 Swaps the internal signal data list with another GenericMeasurementSignalQueue object. More...
 
- Public Member Functions inherited from duds::hardware::GenericMeasurementSignalSink< SVT, SQT, TVT, TQT >
virtual ~GenericMeasurementSignalSink ()
 Disconnects from all signals. More...
 
bool disconnectAll (const InstrumentSptr &inst)
 Disconnects the group from both the new and old measurement signals from the given instrument. More...
 
void disconnectAll ()
 Disconnects the group from all signals. More...
 
bool disconnectNewMeasurement (const InstrumentSptr &inst)
 Disconnects from the new measurement signal of the given instrument. More...
 
bool disconnectOldMeasurement (const InstrumentSptr &inst)
 Disconnects from the old measurement signal of the given instrument. More...
 
boost::signals2::connection newMeasurementSource (const InstrumentSptr &inst, boost::signals2::connect_position at=boost::signals2::at_back)
 Connect this object to the new measurement signal of the given instrument, or return the existing connection. More...
 
boost::signals2::connection newMeasurementSource (const typename MesurementSignal::group_type &group, const Instrument &inst, boost::signals2::connect_position at=boost::signals2::at_back)
 
boost::signals2::connection oldMeasurementSource (const InstrumentSptr &inst, boost::signals2::connect_position at=boost::signals2::at_back)
 
boost::signals2::connection oldMeasurementSource (const typename MesurementSignal::group_type &group, const Instrument &inst, boost::signals2::connect_position at=boost::signals2::at_back)
 
void purgeDisconnections ()
 Removes any disconnected connection objects held by this object. More...
 

Protected Member Functions

void handleNewMeasure (const std::shared_ptr< Instrument > &i, const std::shared_ptr< const Measurement > &m)
 Receives a new measurement signal and queues its information. More...
 
void handleOldMeasure (const std::shared_ptr< Instrument > &i, const std::shared_ptr< const Measurement > &m)
 Receives an old measurement signal and queues its information. More...
 

Private Attributes

duds::general::Spinlock block
 Used to allow only one thread access to events. More...
 
EventList events
 Storage of signal data. More...
 

Additional Inherited Members

- Protected Types inherited from duds::hardware::GenericMeasurementSignalSink< SVT, SQT, TVT, TQT >
typedef std::map< Instrument *, MeasurementConnectionsConnectionMap
 Reduce typing and limit line length; no other reason. More...
 
typedef ConnectionMap ConnectionMapIterator
 
- Protected Attributes inherited from duds::hardware::GenericMeasurementSignalSink< SVT, SQT, TVT, TQT >
ConnectionMap conns
 Stores connections keyed by Instrument pointer. More...
 

Detailed Description

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
class duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >

Queues mesurement signals for later processing.

The queue is thread-safe to allow queueing and dequeueing from multiple threads. It can be used to store signals from many threads and later process the signals on one thread. The advantages of such a setup are less thread synchronization and avoiding taking up time on the thread that sent the signal. The disadvantage is a greater latency to responding to the signal when ignoring the time taken to handle a signal.

Todo:
Could make a derived class that can resend the signals using GenericMeasurementSignalSource.
Template Parameters
SVTSample value type
SQTSample quality type
TVTTime value type
TQTTime quality type
ISThe Instrument storage type. Should be either std::shared_ptr or std::weak_ptr. This will affect the lifespan of the Instrument objects.
ISArgsAdditional template parameters to IS other than the data type being stored. In most cases, this can be ommitted.
Author
Jeff Jackowski

Definition at line 48 of file MeasurementSignalQueue.hpp.

Member Typedef Documentation

◆ EventList

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
typedef std::list<SignalData> duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::EventList

The list type used to store information from incoming signals.

Definition at line 84 of file MeasurementSignalQueue.hpp.

◆ Instrument

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
typedef GenericInstrument<SVT, SQT, TVT, TQT> duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::Instrument

Definition at line 52 of file MeasurementSignalQueue.hpp.

◆ Measurement

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
typedef duds::data::GenericMeasurement<SVT, SQT, TVT, TQT> duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::Measurement

Definition at line 53 of file MeasurementSignalQueue.hpp.

Member Enumeration Documentation

◆ EventType

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
enum duds::hardware::GenericMeasurementSignalQueue::EventType
Enumerator
NewMeasurement 
OldMeasurement 

Definition at line 54 of file MeasurementSignalQueue.hpp.

Constructor & Destructor Documentation

◆ GenericMeasurementSignalQueue() [1/3]

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::GenericMeasurementSignalQueue ( )
default

◆ GenericMeasurementSignalQueue() [2/3]

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::GenericMeasurementSignalQueue ( const GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs > &  sq)
inline

Definition at line 118 of file MeasurementSignalQueue.hpp.

◆ GenericMeasurementSignalQueue() [3/3]

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::GenericMeasurementSignalQueue ( GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs > &&  sq)
inline

Definition at line 122 of file MeasurementSignalQueue.hpp.

Member Function Documentation

◆ clear()

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
void duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::clear ( )
inline

Clear the signal data stored internally.

Definition at line 236 of file MeasurementSignalQueue.hpp.

◆ copy() [1/2]

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
EventList duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::copy ( ) const
inline

Returns a copy of the signal events stored internally.

Definition at line 155 of file MeasurementSignalQueue.hpp.

Referenced by duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::move().

◆ copy() [2/2]

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
void duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::copy ( EventList copy) const
inline

Creates a copy of the ignal events stored internally.

Parameters
copyThe list that will hold a copy of the internal list.

Definition at line 167 of file MeasurementSignalQueue.hpp.

◆ handleNewMeasure()

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
void duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::handleNewMeasure ( const std::shared_ptr< Instrument > &  i,
const std::shared_ptr< const Measurement > &  m 
)
inlineprotectedvirtual

Receives a new measurement signal and queues its information.

Implements duds::hardware::GenericMeasurementSignalSink< SVT, SQT, TVT, TQT >.

Definition at line 99 of file MeasurementSignalQueue.hpp.

◆ handleOldMeasure()

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
void duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::handleOldMeasure ( const std::shared_ptr< Instrument > &  i,
const std::shared_ptr< const Measurement > &  m 
)
inlineprotectedvirtual

Receives an old measurement signal and queues its information.

Implements duds::hardware::GenericMeasurementSignalSink< SVT, SQT, TVT, TQT >.

Definition at line 109 of file MeasurementSignalQueue.hpp.

◆ move() [1/2]

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
EventList duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::move ( )
inline

Returns a move-constructed list of the signal events stored internally.

Postcondition
No signal events are stored; events is empty.

Definition at line 175 of file MeasurementSignalQueue.hpp.

◆ move() [2/2]

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
void duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::move ( EventList copy)
inline

Move-assigns to a given list the signal events stored internally.

Postcondition
No signal events are stored; events is empty.

Definition at line 187 of file MeasurementSignalQueue.hpp.

◆ operator=() [1/2]

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
GenericMeasurementSignalQueue& duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::operator= ( const GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs > &  sq)
inline

Definition at line 126 of file MeasurementSignalQueue.hpp.

◆ operator=() [2/2]

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
GenericMeasurementSignalQueue& duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::operator= ( GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs > &&  sq)
inline

Definition at line 134 of file MeasurementSignalQueue.hpp.

◆ popBack()

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
SignalData duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::popBack ( )
inline

Pop signal data from the end (newest side) of the internal list and return that data.

Definition at line 211 of file MeasurementSignalQueue.hpp.

◆ popFront()

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
SignalData duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::popFront ( )
inline

Pop signal data from the front (oldest side) of the internal list and return that data.

Definition at line 224 of file MeasurementSignalQueue.hpp.

◆ pushBack()

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
void duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::pushBack ( const SignalData sd)
inline

Push signal data onto the end (newest side) of the internal list.

Parameters
sdThe information to push.

Definition at line 195 of file MeasurementSignalQueue.hpp.

◆ pushFront()

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
void duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::pushFront ( const SignalData sd)
inline

Push signal data onto the front (oldest side) of the internal list.

Parameters
sdThe information to push.

Definition at line 203 of file MeasurementSignalQueue.hpp.

◆ swap()

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
void duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::swap ( GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs > &  sq)
inline

Swaps the internal signal data list with another GenericMeasurementSignalQueue object.

Definition at line 146 of file MeasurementSignalQueue.hpp.

Referenced by duds::hardware::swap().

Member Data Documentation

◆ block

template<class SVT, class SQT, class TVT, class TQT, template< typename, typename ... > class IS = std::shared_ptr, typename... ISArgs>
duds::general::Spinlock duds::hardware::GenericMeasurementSignalQueue< SVT, SQT, TVT, TQT, IS, ISArgs >::block
mutableprivate

◆ events


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