|
Robot Raconteur Core C++ Library
|
Base class for WireBroadcaster. More...
#include <WireMember.h>
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. | |
Base class for WireBroadcaster.
Base class for templated WireBroadcaster class
| 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.
| boost::function< bool(boost::shared_ptr< WireBroadcasterBase > &, uint32_t)> RobotRaconteur::WireBroadcasterBase::GetPredicate | ( | ) |
Get the current predicate callback function.
| 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.
| millis | The lifespan in millisecond, or RR_VALUE_LIFESPAN_INFINITE for infinite lifespan |
| 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.
| f | The predicate callback function |