Robot Raconteur Core C++ Library
Loading...
Searching...
No Matches
RobotRaconteur::WireBroadcasterBase Class Reference

Base class for WireBroadcaster. More...

#include <WireMember.h>

Inheritance diagram for RobotRaconteur::WireBroadcasterBase:
RobotRaconteur::WireBroadcaster< T >

Public Member Functions

boost::function< bool(boost::shared_ptr< WireBroadcasterBase > &, uint32_t)> GetPredicate ()
 Get the current predicate callback function.
void SetPredicate (boost::function< bool(const boost::shared_ptr< WireBroadcasterBase > &, uint32_t)> f)
 Set the predicate callback function.
int32_t GetOutValueLifespan ()
 Get the lifespan of OutValue.
void SetOutValueLifespan (int32_t millis)
 Set the lifespan of OutValue.

Detailed Description

Base class for WireBroadcaster.

Base class for templated WireBroadcaster class

Member Function Documentation

◆ GetOutValueLifespan()

int32_t RobotRaconteur::WireBroadcasterBase::GetOutValueLifespan ( )

Get the lifespan of OutValue.

OutValue may optionally have a finite lifespan specified in milliseconds. Once the lifespan after sending has expired, the OutValue is cleared, and becomes invalid. Attempts to access OutValue will result in a ValueNotSetException.

Returns
int32_t The lifespan in milliseconds

◆ GetPredicate()

boost::function< bool(boost::shared_ptr< WireBroadcasterBase > &, uint32_t)> RobotRaconteur::WireBroadcasterBase::GetPredicate ( )

Get the current predicate callback function.

Returns
boost::function<bool(RR_SHARED_PTR<PipeBroadcasterBase>&, uint32_t, int32_t) > The predicate callback function

◆ SetOutValueLifespan()

void RobotRaconteur::WireBroadcasterBase::SetOutValueLifespan ( int32_t millis)

Set the lifespan of OutValue.

OutValue may optionally have a finite lifespan specified in milliseconds. Once the lifespan after sending has expired, the OutValue is cleared and becomes invalid. Attempts to access OutValue will result in ValueNotSetException.

OutValue lifespans may be used to avoid using a stale value sent by the wire. If the lifespan is not set, the wire will continue to return the last sent value, even if the value is old.

Parameters
millisThe lifespan in millisecond, or RR_VALUE_LIFESPAN_INFINITE for infinite lifespan

◆ SetPredicate()

void RobotRaconteur::WireBroadcasterBase::SetPredicate ( boost::function< bool(const boost::shared_ptr< WireBroadcasterBase > &, uint32_t)> f)

Set the predicate callback function.

A predicate is optionally used to regulate when values are sent to clients. This is used by the BroadcastDownsampler to regulate update rates of values sent to clients.

The predicate callback is invoked before the broadcaster sets the OutValue of a connection. If the predicate returns true, the OutValue packet will be sent. If it is false, the OutValue packet will not be sent to that endpoint. The predicate callback must have the following signature:

bool broadcaster_predicate(WireBroadcasterBasePtr& broadcaster, uint32_t client_endpoint);

It receives the broadcaster and the client endpoint ID. It returns true to send the OutValue packet, or false to not send the OutValue packet.

Parameters
fThe predicate callback function

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