OpenDDS  Snapshot(2023/04/28-20:55)
RtpsUdpLoader.cpp
Go to the documentation of this file.
1 /*
2  *
3  *
4  * Distributed under the OpenDDS License.
5  * See: http://www.opendds.org/license.html
6  */
7 
8 #include "RtpsUdpLoader.h"
9 #include "RtpsUdpInst.h"
10 #include "RtpsUdpDataLink.h"
11 
14 
15 namespace {
16  const char RTPS_UDP_NAME[] = "rtps_udp";
17 }
18 
20 
21 namespace OpenDDS {
22 namespace DCPS {
23 
24 class RtpsUdpType : public TransportType {
25 public:
26  const char* name() { return RTPS_UDP_NAME; }
27 
29  {
30  return make_rch<RtpsUdpInst>(name);
31  }
32 };
33 
34 int
35 RtpsUdpLoader::init(int /*argc*/, ACE_TCHAR* /*argv*/[])
36 {
37  load();
38  return 0;
39 }
40 
42 {
44  TransportType_rch type = make_rch<RtpsUdpType>();
45  if (!registry->register_type(type)) {
46  return;
47  }
48 
49  // Don't create a default for RTPS. At least for the initial implementation,
50  // the user needs to explicitly configure it...
51 #ifdef OPENDDS_SAFETY_PROFILE
52  // ...except for Safety Profile where RTPS is the only option.
53  TransportInst_rch default_inst =
54  registry->create_inst(TransportRegistry::DEFAULT_INST_PREFIX +
55  OPENDDS_STRING("0600_RTPS_UDP"),
56  RTPS_UDP_NAME);
57  registry->get_config(TransportRegistry::DEFAULT_CONFIG_NAME)
58  ->sorted_insert(default_inst);
59 #endif
60 }
61 
62 ACE_FACTORY_DEFINE(OpenDDS_Rtps_Udp, RtpsUdpLoader);
65  ACE_TEXT("OpenDDS_Rtps_Udp"),
69  0)
70 
71 } // namespace DCPS
72 } // namespace OpenDDS
73 
#define TheTransportRegistry
static int load
& ACE_SVC_NAME(TAO_AV_TCP_Factory)
ACE_STATIC_SVC_DEFINE(ACE_Logging_Strategy, ACE_TEXT("Logging_Strategy"), ACE_Service_Type::SERVICE_OBJECT, &ACE_SVC_NAME(ACE_Logging_Strategy), ACE_Service_Type::DELETE_THIS|ACE_Service_Type::DELETE_OBJ, 0) extern "C" int _get_dll_unload_policy()
ACE_SVC_OBJ_T
ACE_FACTORY_DEFINE(OpenDDS_Rtps_Udp, RtpsUdpLoader)
#define OPENDDS_STRING
char ACE_TCHAR
TransportConfig_rch get_config(const OPENDDS_STRING &name) const
TransportInst_rch new_inst(const OPENDDS_STRING &name)
TransportInst_rch create_inst(const OPENDDS_STRING &name, const OPENDDS_STRING &transport_type)
const char *const name
Definition: debug.cpp:60
ACE_TEXT("TCP_Factory")
Base class for concrete transports to provide new objects.
Definition: TransportType.h:37
void sorted_insert(const TransportInst_rch &inst)
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
bool register_type(const TransportType_rch &type)