VISR  0.11.8
Versatile Interactive Scene Renderer
visr::pml::MessageQueueProtocol Class Reference

#include <message_queue_protocol.hpp>

Inheritance diagram for visr::pml::MessageQueueProtocol:
visr::CommunicationProtocolBase

Classes

class  Input
 
class  InputBase
 
class  Output
 
class  OutputBase
 

Public Member Functions

 MessageQueueProtocol (ParameterType const &parameterType, ParameterConfigBase const &config)
 
virtual ~MessageQueueProtocol () override
 
ParameterType parameterType () const override
 
virtual CommunicationProtocolType protocolType () const override
 
void clear ()
 
bool empty () const
 
std::size_t numberOfElements () const
 
void enqueue (std::unique_ptr< ParameterBase > &val)
 
ParameterBase const & nextElement () const
 
void popNextElement ()
 
void connectInput (CommunicationProtocolBase::Input *port) override
 
void connectOutput (CommunicationProtocolBase::Output *port) override
 
bool disconnectInput (CommunicationProtocolBase::Input *port) noexceptoverride
 
bool disconnectOutput (CommunicationProtocolBase::Output *port) noexceptoverride
 
- Public Member Functions inherited from visr::CommunicationProtocolBase
 CommunicationProtocolBase ()
 
virtual ~CommunicationProtocolBase ()
 

Static Public Member Functions

static constexpr CommunicationProtocolType staticType ()
 
static constexpr const char * staticName ()
 

Detailed Description

A FIFO-type message queue template class for storing and passing message data.

Note
This class does provide the same level of thread safety as, e.g., the STL. I.e., calling code from different thread must ensure that concurrent accesses to the same instances are appropriately secured against race conditions.

Constructor & Destructor Documentation

visr::pml::MessageQueueProtocol::MessageQueueProtocol ( ParameterType const &  parameterType,
ParameterConfigBase const &  config 
)
explicit
visr::pml::MessageQueueProtocol::~MessageQueueProtocol ( )
overridevirtualdefault

Member Function Documentation

void visr::pml::MessageQueueProtocol::clear ( )

Remove all elements from the message queue.

void visr::pml::MessageQueueProtocol::connectInput ( CommunicationProtocolBase::Input port)
overridevirtual

Connect a protocol input to this protocol. Derived protocol types must override this pure virtual interface.

Parameters
portAn parameter input with compatible protocol and parameter types.
Exceptions
std::exceptionIf the protocol or parameter types do not match.
std::exceptionIf the connection would violate the "arity" of the protocol, i.e., attempting multiple inputs in case of a 1:1 or 1:N protocol.

Implements visr::CommunicationProtocolBase.

void visr::pml::MessageQueueProtocol::connectOutput ( CommunicationProtocolBase::Output port)
overridevirtual

Connect a protocol output to this protocol. Derived protocol types must override this pure virtual interface.

Parameters
portAn parameter output with compatible protocol and parameter types.
Exceptions
std::exceptionIf the protocol or parameter types do not match.
std::exceptionIf the connection would violate the "arity" of the protocol, i.e., attempting multiple outputs in case of a 1:1 or N:1 protocol.

Implements visr::CommunicationProtocolBase.

bool visr::pml::MessageQueueProtocol::disconnectInput ( CommunicationProtocolBase::Input port)
overridevirtualnoexcept

Disconnect a protocol input from this protocol.

Returns
true if the disconnect was successful, i.e., if the protocol port was actually connected, false otherwise.

Implements visr::CommunicationProtocolBase.

bool visr::pml::MessageQueueProtocol::disconnectOutput ( CommunicationProtocolBase::Output port)
overridevirtualnoexcept

Disconnect a protocol output from this protocol.

Returns
true if the disconnect was successful, i.e., if the protocol port was actually connected, false otherwise.

Implements visr::CommunicationProtocolBase.

bool visr::pml::MessageQueueProtocol::empty ( ) const

Return whether the list is empty, i.e., contains zero elements.

void visr::pml::MessageQueueProtocol::enqueue ( std::unique_ptr< ParameterBase > &  val)
ParameterBase const & visr::pml::MessageQueueProtocol::nextElement ( ) const
std::size_t visr::pml::MessageQueueProtocol::numberOfElements ( ) const

Return the number of elements currently contained in the list.

ParameterType visr::pml::MessageQueueProtocol::parameterType ( ) const
overridevirtual

Return the configured parameter type of this protocol instance. Derived protocols are requirted to override this method.

Implements visr::CommunicationProtocolBase.

void visr::pml::MessageQueueProtocol::popNextElement ( )

Remove the next output element from the list.

Exceptions
std::logic_errorIf the queue is empty prior to this call.
CommunicationProtocolType visr::pml::MessageQueueProtocol::protocolType ( ) const
overridevirtual

Return the protocol type (a numerical id) of the concrete derived protocol object. Derived protocol types are required to override this method.

Implements visr::CommunicationProtocolBase.

static constexpr const char* visr::pml::MessageQueueProtocol::staticName ( )
inlinestatic
static constexpr CommunicationProtocolType visr::pml::MessageQueueProtocol::staticType ( )
inlinestatic

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