ddt  0.1
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ddt::DdtDataTransferLib Class Reference

#include <ddtDataTransferLib.hpp>

Inheritance diagram for ddt::DdtDataTransferLib:
ddt::DdtDataPublisher ddt::DdtDataSubscriber ddt::DdtStatisticsClient DdtDataTransferLib2Fake DdtDataTransferLibFake DdtDataPublisher2Fake DdtDataPublisherFake DdtDataSubscriber2Fake DdtDataSubscriberFake

Public Member Functions

 DdtDataTransferLib (DdtLogger *ddt_logger)
 
 DdtDataTransferLib (log4cplus::Logger const &log4cplusLogger)
 
virtual ~DdtDataTransferLib ()
 
void SetQoS (const int ddt_latency, const int ddt_deadline)
 
virtual int RegisterPublisher (const std::string uri, const std::string dsi, const bool compute_crc)
 
virtual int UnregisterPublisher ()
 
virtual void PublishData ()
 
virtual int RegisterSubscriber (const std::string uri, const std::string dsi, const std::string remote_uri, const int32_t interval=10)
 
virtual int UnregisterSubscriber ()
 
virtual DataSampleReadData ()
 

Protected Member Functions

void StartHeartbeat (const int32_t interval, const std::string id)
 
void StopHeartbeat ()
 
int InitMAL (const std::string broker_uri)
 
void CheckHeartbeatTimeout (int32_t &new_reply_time)
 
const std::string VerifyPathInBrokerUri (std::string broker_uri)
 
const std::string GetConfigFilePath ()
 

Protected Attributes

int latency
 
int deadline
 
int32_t reply_time
 
int32_t heartbeat_interval
 
std::promise< void > exit_signal_heartbeat
 
std::future< void > future_object_heartbeat
 
std::atomic< bool > heartbeat_active
 
std::unique_ptr< datatransfer::DataBrokerRegistrationSync, std::default_delete< datatransfer::DataBrokerRegistrationSync > > client
 
std::atomic< bool > connected_to_broker
 
elt::mal::rr::ListenerRegistration connection_listener
 
DdtLoggerlogger
 
DdtLoggermyLogger = nullptr
 
const int32_t REPLY_TIME_DEFAULT = 6
 
const int32_t REPLY_TIME_MIN = 2
 

Detailed Description

Base class for DdtDataPublishers and DdtDataSubscribers.

Constructor & Destructor Documentation

◆ DdtDataTransferLib() [1/2]

DdtDataTransferLib::DdtDataTransferLib ( DdtLogger ddt_logger)
explicit

Constructor

◆ DdtDataTransferLib() [2/2]

DdtDataTransferLib::DdtDataTransferLib ( log4cplus::Logger const &  log4cplusLogger)
explicit

Constructor, taking a log4cplus logger as input

◆ ~DdtDataTransferLib()

DdtDataTransferLib::~DdtDataTransferLib ( )
virtual

Destructor

Member Function Documentation

◆ CheckHeartbeatTimeout()

void DdtDataTransferLib::CheckHeartbeatTimeout ( int32_t &  new_reply_time)
protected

Verifies that the heartbeat timeout retrieved from the broker is greater than reply time.

Make sure the heartbeat timeout is greater than the reply time! If not, recreate MAL client with new reply time.

