TransportInst.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #ifndef OPENDDS_DCPS_TRANSPORTINST_H
00009 #define OPENDDS_DCPS_TRANSPORTINST_H
00010 
00011 #include <ace/config.h>
00012 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00013 #pragma once
00014 #endif
00015 
00016 #include "dds/DCPS/dcps_export.h"
00017 #include "TransportDefs.h"
00018 #include "TransportImpl_rch.h"
00019 #include "TransportImpl.h"
00020 #include "dds/DCPS/RcObject_T.h"
00021 
00022 #include "ace/Synch.h"
00023 
00024 #include "dds/DCPS/PoolAllocator.h"
00025 
00026 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00027 class ACE_Configuration_Heap;
00028 class ACE_Configuration_Section_Key;
00029 ACE_END_VERSIONED_NAMESPACE_DECL
00030 
00031 namespace OpenDDS {
00032 namespace DCPS {
00033 
00034 /**
00035  * @class TransportInst
00036  *
00037  * @brief Base class to hold configuration settings for TransportImpls.
00038  *
00039  * Each transport implementation will need to define a concrete
00040  * subclass of the TransportInst class.  The base
00041  * class (TransportInst) contains configuration settings that
00042  * are common to all (or most) concrete transport implementations.
00043  * The concrete transport implementation defines any configuration
00044  * settings that it requires within its concrete subclass of this
00045  * TransportInst base class.
00046  *
00047  * The TransportInst object is supplied to the
00048  * TransportImpl::configure() method.
00049  */
00050 class OpenDDS_Dcps_Export TransportInst : public RcObject<ACE_SYNCH_MUTEX> {
00051 public:
00052 
00053   OPENDDS_STRING name() const { return name_; }
00054 
00055   /// Overwrite the default configurations with the configuration from the
00056   /// given section in the ACE_Configuration_Heap object.
00057   virtual int load(ACE_Configuration_Heap& cf,
00058                    ACE_Configuration_Section_Key& sect);
00059 
00060   /// Diagnostic aid.
00061   void dump();
00062   virtual OPENDDS_STRING dump_to_str();
00063 
00064   /// Format name of transport configuration parameter for use in
00065   /// conjunction with dump(std::ostream& os).
00066   static OPENDDS_STRING formatNameForDump(const char* name);
00067 
00068   const OPENDDS_STRING transport_type_;
00069 
00070   /// Number of pre-created link (list) objects per pool for the
00071   /// "send queue" of each DataLink.
00072   size_t queue_messages_per_pool_;
00073 
00074   /// Initial number of pre-allocated pools of link (list) objects
00075   /// for the "send queue" of each DataLink.
00076   size_t queue_initial_pools_;
00077 
00078   /// Max size (in bytes) of a packet (packet header + sample(s))
00079   ACE_UINT32 max_packet_size_;
00080 
00081   /// Max number of samples that should ever be in a single packet.
00082   size_t max_samples_per_packet_;
00083 
00084   /// Optimum size (in bytes) of a packet (packet header + sample(s)).
00085   ACE_UINT32 optimum_packet_size_;
00086 
00087   /// Flag for whether a new thread is needed for connection to
00088   /// send without backpressure.
00089   bool thread_per_connection_;
00090 
00091   /// Delay in milliseconds that the datalink should be released after all
00092   /// associations are removed. The default value is 10 seconds.
00093   long datalink_release_delay_;
00094 
00095   /// The number of chunks used to size allocators for transport control
00096   /// samples. The default value is 32.
00097   size_t datalink_control_chunks_;
00098 
00099   /// Does the transport as configured support RELIABLE_RELIABILITY_QOS?
00100   virtual bool is_reliable() const = 0;
00101 
00102   /// Does the transport require a CDR-encapsulated data payload?
00103   virtual bool requires_cdr() const { return false; }
00104 
00105   /// Populate a transport locator sequence.  Return the number of "locators."
00106   virtual size_t populate_locator(OpenDDS::DCPS::TransportLocator& trans_info) const = 0;
00107 
00108 protected:
00109 
00110   TransportInst(const char* type,
00111                 const OPENDDS_STRING& name);
00112 
00113   virtual ~TransportInst();
00114 
00115 private:
00116 
00117   /// Adjust the configuration values which gives warning on adjusted
00118   /// value.
00119   void adjust_config_value();
00120 
00121   friend class TransportRegistry;
00122   void shutdown();
00123 
00124   friend class TransportClient;
00125   TransportImpl_rch impl();
00126   virtual TransportImpl* new_impl(const RcHandle<TransportInst>& inst) = 0;
00127 
00128   const OPENDDS_STRING name_;
00129 
00130   TransportImpl_rch impl_;
00131   ACE_SYNCH_MUTEX lock_;
00132 };
00133 
00134 } // namespace DCPS
00135 } // namespace OpenDDS
00136 
00137 #if defined(__ACE_INLINE__)
00138 #include "TransportInst.inl"
00139 #endif /* __ACE_INLINE__ */
00140 
00141 #endif

Generated on Fri Feb 12 20:05:28 2016 for OpenDDS by  doxygen 1.4.7