UdpLoader.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 "UdpLoader.h"
00009 #include "UdpInst.h"
00010 
00011 #include "dds/DCPS/transport/framework/TransportRegistry.h"
00012 #include "dds/DCPS/transport/framework/TransportType.h"
00013 
00014 namespace {
00015   const char UDP_NAME[] = "udp";
00016 }
00017 
00018 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00019 
00020 namespace OpenDDS {
00021 namespace DCPS {
00022 
00023 class UdpType : public TransportType {
00024 public:
00025   const char* name() { return UDP_NAME; }
00026 
00027   TransportInst_rch new_inst(const std::string& name)
00028   {
00029     return make_rch<UdpInst>(name);
00030   }
00031 };
00032 
00033 int
00034 UdpLoader::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<UdpType>());
00042   TransportInst_rch default_inst =
00043     registry->create_inst(TransportRegistry::DEFAULT_INST_PREFIX +
00044                           std::string("0300_UDP"), UDP_NAME);
00045   registry->get_config(TransportRegistry::DEFAULT_CONFIG_NAME)
00046     ->sorted_insert(default_inst);
00047 
00048   initialized = true;
00049 
00050   return 0;
00051 }
00052 
00053 ACE_FACTORY_DEFINE(OpenDDS_Udp, UdpLoader);
00054 ACE_STATIC_SVC_DEFINE(
00055   UdpLoader,
00056   ACE_TEXT("OpenDDS_Udp"),
00057   ACE_SVC_OBJ_T,
00058   &ACE_SVC_NAME(UdpLoader),
00059   ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
00060   0)
00061 
00062 } // namespace DCPS
00063 } // namespace OpenDDS
00064 
00065 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