OpenDDS  Snapshot(2023/04/07-19:43)
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
OpenDDS::DCPS::ShmemInst Class Reference

#include <ShmemInst.h>

Inheritance diagram for OpenDDS::DCPS::ShmemInst:
Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::ShmemInst:
Collaboration graph
[legend]

Public Member Functions

virtual int load (ACE_Configuration_Heap &cf, ACE_Configuration_Section_Key &sect)
 
virtual OPENDDS_STRING dump_to_str () const
 
bool is_reliable () const
 Does the transport as configured support RELIABLE_RELIABILITY_QOS? More...
 
virtual size_t populate_locator (OpenDDS::DCPS::TransportLocator &trans_info, ConnectionInfoFlags flags) const
 Populate a transport locator sequence. Return the number of "locators.". More...
 
const std::string & hostname () const
 
const std::string & poolname () const
 
TimeDuration association_resend_period () const
 
- Public Member Functions inherited from OpenDDS::DCPS::TransportInst
const OPENDDS_STRINGname () const
 
void dump () const
 Diagnostic aid. More...
 
virtual bool requires_cdr_encapsulation () const
 Does the transport require a CDR-encapsulated data payload? More...
 
DCPS::WeakRcHandle< ICE::Endpointget_ice_endpoint ()
 
void rtps_relay_only_now (bool flag)
 
void use_rtps_relay_now (bool flag)
 
void use_ice_now (bool flag)
 
virtual void update_locators (const GUID_t &, const TransportLocatorSeq &)
 
virtual void get_last_recv_locator (const GUID_t &, TransportLocator &)
 
virtual void rtps_relay_address_change ()
 
ReactorTask_rch reactor_task ()
 
EventDispatcher_rch event_dispatcher ()
 
void count_messages (bool flag)
 
bool count_messages () const
 
virtual void append_transport_statistics (TransportStatisticsSequence &)
 
void drop_messages (bool flag)
 
void drop_messages_m (double m)
 
void drop_messages_b (double b)
 
bool should_drop (ssize_t length) const
 
bool should_drop (const iovec iov[], int n, ssize_t &length) const
 
- Public Member Functions inherited from OpenDDS::DCPS::RcObject
virtual ~RcObject ()
 
virtual void _add_ref ()
 
virtual void _remove_ref ()
 
long ref_count () const
 
WeakObject_get_weak_object () const
 

Public Attributes

size_t pool_size_
 
size_t datalink_control_size_
 
- Public Attributes inherited from OpenDDS::DCPS::TransportInst
const OPENDDS_STRING transport_type_
 
size_t queue_messages_per_pool_
 
size_t queue_initial_pools_
 
ACE_UINT32 max_packet_size_
 Max size (in bytes) of a packet (packet header + sample(s)) More...
 
size_t max_samples_per_packet_
 Max number of samples that should ever be in a single packet. More...
 
ACE_UINT32 optimum_packet_size_
 Optimum size (in bytes) of a packet (packet header + sample(s)). More...
 
bool thread_per_connection_
 
long datalink_release_delay_
 
size_t datalink_control_chunks_
 
TimeDuration fragment_reassembly_timeout_
 
size_t receive_preallocated_message_blocks_
 
size_t receive_preallocated_data_blocks_
 

Static Public Attributes

static const TimeDuration default_association_resend_period
 
- Static Public Attributes inherited from OpenDDS::DCPS::TransportInst
static const long DEFAULT_DATALINK_RELEASE_DELAY = 10000
 
static const size_t DEFAULT_DATALINK_CONTROL_CHUNKS = 32u
 

Private Member Functions

 ShmemInst (const std::string &name)
 
TransportImpl_rch new_impl ()
 

Private Attributes

std::string hostname_
 
std::string poolname_
 
TimeDuration association_resend_period_
 

Friends

class ShmemType
 
template<typename T , typename U >
RcHandle< T > OpenDDS::DCPS::make_rch (U const &)
 

Additional Inherited Members

- Static Public Member Functions inherited from OpenDDS::DCPS::TransportInst
static OPENDDS_STRING formatNameForDump (const char *name)
 
- Protected Member Functions inherited from OpenDDS::DCPS::TransportInst
 TransportInst (const char *type, const OPENDDS_STRING &name)
 
virtual ~TransportInst ()
 
void set_port_in_addr_string (OPENDDS_STRING &addr_str, u_short port_number)
 
TransportImpl_rch get_or_create_impl ()
 
TransportImpl_rch get_impl ()
 
- Protected Member Functions inherited from OpenDDS::DCPS::RcObject
 RcObject ()
 
- Protected Attributes inherited from OpenDDS::DCPS::TransportInst
ACE_SYNCH_MUTEX lock_
 
