RtpsUdpLoader.cpp

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 #include "RtpsUdpLoader.h"
00009 #include "RtpsUdpInst.h"
00010 
00011 #include "dds/DCPS/transport/framework/TransportRegistry.h"
00012 #include "dds/DCPS/transport/framework/TransportType.h"
00013 
00014 namespace {
00015   const char RTPS_UDP_NAME[] = "rtps_udp";
00016 }
00017 
00018 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00019 
00020 namespace OpenDDS {
00021 namespace DCPS {
00022 
00023 class RtpsUdpType : public TransportType {
00024 public:
00025   const char* name() { return RTPS_UDP_NAME; }
00026 
00027   TransportInst_rch new_inst(const OPENDDS_STRING& name)
00028   {
00029     return make_rch<RtpsUdpInst>(name);
00030   }
00031 };
00032 
00033 int
00034 RtpsUdpLoader::init(int /*argc*/, ACE_TCHAR* /*argv*/[])
00035 {
00036   static bool initialized(false);
00037 
00038   if (initialized) return 0;  // already initialized
00039 
00040   TransportRegistry* registry = TheTransportRegistry;
00041   registry->register_type(make_rch<RtpsUdpType>());
00042   // Don't create a default for RTPS.  At least for the initial implementation,
00043   // the user needs to explicitly configure it...
00044 #ifdef OPENDDS_SAFETY_PROFILE
00045   // ...except for Safety Profile where RTPS is the only option.
00046   TransportInst_rch default_inst =
00047     registry->create_inst(TransportRegistry::DEFAULT_INST_PREFIX +
00048                           OPENDDS_STRING("0600_RTPS_UDP"),
00049                           RTPS_UDP_NAME);
00050   registry->get_config(TransportRegistry::DEFAULT_CONFIG_NAME)
00051     ->sorted_insert(default_inst);
00052 #endif
00053   initialized = true;
00054 
00055   return 0;
00056 }
00057 
00058 ACE_FACTORY_DEFINE(OpenDDS_Rtps_Udp, RtpsUdpLoader);
00059 ACE_STATIC_SVC_DEFINE(
00060   RtpsUdpLoader,
00061   ACE_TEXT("OpenDDS_Rtps_Udp"),
00062   ACE_SVC_OBJ_T,
00063   &ACE_SVC_NAME(RtpsUdpLoader),
00064   ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
00065   0)
00066 
00067 } // namespace DCPS
00068 } // namespace OpenDDS
00069 
00070 OPENDDS_END_VERSIONED_NAMESPACE_DECL
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1