CARLA
Loading...
Searching...
No Matches
carla::streaming::low_level::Client< T > Class Template Reference

A client able to subscribe to multiple streams. More...

#include <Client.h>

Public Types

using protocol_type = typename underlying_client::protocol_type
using token_type = carla::streaming::detail::token_type
using underlying_client = T

Public Member Functions

 Client ()
 Client (boost::asio::ip::address fallback_address)
 Client (const std::string &fallback_address)
template<typename Functor>
void Subscribe (boost::asio::io_context &io_context, token_type token, Functor &&callback)
void UnSubscribe (token_type token)
 ~Client ()

Private Attributes

std::unordered_map< detail::stream_id_type, std::shared_ptr< underlying_client > > _clients
boost::asio::ip::address _fallback_address

Detailed Description

template<typename T>
class carla::streaming::low_level::Client< T >

A client able to subscribe to multiple streams.

Accepts an external io_context.

Warning
The client should not be destroyed before the io_context is stopped.

Definition at line 27 of file streaming/low_level/Client.h.

Member Typedef Documentation

◆ protocol_type

template<typename T>
using carla::streaming::low_level::Client< T >::protocol_type = typename underlying_client::protocol_type

Definition at line 31 of file streaming/low_level/Client.h.

◆ token_type

template<typename T>
using carla::streaming::low_level::Client< T >::token_type = carla::streaming::detail::token_type

Definition at line 32 of file streaming/low_level/Client.h.

◆ underlying_client

template<typename T>
using carla::streaming::low_level::Client< T >::underlying_client = T

Definition at line 30 of file streaming/low_level/Client.h.

Constructor & Destructor Documentation

◆ Client() [1/3]

template<typename T>
carla::streaming::low_level::Client< T >::Client ( boost::asio::ip::address fallback_address)
inlineexplicit

Definition at line 34 of file streaming/low_level/Client.h.

◆ Client() [2/3]

template<typename T>
carla::streaming::low_level::Client< T >::Client ( const std::string & fallback_address)
inlineexplicit

Definition at line 37 of file streaming/low_level/Client.h.

◆ Client() [3/3]

template<typename T>
carla::streaming::low_level::Client< T >::Client ( )
inlineexplicit

Definition at line 40 of file streaming/low_level/Client.h.

◆ ~Client()

template<typename T>
carla::streaming::low_level::Client< T >::~Client ( )
inline

Definition at line 43 of file streaming/low_level/Client.h.

Member Function Documentation

◆ Subscribe()

template<typename T>
template<typename Functor>
void carla::streaming::low_level::Client< T >::Subscribe ( boost::asio::io_context & io_context,
token_type token,
Functor && callback )
inline
Warning
cannot subscribe twice to the same stream (even if it's a MultiStream).

Definition at line 52 of file streaming/low_level/Client.h.

Referenced by carla::streaming::Client::Subscribe(), TEST(), and TEST().

◆ UnSubscribe()

template<typename T>
void carla::streaming::low_level::Client< T >::UnSubscribe ( token_type token)
inline

Definition at line 68 of file streaming/low_level/Client.h.

Referenced by TEST(), and carla::streaming::Client::UnSubscribe().

Member Data Documentation

◆ _clients

template<typename T>
std::unordered_map< detail::stream_id_type, std::shared_ptr<underlying_client> > carla::streaming::low_level::Client< T >::_clients
private

Definition at line 83 of file streaming/low_level/Client.h.

◆ _fallback_address

template<typename T>
boost::asio::ip::address carla::streaming::low_level::Client< T >::_fallback_address
private

Definition at line 79 of file streaming/low_level/Client.h.


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