bool shutting_down_
 

Detailed Description

Definition at line 20 of file ShmemInst.h.

Constructor & Destructor Documentation

◆ ShmemInst()

OpenDDS::DCPS::ShmemInst::ShmemInst ( const std::string &  name)
explicitprivate

Definition at line 24 of file ShmemInst.cpp.

References ACE_OS::getpid(), OpenDDS::DCPS::TransportInst::name(), and poolname_.

25  : TransportInst("shmem", name)
26  , pool_size_(16 * 1024 * 1024)
27  , datalink_control_size_(4 * 1024)
30 {
31  std::ostringstream pool;
32  pool << "OpenDDS-" << ACE_OS::getpid() << '-' << this->name();
33  poolname_ = pool.str();
34 }
const OPENDDS_STRING & name() const
Definition: TransportInst.h:70
std::string poolname_
Definition: ShmemInst.h:58
TransportInst(const char *type, const OPENDDS_STRING &name)
static const TimeDuration default_association_resend_period
Definition: ShmemInst.h:22
TimeDuration association_resend_period_
Definition: ShmemInst.h:59
std::string hostname_
Definition: ShmemInst.h:57
String get_fully_qualified_hostname(ACE_INET_Addr *addr)
pid_t getpid(void)

Member Function Documentation

◆ association_resend_period()

TimeDuration OpenDDS::DCPS::ShmemInst::association_resend_period ( ) const
inline

Definition at line 45 of file ShmemInst.h.

46  {
48  }
TimeDuration association_resend_period_
Definition: ShmemInst.h:59

◆ dump_to_str()

OPENDDS_STRING OpenDDS::DCPS::ShmemInst::dump_to_str ( ) const
virtual

Reimplemented from OpenDDS::DCPS::TransportInst.

Definition at line 65 of file ShmemInst.cpp.

References association_resend_period_, datalink_control_size_, OpenDDS::DCPS::TransportInst::dump_to_str(), OpenDDS::DCPS::TransportInst::formatNameForDump(), hostname_, OPENDDS_STRING, pool_size_, poolname_, and OpenDDS::DCPS::TimeDuration::str().

66 {
67  std::ostringstream os;
69  os << formatNameForDump("pool_size") << pool_size_ << "\n"
70  << formatNameForDump("datalink_control_size") << datalink_control_size_ << "\n"
71  << formatNameForDump("pool_name") << this->poolname_ << "\n"
72  << formatNameForDump("host_name") << this->hostname_ << "\n"
73  << formatNameForDump("association_resend_period") << association_resend_period_.str() << "\n";
74  return OPENDDS_STRING(os.str());
75 }
std::string poolname_
Definition: ShmemInst.h:58
virtual OPENDDS_STRING dump_to_str() const
#define OPENDDS_STRING
String str(unsigned decimal_places=3, bool just_sec=false) const
TimeDuration association_resend_period_
Definition: ShmemInst.h:59
static OPENDDS_STRING formatNameForDump(const char *name)
std::string hostname_
Definition: ShmemInst.h:57

◆ hostname()

const std::string& OpenDDS::DCPS::ShmemInst::hostname ( ) const
inline

Definition at line 42 of file ShmemInst.h.

42 { return hostname_; }
std::string hostname_
Definition: ShmemInst.h:57

◆ is_reliable()

bool OpenDDS::DCPS::ShmemInst::is_reliable ( ) const
inlinevirtual

Does the transport as configured support RELIABLE_RELIABILITY_QOS?

Implements OpenDDS::DCPS::TransportInst.

Definition at line 38 of file ShmemInst.h.

38 { return true; }

◆ load()

int OpenDDS::DCPS::ShmemInst::load ( ACE_Configuration_Heap cf,
ACE_Configuration_Section_Key sect 
)
virtual

Overwrite the default configurations with the configuration from the given section in the ACE_Configuration_Heap object.

Reimplemented from OpenDDS::DCPS::TransportInst.

Definition at line 43 of file ShmemInst.cpp.

References ACE_TEXT(), association_resend_period_, datalink_control_size_, GET_CONFIG_STRING_VALUE, GET_CONFIG_TIME_VALUE, GET_CONFIG_VALUE, hostname_, OpenDDS::DCPS::TransportInst::load(), OPENDDS_STRING, and pool_size_.

