00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #include "ShmemLoader.h" 00009 #include "ShmemInst.h" 00010 00011 #include "dds/DCPS/transport/framework/TransportRegistry.h" 00012 #include "dds/DCPS/transport/framework/TransportType.h" 00013 00014 namespace { 00015 const char SHMEM_NAME[] = "shmem"; 00016 } 00017 00018 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00019 00020 namespace OpenDDS { 00021 namespace DCPS { 00022 00023 class ShmemType : public TransportType { 00024 public: 00025 const char* name() { return SHMEM_NAME; } 00026 00027 TransportInst_rch new_inst(const std::string& name) 00028 { 00029 return make_rch<ShmemInst>(name); 00030 } 00031 }; 00032 00033 int 00034 ShmemLoader::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<ShmemType>()); 00042 00043 //FUTURE: when we're ready, add a ShmemInst to the default config, like so: 00044 /* 00045 TransportInst_rch default_inst = 00046 registry->create_inst(TransportRegistry::DEFAULT_INST_PREFIX + "0200_SHMEM", 00047 UDP_NAME); 00048 registry->get_config(TransportRegistry::DEFAULT_CONFIG_NAME) 00049 ->sorted_insert(default_inst); 00050 */ 00051 initialized = true; 00052 00053 return 0; 00054 } 00055 00056 ACE_FACTORY_DEFINE(OpenDDS_Shmem, ShmemLoader); 00057 ACE_STATIC_SVC_DEFINE( 00058 ShmemLoader, 00059 ACE_TEXT("OpenDDS_Shmem"), 00060 ACE_SVC_OBJ_T, 00061 &ACE_SVC_NAME(ShmemLoader), 00062 ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, 00063 0) 00064 00065 } // namespace DCPS 00066 } // namespace OpenDDS 00067 00068 OPENDDS_END_VERSIONED_NAMESPACE_DECL