00001
00002
00003
00004
00005
00006
00007
00008 #include "Tcp_pch.h"
00009
00010 #include "TcpLoader.h"
00011 #include "TcpInst.h"
00012 #include "dds/DCPS/transport/framework/TransportRegistry.h"
00013 #include "dds/DCPS/transport/framework/TransportType.h"
00014 #include "dds/DCPS/transport/framework/EntryExit.h"
00015
00016 #include "tao/debug.h"
00017 #include "ace/OS_NS_strings.h"
00018
00019 namespace {
00020 const char TCP_NAME[] = "tcp";
00021 }
00022
00023 namespace OpenDDS {
00024 namespace DCPS {
00025
00026 TcpLoader::TcpLoader()
00027 {
00028 DBG_ENTRY_LVL("TcpLoader", "TcpLoader", 6);
00029 }
00030
00031 TcpLoader::~TcpLoader()
00032 {
00033 DBG_ENTRY_LVL("TcpLoader", "~TcpLoader", 6);
00034 }
00035
00036 class TcpType : public TransportType {
00037 public:
00038 const char* name() { return TCP_NAME; }
00039
00040 TransportInst* new_inst(const std::string& name)
00041 {
00042 return new TcpInst(name);
00043 }
00044 };
00045
00046 int
00047 TcpLoader::init(int, ACE_TCHAR*[])
00048 {
00049 DBG_ENTRY_LVL("TcpLoader", "init", 6);
00050
00051 static bool initialized = false;
00052
00053
00054 if (initialized)
00055 return 0;
00056
00057 TransportRegistry* registry = TheTransportRegistry;
00058 registry->register_type(new TcpType);
00059 TransportInst_rch default_inst =
00060 registry->create_inst(TransportRegistry::DEFAULT_INST_PREFIX +
00061 std::string("0500_TCP"), TCP_NAME);
00062 registry->get_config(TransportRegistry::DEFAULT_CONFIG_NAME)
00063 ->sorted_insert(default_inst);
00064
00065 initialized = true;
00066 return 0;
00067 }
00068
00069
00070
00071 ACE_FACTORY_DEFINE(OpenDDS_Tcp, TcpLoader)
00072 ACE_STATIC_SVC_DEFINE(TcpLoader,
00073 ACE_TEXT("OpenDDS_Tcp"),
00074 ACE_SVC_OBJ_T,
00075 &ACE_SVC_NAME(TcpLoader),
00076 ACE_Service_Type::DELETE_THIS
00077 | ACE_Service_Type::DELETE_OBJ,
00078 0)
00079 }
00080 }