VISR  0.11.1
Versatile Interactive Scene Renderer
visr::rcl::UdpReceiver Class Reference

#include <udp_receiver.hpp>

Inheritance diagram for visr::rcl::UdpReceiver:
visr::AtomicComponent visr::Component

Public Types

enum  Mode { Mode::Synchronous, Mode::Asynchronous, Mode::ExternalServiceObject }
 

Public Member Functions

 UdpReceiver (SignalFlowContext const &context, char const *name, CompositeComponent *parent=nullptr)
 
 ~UdpReceiver ()
 
void setup (std::size_t port, Mode mode, boost::asio::io_service *externalIoService=nullptr)
 
void process () override
 
- Public Member Functions inherited from visr::AtomicComponent
 AtomicComponent (SignalFlowContext const &context, char const *name, CompositeComponent *parent=nullptr)
 
 AtomicComponent (AtomicComponent const &)=delete
 
 AtomicComponent (AtomicComponent &&)=delete
 
virtual ~AtomicComponent () override
 
- Public Member Functions inherited from visr::Component
 Component (SignalFlowContext const &context, char const *componentName, CompositeComponent *parent)
 
 Component (SignalFlowContext const &context, std::string const &componentName, CompositeComponent *parent)
 
 Component (Component const &)=delete
 
 Component (Component &&)=delete
 
Componentoperator= (Component const &)=delete
 
Componentoperator= (Component &&)=delete
 
virtual ~Component ()
 
std::string const & name () const
 
std::string fullName () const
 
void status (StatusMessage::Kind status, char const *message)
 
template<typename... MessageArgs>
void status (StatusMessage::Kind status, MessageArgs...args)
 
bool isComposite () const
 
AudioPortBaseaudioPort (char const *portName)
 
AudioPortBase const & audioPort (char const *portName) const
 
AudioPortBaseaudioPort (std::string const &portName)
 
AudioPortBase const & audioPort (std::string const &portName) const
 
ParameterPortBaseparameterPort (char const *portName)
 
ParameterPortBase const & parameterPort (char const *portName) const
 
ParameterPortBaseparameterPort (std::string const &portName)
 
ParameterPortBase const & parameterPort (std::string const &portName) const
 
SamplingFrequencyType samplingFrequency () const
 
std::size_t period () const
 
bool isTopLevel () const
 
impl::ComponentImplementationimplementation ()
 
impl::ComponentImplementation const & implementation () const
 

Static Public Attributes

static std::size_t const cMaxMessageLength = 65536
 

Additional Inherited Members

- Static Public Member Functions inherited from visr::Component
static const std::string & nameSeparator ()
 
- Protected Member Functions inherited from visr::Component
 Component (impl::ComponentImplementation *impl)
 

Detailed Description

A component to receive messages from a predefined UDP network port. The message can operate either synchronously (messages are collected from the network socket when the process() method is called) or asynchronously (the messages are fetched at an arbitrary time using a thread instantiated by the component). In either case, messages are transmitted further only when the process() method is called for the next time.

Member Enumeration Documentation

Enumerator
Synchronous 

The data is received from the UDP port within the process() method.

Asynchronous 
ExternalServiceObject 

Network data is received asynchronously within a thread. Network data is received asynchronously using an externally provided (for instance application-global) boost asio IO service object.

Constructor & Destructor Documentation

visr::rcl::UdpReceiver::UdpReceiver ( SignalFlowContext const &  context,
char const *  name,
CompositeComponent parent = nullptr 
)
explicit

Constructor.

Parameters
contextConfiguration object containing basic execution parameters.
nameThe name of the component. Must be unique within the containing composite component (if there is one).
parentPointer to a containing component if there is one. Specify nullptr in case of a top-level component
visr::rcl::UdpReceiver::~UdpReceiver ( )

Destructor.

Member Function Documentation

void visr::rcl::UdpReceiver::process ( )
overridevirtual

The process function.

Implements visr::AtomicComponent.

void visr::rcl::UdpReceiver::setup ( std::size_t  port,
Mode  mode,
boost::asio::io_service *  externalIoService = nullptr 
)

Method to initialise the component.

Parameters
portThe UDP port number to receive data.
modeThe mode how data is received. See documantation of enumeration Mode.
externalIoServiceAn externally provided IO service object. Must be non-zero if and only if mode == Mode::ExternalServiceObject

Member Data Documentation

std::size_t const visr::rcl::UdpReceiver::cMaxMessageLength = 65536
static

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