MADARA  3.4.1
madara::transport::SpliceDDSTransport Class Reference

This class provides an interface into the Open Splice dissemination transport. More...

#include <SpliceDDSTransport.h>

Inheritance diagram for madara::transport::SpliceDDSTransport:
madara::transport::Base

Public Types

enum  { ERROR_OSPL_NOT_STARTED = -1 , ERROR_SUB_BAD_CREATE = -2 , ERROR_PUB_BAD_CREATE = -3 }
 
typedef std::vector< std::string > HostsVector
 Used to define a vector of hosts to contact. More...
 

Public Member Functions

 SpliceDDSTransport (const std::string &id, knowledge::ThreadSafeContext &context, TransportSettings &config, bool launch_transport)
 Constructor. More...
 
 ~SpliceDDSTransport ()
 Destructor. More...
 
int check_transport (void)
 all subclasses should call this method at the beginning of send_data More...
 
void close (void)
 Closes this transport. More...
 
void invalidate_transport (void)
 Invalidates a transport to indicate it is shutting down. More...
 
long prep_send (const knowledge::KnowledgeMap &orig_updates, const char *print_prefix)
 Preps a message for sending. More...
 
int reliability (const int &setting)
 Sets the reliability setting. More...
 
int reliability (void) const
 Accesses reliability setting. More...
 
long send_data (const knowledge::KnowledgeMap &updates) override
 Sends a list of knowledge updates to listeners. More...
 
TransportSettingssettings (void)
 Getter for the transport settings. More...
 
int setup (void)
 Activates this transport. More...
 
int validate_transport (void)
 Validates a transport to indicate it is not shutting down. More...
 

Static Public Attributes

static const int PROFILES = 2
 

Protected Attributes

madara::utility::ScopedArray< char > buffer_
 buffer for sending More...
 
madara::knowledge::ThreadSafeContextcontext_
 
HostsVector hosts
 
const std::string id_
 host:port identifier of this process More...
 
volatile bool is_valid_
 
uint64_t last_toi_sent_ = 0
 Latest TOI the previous send operation included. More...
 
madara::expression::ExpressionTree on_data_received_
 data received rules, defined in Transport settings More...
 
PacketScheduler packet_scheduler_
 scheduler for dropping packets to simulate network issues More...
 
BandwidthMonitor receive_monitor_
 monitor for receiving bandwidth usage More...
 
BandwidthMonitor send_monitor_
 monitor for sending bandwidth usage More...
 
QoSTransportSettings settings_
 
volatile bool shutting_down_
 

Private Member Functions

int check_handle (void *handle, const char *info)
 Splice handle checker. More...
 
int check_status (DDS::ReturnCode_t status, const char *info)
 Splice status checker. More...
 
const char * get_error_name (DDS::ReturnCode_t status)
 Returns error name of the specific status. More...
 

Private Attributes

DDS::DataReader_var datareader_
 
DDS::DataReaderQos datareader_qos_
 
DDS::DataWriter_var datawriter_
 
DDS::DataWriterQos datawriter_qos_
 
DDS::DomainId_t domain_
 
DDS::DomainParticipantFactory_var domain_factory_
 
DDS::DomainParticipant_var domain_participant_
 
knowledge::KnowledgeBase knowledge_
 knowledge base for threads to use More...
 
Knowledge::UpdateDataWriter_var latency_update_writer_
 
DDS::DataWriter_var latencywriter_
 
DDS::DomainParticipantQos part_qos_
 
DDS::PublisherQos pub_qos_
 
DDS::Publisher_var publisher_
 
threads::Threader read_threads_
 threads for reading knowledge updates More...
 
DDS::SubscriberQos sub_qos_
 
DDS::Subscriber_var subscriber_
 
DDS::TopicQos topic_qos_
 
Knowledge::UpdateDataReader_var update_reader_
 
DDS::Topic_var update_topic_
 
Knowledge::UpdateTypeSupport update_type_support_
 
Knowledge::UpdateDataWriter_var update_writer_
 

Static Private Attributes

static const char * partition_
 
static const char * ret_code_names []
 
static const char * topic_names_ []
 

Detailed Description

This class provides an interface into the Open Splice dissemination transport.

