VISR  0.11.1
Versatile Interactive Scene Renderer
visr::pml::DoubleBufferingProtocol Class Reference

#include <double_buffering_protocol.hpp>

Inheritance diagram for visr::pml::DoubleBufferingProtocol:
visr::CommunicationProtocolBase

Classes

class  Input
 
class  Output
 

Public Member Functions

 DoubleBufferingProtocol (ParameterType const &parameterType, ParameterConfigBase const &parameterConfig)
 
virtual ~DoubleBufferingProtocol () override
 
ParameterType parameterType () const override
 
virtual CommunicationProtocolType protocolType () const override
 
ParameterBasefrontData ()
 
ParameterBase const & frontData () const
 
ParameterBasebackData ()
 
ParameterBase const & backData () const
 
void swapBuffers (bool copyValue)
 
void connectInput (CommunicationProtocolBase::Input *port) override
 
void connectOutput (CommunicationProtocolBase::Output *port) override
 
bool disconnectInput (CommunicationProtocolBase::Input *port) noexcept override
 
bool disconnectOutput (CommunicationProtocolBase::Output *port) noexcept override
 
 InputBase ()
 
virtual ~InputBase ()
 
ParameterBase const & data () const
 
bool changed () const
 
void resetChanged ()
 
void setProtocolInstance (CommunicationProtocolBase *protocol) override
 
DoubleBufferingProtocolgetProtocol () override
 
DoubleBufferingProtocol const * getProtocol () const override
 
void setProtocolInstance (DoubleBufferingProtocol *protocol)
 
 OutputBase ()
 
virtual ~OutputBase ()
 
ParameterBasedata ()
 
void setProtocolInstance (CommunicationProtocolBase *protocol) override
 
DoubleBufferingProtocolgetProtocol () override
 
DoubleBufferingProtocol const * getProtocol () const override
 
void swapBuffers (bool copyValue=false)
 
void setProtocolInstance (DoubleBufferingProtocol *protocol)
 
- Public Member Functions inherited from visr::CommunicationProtocolBase
 CommunicationProtocolBase ()
 
virtual ~CommunicationProtocolBase ()
 

Static Public Member Functions

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

Friends

class DoubleBufferingProtocol
 

Detailed Description

Communication protocol for double-buffered parameters. Parameters in output (send) ports can be modified, and the change become visible in connected input (receive) ports after a call to swapBuffers(). The protocol supports 1:N connections. (single send port to an arbitray number of outputs).

Constructor & Destructor Documentation

◆ DoubleBufferingProtocol()

visr::pml::DoubleBufferingProtocol::DoubleBufferingProtocol ( ParameterType const &  parameterType,
ParameterConfigBase const &  parameterConfig 
)
explicit

Constructor.

Parameters
parameterTypeThe parameter type that will transmitted through the protocol.
parameterConfigThe configuration of the parameter. The dynamic type must ne compatible with the parameter type.

◆ ~DoubleBufferingProtocol()

visr::pml::DoubleBufferingProtocol::~DoubleBufferingProtocol ( )
overridevirtualdefault

Destructor. The destructor is virtual because the class is intended to be used polymorphically.

◆ ~InputBase()

virtual visr::pml::DoubleBufferingProtocol::~InputBase ( )
virtual

◆ ~OutputBase()

virtual visr::pml::DoubleBufferingProtocol::~OutputBase ( )
virtual

Member Function Documentation

◆ backData() [1/2]

ParameterBase & visr::pml::DoubleBufferingProtocol::backData ( )

Return a reference to the 'back', i.e., receiving end of the connection where parameters are read.

◆ backData() [2/2]

ParameterBase const & visr::pml::DoubleBufferingProtocol::backData ( ) const

Return a reference to the 'back', i.e., receiving end of the connection where parameters are read. Const version.

◆ changed()

bool visr::pml::DoubleBufferingProtocol::changed ( ) const

◆ connectInput()

void visr::pml::DoubleBufferingProtocol::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.

◆ connectOutput()