reset reply_time (the connection manager makes sure that the heartbeat timeout has a valid value (at least 3s)

◆ GetConfigFilePath()

const std::string DdtDataTransferLib::GetConfigFilePath ( )
protected

This function reads the environment variable DDT_TRANSFERCONFIG_PATH and returns path and name of the configuration file.

Returns
A string containing the path to the configuration file.

check if DDT_TRANSFERCONFIG_PATH is set use default path otherwise

◆ InitMAL()

int DdtDataTransferLib::InitMAL ( const std::string  broker_uri)
protected

Initializes the MAL.

determine MAL mapping from uri and load it obtain reference to CiiFactory

Synchronous client example w/ ReplyTime QoS set. DataBrokerRegistrationSync interface is requested.

◆ PublishData()

virtual void ddt::DdtDataTransferLib::PublishData ( )
inlinevirtual

Function for triggering the local broker to publish data over the network.

Reimplemented in ddt::DdtDataPublisher.

◆ ReadData()

virtual DataSample* ddt::DdtDataTransferLib::ReadData ( )
inlinevirtual

Function for receiving data.

Reimplemented in ddt::DdtDataSubscriber.

◆ RegisterPublisher()

virtual int ddt::DdtDataTransferLib::RegisterPublisher ( const std::string  uri,
const std::string  dsi,
const bool  compute_crc 
)
inlinevirtual

Function for registering a publisher at the local broker using a MAL client.

Reimplemented in ddt::DdtDataPublisher.

◆ RegisterSubscriber()

virtual int ddt::DdtDataTransferLib::RegisterSubscriber ( const std::string  uri,
const std::string  dsi,
const std::string  remote_uri,
const int32_t  interval = 10 
)
inlinevirtual

Function for registering a subscriber at the local broker using a MAL client.

Reimplemented in ddt::DdtDataSubscriber.

◆ SetQoS()

void DdtDataTransferLib::SetQoS ( const int  ddt_latency,
const int  ddt_deadline 
)

Sets quality of service parameters (latency [ms], deadline [s]).

◆ StartHeartbeat()

void DdtDataTransferLib::StartHeartbeat ( const int32_t  interval,
const std::string  id 
)
protected

Starts the heartbeat thread.

◆ StopHeartbeat()

void DdtDataTransferLib::StopHeartbeat ( )
protected

Stops the heartbeat thread.

◆ UnregisterPublisher()

virtual int ddt::DdtDataTransferLib::UnregisterPublisher ( )
inlinevirtual

Function for unregistering a publisher from the local broker.

Reimplemented in ddt::DdtDataPublisher.

◆ UnregisterSubscriber()

virtual int ddt::DdtDataTransferLib::UnregisterSubscriber ( )
inlinevirtual

Function for unregistering a subscriber from the local broker.

Reimplemented in ddt::DdtDataSubscriber.

◆ VerifyPathInBrokerUri()

const std::string DdtDataTransferLib::VerifyPathInBrokerUri ( std::string  broker_uri)
protected

This function verifies if the broker uri contains the path element. If not specified by the user the path element is added.

Member Data Documentation

◆ client

std::unique_ptr< datatransfer::DataBrokerRegistrationSync, std::default_delete<datatransfer::DataBrokerRegistrationSync> > ddt::DdtDataTransferLib::client
protected

MAL client used to connect to data brokers.

◆ connected_to_broker

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

Stores connection state to broker.

◆ connection_listener

elt::mal::rr::ListenerRegistration ddt::DdtDataTransferLib::connection_listener
protected

Observes the connection to the broker.

◆ deadline

int ddt::DdtDataTransferLib::deadline
protected

maximum age of a sample [s]

◆ exit_signal_heartbeat

std::promise<void> ddt::DdtDataTransferLib::exit_signal_heartbeat
protected

std::promise object used to stop the HeartbeatThread.

◆ future_object_heartbeat

std::future<void> ddt::DdtDataTransferLib::future_object_heartbeat
protected

std::future object associated with exit_signal_heartbeat.

◆ heartbeat_active

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

When the HearbeatThread is stopped it waits until heartbeat_active is set to false.

◆ heartbeat_interval

int32_t ddt::DdtDataTransferLib::heartbeat_interval
protected

interval for the heartbeat in [s] retrieved from the data broker

◆ latency

int ddt::DdtDataTransferLib::latency
protected

duration between send and receive cannot be greater than 'latency' [ms]

◆ logger

DdtLogger* ddt::DdtDataTransferLib::logger
protected

Logger object

◆ myLogger

DdtLogger* ddt::DdtDataTransferLib::myLogger = nullptr
protected

◆ reply_time

int32_t ddt::DdtDataTransferLib::reply_time
protected

configurable reply time for MAL clients in [s]

◆ REPLY_TIME_DEFAULT

const int32_t ddt::DdtDataTransferLib::REPLY_TIME_DEFAULT = 6
protected

Default value for the reply time.

◆ REPLY_TIME_MIN

const int32_t ddt::DdtDataTransferLib::REPLY_TIME_MIN = 2
protected

Minimum value for the reply time.


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