Definition at line 22 of file SpliceDDSTransport.h.

Member Typedef Documentation

◆ HostsVector

typedef std::vector<std::string> madara::transport::Base::HostsVector
inherited

Used to define a vector of hosts to contact.

Definition at line 51 of file Transport.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
ERROR_OSPL_NOT_STARTED 
ERROR_SUB_BAD_CREATE 
ERROR_PUB_BAD_CREATE 

Definition at line 25 of file SpliceDDSTransport.h.

Constructor & Destructor Documentation

◆ SpliceDDSTransport()

madara::transport::SpliceDDSTransport::SpliceDDSTransport ( const std::string &  id,
knowledge::ThreadSafeContext context,
TransportSettings config,
bool  launch_transport 
)

Constructor.

Parameters
idunique identifer - usually a combination of host:port
contextknowledge context
configtransport configuration settings
launch_transportwhether or not to launch this transport

Definition at line 27 of file SpliceDDSTransport.cpp.

◆ ~SpliceDDSTransport()

madara::transport::SpliceDDSTransport::~SpliceDDSTransport ( )

Destructor.

Definition at line 51 of file SpliceDDSTransport.cpp.

Member Function Documentation

◆ check_handle()

int madara::transport::SpliceDDSTransport::check_handle ( void *  handle,
const char *  info 
)
private

Splice handle checker.

Definition at line 443 of file SpliceDDSTransport.cpp.

◆ check_status()

int madara::transport::SpliceDDSTransport::check_status ( DDS::ReturnCode_t  status,
const char *  info 
)
private

Splice status checker.

Definition at line 459 of file SpliceDDSTransport.cpp.

◆ check_transport()

int madara::transport::Base::check_transport ( void  )
inlineinherited

all subclasses should call this method at the beginning of send_data

Definition at line 17 of file Transport.inl.

◆ close()

void madara::transport::SpliceDDSTransport::close ( void  )
virtual

Closes this transport.

Reimplemented from madara::transport::Base.

Definition at line 56 of file SpliceDDSTransport.cpp.

◆ get_error_name()

const char * madara::transport::SpliceDDSTransport::get_error_name ( DDS::ReturnCode_t  status)
private

Returns error name of the specific status.

Definition at line 474 of file SpliceDDSTransport.cpp.

◆ invalidate_transport()

void madara::transport::Base::invalidate_transport ( void  )
inlineinherited

Invalidates a transport to indicate it is shutting down.

Definition at line 31 of file Transport.inl.

◆ prep_send()

long madara::transport::Base::prep_send ( const knowledge::KnowledgeMap orig_updates,
const char *  print_prefix 
)
inherited

Preps a message for sending.

Parameters
orig_updatesupdates before send filtering is applied
print_prefixprefix to include before every log message, e.g., "MyTransport::svc"
Returns
-1 Transport is shutting down
-2 Transport is invalid
-3 Unable to allocate send buffer
0 No message to send > 0 size of buffered message

filter the updates according to the filters specified by the user in QoSTransportSettings (if applicable)

size = buffer[0] (unsigned 64 bit) transport id = buffer[8] (8 byte) domain = buffer[16] (32 byte domain name) originator = buffer[48] (64 byte originator host:port) type = buffer[112] (unsigned 32 bit type of message–usually MULTIASSIGN) updates = buffer[116] (unsigned 32 bit number of updates) quality = buffer[120] (unsigned 32 bit quality of message) clock = buffer[124] (unsigned 64 bit clock for this message) ttl = buffer[132] (the new knowledge starts here) knowledge = buffer[133] (the new knowledge starts here)

Definition at line 860 of file Transport.cpp.

◆ reliability() [1/2]

int madara::transport::SpliceDDSTransport::reliability ( const int &  setting)

Sets the reliability setting.

Returns
the changed setting

Definition at line 101 of file SpliceDDSTransport.cpp.

◆ reliability() [2/2]

int madara::transport::SpliceDDSTransport::reliability ( void  ) const

Accesses reliability setting.

Returns
whether we are using reliable dissemination or not

Definition at line 96 of file SpliceDDSTransport.cpp.

◆ send_data()