void visr::pml::DoubleBufferingProtocol::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.

◆ data() [1/2]

ParameterBase const& visr::pml::DoubleBufferingProtocol::data ( ) const

◆ data() [2/2]

ParameterBase& visr::pml::DoubleBufferingProtocol::data ( )

◆ disconnectInput()

bool visr::pml::DoubleBufferingProtocol::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.

◆ disconnectOutput()

bool visr::pml::DoubleBufferingProtocol::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.

◆ frontData() [1/2]

ParameterBase & visr::pml::DoubleBufferingProtocol::frontData ( )

Return a reference to the 'front', i.e., the sending side of the buffer where data is set.

◆ frontData() [2/2]

ParameterBase const & visr::pml::DoubleBufferingProtocol::frontData ( ) const

Return a reference to the 'front', i.e., the sending side of the buffer where data is set. Const version.

◆ getProtocol() [1/4]

DoubleBufferingProtocol* visr::pml::DoubleBufferingProtocol::getProtocol ( )
inlineoverride

◆ getProtocol() [2/4]

DoubleBufferingProtocol const* visr::pml::DoubleBufferingProtocol::getProtocol ( ) const
inlineoverride

◆ getProtocol() [3/4]

DoubleBufferingProtocol* visr::pml::DoubleBufferingProtocol::getProtocol ( )
inlineoverride

◆ getProtocol() [4/4]

DoubleBufferingProtocol const* visr::pml::DoubleBufferingProtocol::getProtocol ( ) const
inlineoverride

◆ InputBase()

visr::pml::DoubleBufferingProtocol::InputBase ( )

◆ OutputBase()

visr::pml::DoubleBufferingProtocol::OutputBase ( )

◆ parameterType()

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

Return the parameter ID for the transmitted parameter type.

Implements visr::CommunicationProtocolBase.

◆ protocolType()

virtual CommunicationProtocolType visr::pml::DoubleBufferingProtocol::protocolType ( ) const
inlineoverridevirtual

Return the actual protocol type. This function is virtual and non-static, i.e., it is typically used polymorphically through a base class pointer.

See also
staticType for the static function.

Implements visr::CommunicationProtocolBase.

◆ resetChanged()

void visr::pml::DoubleBufferingProtocol::resetChanged ( )

◆ setProtocolInstance() [1/4]

void visr::pml::DoubleBufferingProtocol::setProtocolInstance ( CommunicationProtocolBase protocol)
override

◆ setProtocolInstance() [2/4]

void visr::pml::DoubleBufferingProtocol::setProtocolInstance ( DoubleBufferingProtocol protocol)

◆ setProtocolInstance() [3/4]

void visr::pml::DoubleBufferingProtocol::setProtocolInstance ( CommunicationProtocolBase protocol)
override

◆ setProtocolInstance() [4/4]

void visr::pml::DoubleBufferingProtocol::setProtocolInstance ( DoubleBufferingProtocol protocol)

◆ staticName()

static constexpr char const* visr::pml::DoubleBufferingProtocol::staticName ( )
inlinestatic

Return the name of the protocol.

◆ staticType()

static constexpr CommunicationProtocolType visr::pml::DoubleBufferingProtocol::staticType ( )
inlinestatic

Return the type id for the protocol.

◆ swapBuffers() [1/2]

void visr::pml::DoubleBufferingProtocol::swapBuffers ( bool  copyValue)

Trigger an parameter change in all connected receive ports.

Parameters
copyValueFlag whether the parameter value visible from the output will be preserved by the swap. This means that the current value is copied to the other buffer during the switch. If set to false, the new parameter can have an arbitrary value, and has to be set completely.

◆ swapBuffers() [2/2]

void visr::pml::DoubleBufferingProtocol::swapBuffers ( bool  copyValue = false)

Make the current parameter available to the receiving ports.

Parameters
copyValueWhether the parameter value is copied to the new output buffer. Otherwise the output contains an arbitrary parameter value, and must be set/assigned completely.

Friends And Related Function Documentation

◆ DoubleBufferingProtocol


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