27 #include <boost/unordered_map.hpp>
29 namespace RobotRaconteur
31 class ROBOTRACONTEUR_CORE_API ServerContext;
32 class ROBOTRACONTEUR_CORE_API PipeBroadcasterBase;
33 class ROBOTRACONTEUR_CORE_API WireBroadcasterBase;
63 class ROBOTRACONTEUR_CORE_API
BroadcastDownsampler :
public RR_ENABLE_SHARED_FROM_THIS<BroadcastDownsampler>
82 void Init(
const RR_SHARED_PTR<ServerContext>& context, uint32_t default_downsample = 0);
135 RR_WEAK_PTR<ServerContext> context;
137 uint32_t default_downsample;
139 RR_UNORDERED_MAP<uint32_t, uint32_t> client_downsamples;
141 boost::mutex this_lock;
143 static bool wire_predicate(RR_WEAK_PTR<BroadcastDownsampler> this_,
const RR_SHARED_PTR<WireBroadcasterBase>& wire,
145 static bool pipe_predicate(RR_WEAK_PTR<BroadcastDownsampler> this_,
const RR_SHARED_PTR<PipeBroadcasterBase>& wire,
146 uint32_t ep, uint32_t index);
148 static void server_event(RR_WEAK_PTR<BroadcastDownsampler> this_,
const RR_SHARED_PTR<ServerContext>& ctx,
162 RR_SHARED_PTR<BroadcastDownsampler>& _downsampler;
178 #ifndef ROBOTRACONTEUR_NO_CXX11_TEMPLATE_ALIASES
boost::shared_ptr< BroadcastDownsampler > BroadcastDownsamplerPtr
Convenience alias for BroadcastDownsampler shared_ptr.
Definition: BroadcastDownsampler.h:180
ServerServiceListenerEventType
Enum of service listener events.
Definition: RobotRaconteurConstants.h:518
Downsampler to manage rate of packets sent to client.
Definition: BroadcastDownsampler.h:64
BroadcastDownsampler()
Construct a new BroadcastDownsampler.
void SetClientDownsample(uint32_t ep, uint32_t downsample)
Set the downsample for the specified client.
void AddPipeBroadcaster(const boost::shared_ptr< PipeBroadcasterBase > &broadcaster)
Add a PipeBroadcaster to the downsampler.
uint32_t GetClientDownsample(uint32_t ep)
Get the downsample for the specified client.
void BeginStep()
Begin the update loop step.
void EndStep()
End the update loop step.
void AddWireBroadcaster(const boost::shared_ptr< WireBroadcasterBase > &broadcaster)
Add a WireBroadcaster to the downsampler.
void Init(const boost::shared_ptr< ServerContext > &context, uint32_t default_downsample=0)
Initialize the BroadcastDownsampler.
Class for automatic broadcast downsampler stepping.
Definition: BroadcastDownsampler.h:161
BroadcastDownsamplerStep(boost::shared_ptr< BroadcastDownsampler > &downsampler)
Construct a BroadcastDownsampler.