long madara::transport::SpliceDDSTransport::send_data ( const knowledge::KnowledgeMap updates)
overridevirtual

Sends a list of knowledge updates to listeners.

Parameters
updateslisting of all updates that must be sent
Returns
result of write operation or -1 if we are shutting down

get current lamport clock.

Implements madara::transport::Base.

Definition at line 398 of file SpliceDDSTransport.cpp.

◆ settings()

madara::transport::TransportSettings & madara::transport::Base::settings ( void  )
inlineinherited

Getter for the transport settings.

Returns
the current transport settings

Definition at line 40 of file Transport.inl.

◆ setup()

int madara::transport::SpliceDDSTransport::setup ( void  )
virtual

Activates this transport.

Returns
0 for success. This function may exit the process if the OSPL daemon hasn't been started.

Reimplemented from madara::transport::Base.

Definition at line 106 of file SpliceDDSTransport.cpp.

◆ validate_transport()

int madara::transport::Base::validate_transport ( void  )
inlineinherited

Validates a transport to indicate it is not shutting down.

Definition at line 6 of file Transport.inl.

Member Data Documentation

◆ buffer_

madara::utility::ScopedArray<char> madara::transport::Base::buffer_
protectedinherited

buffer for sending

Definition at line 153 of file Transport.h.

◆ context_

madara::knowledge::ThreadSafeContext& madara::transport::Base::context_
protectedinherited

Definition at line 135 of file Transport.h.

◆ datareader_

DDS::DataReader_var madara::transport::SpliceDDSTransport::datareader_
private

Definition at line 106 of file SpliceDDSTransport.h.

◆ datareader_qos_

DDS::DataReaderQos madara::transport::SpliceDDSTransport::datareader_qos_
private

Definition at line 98 of file SpliceDDSTransport.h.

◆ datawriter_

DDS::DataWriter_var madara::transport::SpliceDDSTransport::datawriter_
private

Definition at line 105 of file SpliceDDSTransport.h.

◆ datawriter_qos_

DDS::DataWriterQos madara::transport::SpliceDDSTransport::datawriter_qos_
private

Definition at line 96 of file SpliceDDSTransport.h.

◆ domain_

DDS::DomainId_t madara::transport::SpliceDDSTransport::domain_
private

Definition at line 100 of file SpliceDDSTransport.h.

◆ domain_factory_

DDS::DomainParticipantFactory_var madara::transport::SpliceDDSTransport::domain_factory_
private

Definition at line 101 of file SpliceDDSTransport.h.

◆ domain_participant_

DDS::DomainParticipant_var madara::transport::SpliceDDSTransport::domain_participant_
private

Definition at line 102 of file SpliceDDSTransport.h.

◆ hosts

HostsVector madara::transport::Base::hosts
protectedinherited

Definition at line 127 of file Transport.h.

◆ id_

const std::string madara::transport::Base::id_
protectedinherited

host:port identifier of this process

Definition at line 130 of file Transport.h.

◆ is_valid_

volatile bool madara::transport::Base::is_valid_
protectedinherited

Definition at line 125 of file Transport.h.

◆ knowledge_

knowledge::KnowledgeBase madara::transport::SpliceDDSTransport::knowledge_
private

knowledge base for threads to use

Definition at line 84 of file SpliceDDSTransport.h.

◆ last_toi_sent_

uint64_t madara::transport::Base::last_toi_sent_ = 0
protectedinherited

Latest TOI the previous send operation included.

Definition at line 156 of file Transport.h.

◆ latency_update_writer_

Knowledge::UpdateDataWriter_var madara::transport::SpliceDDSTransport::latency_update_writer_
private

Definition at line 110 of file SpliceDDSTransport.h.

◆ latencywriter_

DDS::DataWriter_var madara::transport::SpliceDDSTransport::latencywriter_
private

Definition at line 107 of file SpliceDDSTransport.h.

◆ on_data_received_

madara::expression::ExpressionTree madara::transport::Base::on_data_received_
protectedinherited

data received rules, defined in Transport settings

Definition at line 139 of file Transport.h.

◆ packet_scheduler_

PacketScheduler madara::transport::Base::packet_scheduler_
protectedinherited

scheduler for dropping packets to simulate network issues

