ddt 1.4.0
 
Loading...
Searching...
No Matches
ddt::DdtClient Class Reference

#include <ddtClient.hpp>

Inheritance diagram for ddt::DdtClient:
DdtClientFake

Public Member Functions

 DdtClient ()
 
 DdtClient (const DdtClientConfig &config, DdtLogger *ddt_logger)
 
virtual ~DdtClient ()
 
void AddUuid (std::string uuid, std::string dsi)
 
void UnregisterSubscriber (const std::string uuid)
 
bool CheckIfEmpty ()
 
bool CheckPublisherExists (const std::string &data_stream_identifier) const
 
int32_t RegisterRemoteSubscriber (const std::string &subscriber_uuid, const std::string &data_stream_identifier, const int32_t latency, const int32_t deadline) const
 
std::string GetPublishingUri (const std::string &data_stream_identifier) const
 
int32_t get_max_data_sample_size (const std::string &data_stream_identifier) const
 
int32_t get_number_of_samples (const std::string &data_stream_identifier) const
 
bool get_compute_checksum (const std::string &data_stream_identifier) const
 
std::string get_broker_uri () const
 

Protected Member Functions

void Init (const DdtClientConfig &config, DdtLogger *ddt_logger)
 

Protected Attributes

std::map< std::string, std::string > subscriber_map
 
std::atomic< bool > connected_to_broker
 
std::atomic< bool > heartbeat_active
 
std::string remote_broker_uri
 
std::string broker_uri
 
int32_t reply_time
 
int32_t heartbeat_interval
 
int32_t heartbeat_timeout
 
int32_t wait_for_connection
 
DdtLoggerlogger
 

Detailed Description

This class creates MAL clients to connect to remote brokers. It provides a connection listener which observes the connection state and reregisters subscribers in the case a broker was restarted. It also provides the heartbeat functionality.

Constructor & Destructor Documentation

◆ DdtClient() [1/2]

DdtClient::DdtClient ( )
explicitdefault

Constructor

◆ DdtClient() [2/2]

DdtClient::DdtClient ( const DdtClientConfig & config,
DdtLogger * ddt_logger )

Constructor

Parameters
configConfiguration parameters for the client.
ddt_loggerA DDT logger object (no transfer of ownership).

◆ ~DdtClient()

DdtClient::~DdtClient ( )
virtual

Destructor

Member Function Documentation

◆ AddUuid()

void DdtClient::AddUuid ( std::string uuid,
std::string dsi )

Adds a subscriber uuid and its data stream to the subscriber_map.

Parameters
uuidUUID of a subscriber.
dsiThe data stream identifier.

◆ CheckIfEmpty()

bool DdtClient::CheckIfEmpty ( )

Checks if there are no more subscribers attached to this client.

Returns
True if subscriber_map is empty.

◆ CheckPublisherExists()

bool DdtClient::CheckPublisherExists ( const std::string & data_stream_identifier) const

Checks if a publisher for the specified data stream exists. This calls CheckPublisherExists() at the remote broker.

Parameters
data_stream_identifierThe data stream identifier.
Returns
True if a publisher of the specified data stream identifier exists.

◆ get_broker_uri()

std::string DdtClient::get_broker_uri ( ) const

Returns the URI of the originating broker including the host name.

Returns
The URI of the originating broker.

◆ get_compute_checksum()

bool DdtClient::get_compute_checksum ( const std::string & data_stream_identifier) const

Returns compute_checksum from the memory accessor.

Parameters
data_stream_identifierThe data stream identifier.
Returns
True if checksum computation is switched on.

◆ get_max_data_sample_size()

int32_t DdtClient::get_max_data_sample_size ( const std::string & data_stream_identifier) const

Returns max_data_sample_size by calling get_max_data_sample_size() at the remote broker.

Parameters
data_stream_identifierThe data stream identifier.
Returns
Maximum data sample size.

◆ get_number_of_samples()

int32_t DdtClient::get_number_of_samples ( const std::string & data_stream_identifier) const

Returns number_of_samples by calling get_number_of_samples() at the remote broker.

Parameters
data_stream_identifierThe data stream identifier.
Returns
Number of samples stored in the SHM ring buffer.

◆ GetPublishingUri()

std::string DdtClient::GetPublishingUri ( const std::string & data_stream_identifier) const

Returns the publishing uri by calling GetPublishingUri() at the remote broker.

Parameters
data_stream_identifierThe data stream identifier.
Returns
Publishing URI.

◆ Init()

void DdtClient::Init ( const DdtClientConfig & config,
DdtLogger * ddt_logger )
protected

Initializes some member variables.

Parameters
configConfiguration parameters for the client.
ddt_loggerA DDT logger object (no transfer of ownership).

◆ RegisterRemoteSubscriber()

int32_t DdtClient::RegisterRemoteSubscriber ( const std::string & subscriber_uuid,
const std::string & data_stream_identifier,
const int32_t latency,
const int32_t deadline ) const

Registers a subscriber at the remote broker. This calls RegisterRemoteSubscriber() at the remote broker.

Parameters
subscriber_uuidUUID of a subscriber.
data_stream_identifierThe data stream identifier.
latencyA MAL QoS parameter. Shall be the maximum time a sample may remain in-transit between the publisher and subscriber in [ms].
deadlineA MAL QoS parameter. Shall be the maximum age of a sample in [s].
Returns
1 if registering was successful.

◆ UnregisterSubscriber()

void DdtClient::UnregisterSubscriber ( const std::string uuid)

Unregisters a subscriber from the remote broker and removes its uuid from the subscriber_map.

Parameters
uuidUUID of a subscriber.

Member Data Documentation

◆ broker_uri

std::string ddt::DdtClient::broker_uri
protected

URI of the local broker.

◆ connected_to_broker

std::atomic<bool> ddt::DdtClient::connected_to_broker
protected

Stores the connection state to the remote broker.

◆ heartbeat_active

std::atomic<bool> ddt::DdtClient::heartbeat_active
protected

Stores if the heartbeat is active.

◆ heartbeat_interval

int32_t ddt::DdtClient::heartbeat_interval
protected

Heartbeat interval in [s].

◆ heartbeat_timeout

int32_t ddt::DdtClient::heartbeat_timeout
protected

Heartbeat timeout in [s].

◆ logger

DdtLogger* ddt::DdtClient::logger
protected

A DDT logger object.

◆ remote_broker_uri

std::string ddt::DdtClient::remote_broker_uri
protected

URI of the remote broker.

◆ reply_time

int32_t ddt::DdtClient::reply_time
protected

MAL request timeout used to establish a connection to a MAL server in [s].

◆ subscriber_map

std::map<std::string, std::string> ddt::DdtClient::subscriber_map
protected

Map storing all subscribers connected to the same remote broker. They might request data from different data streams.

Parameters
keyThe subscriber uuid.
valueThe data stream identifier.

◆ wait_for_connection

int32_t ddt::DdtClient::wait_for_connection
protected

Timeout for establishing broker connection in [s].


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