ddt
0.1
|
#include <ddtDataConsumer.hpp>
Public Types | |
enum | SubscriberType { LOCAL, REMOTE } |
![]() | |
enum | NotificationType { NEW_DATA, PUB_REG, PUB_UNREG, SHM_DEL } |
Public Member Functions | |
DdtDataConsumer (const std::string &data_stream_identifier, const int32_t latency, const int32_t deadline, DdtLogger *ddt_logger) | |
DdtDataConsumer (const std::string &data_stream_identifier, const std::string &subscription_uri, const int32_t latency, const int32_t deadline, DdtLogger *ddt_logger) | |
~DdtDataConsumer () override | |
void | StartSubscription () |
void | StopSubscription () |
void | AddUuid (std::string uuid, SubscriberType type) |
void | RemoveUuid (const std::string uuid) |
void | Notify (const NotificationType type) override |
int32_t | get_number_of_subscribers () |
int32_t | get_number_of_remote_subscribers () |
std::map< std::string, SubscriberType > | get_subscribers () |
std::string | get_remote_broker_uri () const |
int32_t | get_notification_port () const |
DdtStatistics | get_statistics () |
void | ResetStatistics () |
std::string | get_publishing_uri () const |
void | set_remote_broker_uri (const std::string &remote_uri) |
void | set_number_of_samples (const int32_t num_samples) |
void | set_memory_accessor (DdtMemoryAccessor *mem_accessor) |
void | set_notification_port (const int32_t noti_port) |
void | set_publishing_uri (const std::string pub_uri) |
![]() | |
DdtProducerConsumerBase (DdtLogger *ddt_logger) | |
virtual | ~DdtProducerConsumerBase () |
Public Attributes | |
signal_n | notification_signal |
Protected Member Functions | |
void | Init (const std::string &ds_id, DdtLogger *ddt_logger) |
![]() | |
void | Init (DdtLogger *ddt_logger) |
void | LoadDefaults () |
void | ReadIni () |
void | PrintConfigValues () |
int32_t | GetFreePort () const |
Protected Attributes | |
DdtMemoryAccessor * | memory_accessor |
std::string | data_stream_identifier |
int32_t | number_of_samples |
int32_t | notification_port |
std::string | publishing_uri |
std::chrono::system_clock::time_point | last_received |
uint64_t | total_samples |
uint64_t | total_bytes |
uint64_t | total_latency = 0 |
![]() | |
int32_t | min_port |
int32_t | max_port |
DdtLogger * | logger |
const int | MIN_PORT_DEFAULT = 5100 |
const int | MAX_PORT_DEFAULT = 5500 |
const int | MIN_RANGE = 3 |
const int | LINE_LENGTH = 256 |
This class provides the functionality to subscribe to a data stream, to write the received data into shared memory and to notify DdtDataSubscribers that new data is available. There will be one data consumer object per data stream identifier and thus several DdtDataSubscribers may share one consumer object.
DdtDataConsumer::DdtDataConsumer | ( | const std::string & | data_stream_identifier, |
const int32_t | latency, | ||
const int32_t | deadline, | ||
DdtLogger * | ddt_logger | ||
) |
Constructor
DdtDataConsumer::DdtDataConsumer | ( | const std::string & | data_stream_identifier, |
const std::string & | subscription_uri, | ||
const int32_t | latency, | ||
const int32_t | deadline, | ||
DdtLogger * | ddt_logger | ||
) |
Constructor
|
overridedefault |
Destructor
void DdtDataConsumer::AddUuid | ( | std::string | uuid, |
SubscriberType | type | ||
) |
Adds the UUID of a DdtDataSubscriber to the subscriber_map.
int32_t DdtDataConsumer::get_notification_port | ( | ) | const |
Returns notification_port.
int32_t DdtDataConsumer::get_number_of_remote_subscribers | ( | ) |
Returns the number of remote DdtDataSubscribers attached to a consumer object.
iterate over the subscriber map count all subscribers of type REMOTE
int32_t DdtDataConsumer::get_number_of_subscribers | ( | ) |
Returns the number of all DdtDataSubscribers attached to a consumer object.
std::string DdtDataConsumer::get_publishing_uri | ( | ) | const |
Returns publishing_uri.
std::string DdtDataConsumer::get_remote_broker_uri | ( | ) | const |
Returns remote_broker_uri.
DdtStatistics DdtDataConsumer::get_statistics | ( | ) |
Returns the statistics.
std::map< std::string, DdtDataConsumer::SubscriberType > DdtDataConsumer::get_subscribers | ( | ) |
Returns the map with the uuids of DdtDataSubscribers attached to a consumer object.
|
protected |
Initializes some member variables.
|
overridevirtual |
Sends a notification to local subscribers.
Implements ddt::DdtProducerConsumerBase.
void DdtDataConsumer::RemoveUuid | ( | const std::string | uuid | ) |
Removes the UUID of a DdtDataSubscriber from the subscriber_map.
void DdtDataConsumer::ResetStatistics | ( | ) |
Resets the statistics to zero in case the shared memory was deleted.
void DdtDataConsumer::set_memory_accessor | ( | DdtMemoryAccessor * | mem_accessor | ) |
Sets memory_accessor.
void DdtDataConsumer::set_notification_port | ( | const int32_t | noti_port | ) |
Sets notification_port.
void DdtDataConsumer::set_number_of_samples | ( | const int32_t | num_samples | ) |
Sets number_of_samples.
void DdtDataConsumer::set_publishing_uri | ( | const std::string | pub_uri | ) |
Sets the publishing_uri.
void DdtDataConsumer::set_remote_broker_uri | ( | const std::string & | remote_uri | ) |
Sets remote_broker_uri.
void DdtDataConsumer::StartSubscription | ( | ) |
Starts MAL subscription as a separate thread.
void DdtDataConsumer::StopSubscription | ( | ) |
Stops MAL subscription.
|
protected |
|
protected |
statistic counters Raw values for the monitoring API provided as simple counters. Counters are updated for each Data Sample and a timestamp is stored when the counters were updated. The timestamp is necessary for clients to accurately calculate statistics such as averages. Last time when a data sample was received
|
protected |
|
protected |
signal_n ddt::DdtDataConsumer::notification_signal |
Boost signal to send the notification type received via MALps.
|
protected |
|
protected |
|
protected |
Total number of bytes received in the data stream
|
protected |
Aggregated latency in [ms]
|
protected |
Total number of complete data samples received