CARLA
Public Types | Public Member Functions | Private Attributes | List of all members
carla::streaming::low_level::Client< T > Class Template Reference

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

#include <Client.h>

+ Inheritance diagram for carla::streaming::low_level::Client< T >:
+ Collaboration diagram for carla::streaming::low_level::Client< T >:

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 (boost::asio::ip::address fallback_address)
 
 Client (const std::string &fallback_address)
 
 Client ()
 
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

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(), and TEST().

+ Here is the caller graph for this function:

◆ 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().

+ Here is the caller graph for this function:

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

◆ _fallback_address

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

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