45 {
46  TransportInst::load(cf, sect);
47 
48  std::string host_name;
49  GET_CONFIG_STRING_VALUE(cf, sect, ACE_TEXT("host_name"), host_name);
50 
51  if (!host_name.empty()) {
52  hostname_ = host_name;
53  }
54 
55  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("pool_size"), pool_size_, size_t)
56  GET_CONFIG_VALUE(cf, sect, ACE_TEXT("datalink_control_size"),
57  datalink_control_size_, size_t)
58  GET_CONFIG_TIME_VALUE(cf, sect,
59  ACE_TEXT("association_resend_period"), association_resend_period_);
60 
61  return 0;
62 }
#define GET_CONFIG_STRING_VALUE(CF, SECT, KEY, VALUE)
Definition: TransportDefs.h:76
#define GET_CONFIG_VALUE(CF, SECT, KEY, VALUE, TYPE)
Definition: TransportDefs.h:45
TimeDuration association_resend_period_
Definition: ShmemInst.h:59
#define GET_CONFIG_TIME_VALUE(CF, SECT, KEY, VALUE)
ACE_TEXT("TCP_Factory")
std::string hostname_
Definition: ShmemInst.h:57
virtual int load(ACE_Configuration_Heap &cf, ACE_Configuration_Section_Key &sect)

◆ new_impl()

TransportImpl_rch OpenDDS::DCPS::ShmemInst::new_impl ( )
privatevirtual

Implements OpenDDS::DCPS::TransportInst.

Definition at line 37 of file ShmemInst.cpp.

References OpenDDS::DCPS::rchandle_from().

38 {
39  return make_rch<ShmemTransport>(rchandle_from(this));
40 }
RcHandle< T > rchandle_from(T *pointer)
Definition: RcHandle_T.h:310

◆ poolname()

const std::string& OpenDDS::DCPS::ShmemInst::poolname ( ) const
inline

Definition at line 43 of file ShmemInst.h.

43 { return poolname_; }
std::string poolname_
Definition: ShmemInst.h:58

◆ populate_locator()

size_t OpenDDS::DCPS::ShmemInst::populate_locator ( OpenDDS::DCPS::TransportLocator trans_info,
ConnectionInfoFlags  flags 
) const
virtual

Populate a transport locator sequence. Return the number of "locators.".

Implements OpenDDS::DCPS::TransportInst.

Definition at line 78 of file ShmemInst.cpp.

References OpenDDS::DCPS::TransportLocator::data, hostname_, OPENDDS_END_VERSIONED_NAMESPACE_DECL, poolname_, and OpenDDS::DCPS::TransportLocator::transport_type.

79 {
80  info.transport_type = "shmem";
81 
82  const size_t len = hostname_.size() + 1 /* null */ + poolname_.size();
83  info.data.length(static_cast<CORBA::ULong>(len));
84 
85  CORBA::Octet* buff = info.data.get_buffer();
86  std::memcpy(buff, hostname_.c_str(), hostname_.size());
87  buff += hostname_.size();
88 
89  *(buff++) = 0;
90  std::memcpy(buff, poolname_.c_str(), poolname_.size());
91 
92  return 1;
93 }
std::string poolname_
Definition: ShmemInst.h:58
ACE_CDR::Octet Octet
std::string hostname_
Definition: ShmemInst.h:57

Friends And Related Function Documentation

◆ OpenDDS::DCPS::make_rch

template<typename T , typename U >
RcHandle<T> OpenDDS::DCPS::make_rch ( U const &  )
friend

◆ ShmemType

friend class ShmemType
friend

Definition at line 51 of file ShmemInst.h.

Member Data Documentation

◆ association_resend_period_

TimeDuration OpenDDS::DCPS::ShmemInst::association_resend_period_
private

Definition at line 59 of file ShmemInst.h.

Referenced by dump_to_str(), and load().

◆ datalink_control_size_

size_t OpenDDS::DCPS::ShmemInst::datalink_control_size_

Size (in bytes) of the control area allocated for each data link. This allocation comes out of the shared-memory pool defined by pool_size_. Defaults to 4 kilobytes.

Definition at line 36 of file ShmemInst.h.

Referenced by dump_to_str(), and load().

◆ default_association_resend_period

const TimeDuration OpenDDS::DCPS::ShmemInst::default_association_resend_period
static

Definition at line 22 of file ShmemInst.h.

◆ hostname_

std::string OpenDDS::DCPS::ShmemInst::hostname_
private

Definition at line 57 of file ShmemInst.h.

Referenced by dump_to_str(), load(), and populate_locator().

◆ pool_size_

size_t OpenDDS::DCPS::ShmemInst::pool_size_

Size (in bytes) of the single shared-memory pool allocated by this transport instance. Defaults to 16 megabytes.

Definition at line 31 of file ShmemInst.h.

Referenced by dump_to_str(), and load().

◆ poolname_

std::string OpenDDS::DCPS::ShmemInst::poolname_
private

Definition at line 58 of file ShmemInst.h.

Referenced by dump_to_str(), populate_locator(), and ShmemInst().


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