ddt 1.2.1
|
#include <ddtClient.hpp>
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 |
DdtLogger * | logger |
DdtClient () | |
DdtClient (const std::string remote_broker, const int32_t repl_time, const int32_t hb_interval, const int32_t hb_timeout, const std::string broker, 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 |
void | Init (const std::string remote_broker, const int32_t repl_time, const int32_t hb_interval, const int32_t hb_timeout, const std::string broker, DdtLogger *ddt_logger) |
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.
|
explicitdefault |
Constructor
DdtClient::DdtClient | ( | const std::string | remote_broker, |
const int32_t | repl_time, | ||
const int32_t | hb_interval, | ||
const int32_t | hb_timeout, | ||
const std::string | broker, | ||
DdtLogger * | ddt_logger ) |
Constructor
remote_broker | URI of the remote broker. |
repl_time | MAL request timeout used to establish a connection to a MAL server in [s]. |
hb_interval | Heartbeat interval in [s]. |
hb_timeout | Heartbeat timeout in [s]. |
broker | URI of the local broker. |
ddt_logger | A DDT logger object (no transfer of ownership). |
|
virtual |
Destructor
void DdtClient::AddUuid | ( | std::string | uuid, |
std::string | dsi ) |
Adds a subscriber uuid and its data stream to the subscriber_map.
uuid | UUID of a subscriber. |
dsi | The data stream identifier. |
bool DdtClient::CheckIfEmpty | ( | ) |
Checks if there are no more subscribers attached to this client.
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.
data_stream_identifier | The data stream identifier. |
std::string DdtClient::get_broker_uri | ( | ) | const |
Returns the URI of the originating broker including the host name.
bool DdtClient::get_compute_checksum | ( | const std::string & | data_stream_identifier | ) | const |
Returns compute_checksum from the memory accessor.
data_stream_identifier | The data stream identifier. |
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.
data_stream_identifier | The data stream identifier. |
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.
data_stream_identifier | The data stream identifier. |
std::string DdtClient::GetPublishingUri | ( | const std::string & | data_stream_identifier | ) | const |
Returns the publishing uri by calling GetPublishingUri() at the remote broker.
data_stream_identifier | The data stream identifier. |
|
protected |
Initializes some member variables.
remote_broker | URI of the remote broker. |
repl_time | MAL request timeout used to establish a connection to a MAL server in [s]. |
hb_interval | Heartbeat interval in [s]. |
hb_timeout | Heartbeat timeout in [s]. |
broker | URI of the local broker. |
ddt_logger | A DDT logger object (no transfer of ownership). |
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.
subscriber_uuid | UUID of a subscriber. |
data_stream_identifier | The data stream identifier. |
latency | A MAL QoS parameter. Shall be the maximum time a sample may remain in-transit between the publisher and subscriber in [ms]. |
deadline | A MAL QoS parameter. Shall be the maximum age of a sample in [s]. |
void DdtClient::UnregisterSubscriber | ( | const std::string | uuid | ) |
Unregisters a subscriber from the remote broker and removes its uuid from the subscriber_map.
uuid | UUID of a subscriber. |
|
protected |
URI of the local broker.
|
protected |
Stores the connection state to the remote broker.
|
protected |
Stores if the heartbeat is active.
|
protected |
Heartbeat interval in [s].
|
protected |
Heartbeat timeout in [s].
|
protected |
A DDT logger object.
|
protected |
URI of the remote broker.
|
protected |
MAL request timeout used to establish a connection to a MAL server in [s].
|
protected |
Map storing all subscribers connected to the same remote broker. They might request data from different data streams.
key | The subscriber uuid. |
value | The data stream identifier. |