Definition at line 150 of file Transport.h.

◆ part_qos_

DDS::DomainParticipantQos madara::transport::SpliceDDSTransport::part_qos_
private

Definition at line 93 of file SpliceDDSTransport.h.

◆ partition_

const char * madara::transport::SpliceDDSTransport::partition_
staticprivate
Initial value:
=
"Madara_knowledge"

Definition at line 90 of file SpliceDDSTransport.h.

◆ PROFILES

const int madara::transport::SpliceDDSTransport::PROFILES = 2
static

Definition at line 32 of file SpliceDDSTransport.h.

◆ pub_qos_

DDS::PublisherQos madara::transport::SpliceDDSTransport::pub_qos_
private

Definition at line 95 of file SpliceDDSTransport.h.

◆ publisher_

DDS::Publisher_var madara::transport::SpliceDDSTransport::publisher_
private

Definition at line 103 of file SpliceDDSTransport.h.

◆ read_threads_

threads::Threader madara::transport::SpliceDDSTransport::read_threads_
private

threads for reading knowledge updates

Definition at line 87 of file SpliceDDSTransport.h.

◆ receive_monitor_

BandwidthMonitor madara::transport::Base::receive_monitor_
protectedinherited

monitor for receiving bandwidth usage

Definition at line 147 of file Transport.h.

◆ ret_code_names

const char * madara::transport::SpliceDDSTransport::ret_code_names
staticprivate
Initial value:
= {
"DDS_RETCODE_OK", "DDS_RETCODE_ERROR", "DDS_RETCODE_UNSUPPORTED",
"DDS_RETCODE_BAD_PARAMETER", "DDS_RETCODE_PRECONDITION_NOT_MET",
"DDS_RETCODE_OUT_OF_RESOURCES", "DDS_RETCODE_NOT_ENABLED",
"DDS_RETCODE_IMMUTABLE_POLICY", "DDS_RETCODE_INCONSISTENT_POLICY",
"DDS_RETCODE_ALREADY_DELETED", "DDS_RETCODE_TIMEOUT", "DDS_RETCODE_NO_DATA",
"DDS_RETCODE_ILLEGAL_OPERATION"}

Definition at line 91 of file SpliceDDSTransport.h.

◆ send_monitor_

BandwidthMonitor madara::transport::Base::send_monitor_
protectedinherited

monitor for sending bandwidth usage

Definition at line 144 of file Transport.h.

◆ settings_

QoSTransportSettings madara::transport::Base::settings_
protectedinherited

Definition at line 132 of file Transport.h.

◆ shutting_down_

volatile bool madara::transport::Base::shutting_down_
protectedinherited

Definition at line 126 of file Transport.h.

◆ sub_qos_

DDS::SubscriberQos madara::transport::SpliceDDSTransport::sub_qos_
private

Definition at line 97 of file SpliceDDSTransport.h.

◆ subscriber_

DDS::Subscriber_var madara::transport::SpliceDDSTransport::subscriber_
private

Definition at line 104 of file SpliceDDSTransport.h.

◆ topic_names_

const char * madara::transport::SpliceDDSTransport::topic_names_
staticprivate
Initial value:
= {
"MADARA_KaRL_Data", "MADARA_KaRL_Control"}

Definition at line 89 of file SpliceDDSTransport.h.

◆ topic_qos_

DDS::TopicQos madara::transport::SpliceDDSTransport::topic_qos_
private

Definition at line 94 of file SpliceDDSTransport.h.

◆ update_reader_

Knowledge::UpdateDataReader_var madara::transport::SpliceDDSTransport::update_reader_
private

Definition at line 111 of file SpliceDDSTransport.h.

◆ update_topic_

DDS::Topic_var madara::transport::SpliceDDSTransport::update_topic_
private

Definition at line 114 of file SpliceDDSTransport.h.

◆ update_type_support_

Knowledge::UpdateTypeSupport madara::transport::SpliceDDSTransport::update_type_support_
private

Definition at line 112 of file SpliceDDSTransport.h.

◆ update_writer_

Knowledge::UpdateDataWriter_var madara::transport::SpliceDDSTransport::update_writer_
private

Definition at line 109 of file SpliceDDSTransport.h.


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