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 namespace OpenDDS { 00019 namespace DCPS { 00020 00021 class ShmemType : public TransportType { 00022 public: 00023 const char* name() { return SHMEM_NAME; } 00024 00025 TransportInst* new_inst(const std::string& name) 00026 { 00027 return new ShmemInst(name); 00028 } 00029 }; 00030 00031 int 00032 ShmemLoader::init(int /*argc*/, ACE_TCHAR* /*argv*/[]) 00033 { 00034 static bool initialized(false); 00035 00036 if (initialized) return 0; // already initialized 00037 00038 TransportRegistry* registry = TheTransportRegistry; 00039 registry->register_type(new ShmemType); 00040 00041 //FUTURE: when we're ready, add a ShmemInst to the default config, like so: 00042 /* 00043 TransportInst_rch default_inst = 00044 registry->create_inst(TransportRegistry::DEFAULT_INST_PREFIX + "0200_SHMEM", 00045 UDP_NAME); 00046 registry->get_config(TransportRegistry::DEFAULT_CONFIG_NAME) 00047 ->sorted_insert(default_inst); 00048 */ 00049 initialized = true; 00050 00051 return 0; 00052 } 00053 00054 ACE_FACTORY_DEFINE(OpenDDS_Shmem, ShmemLoader); 00055 ACE_STATIC_SVC_DEFINE( 00056 ShmemLoader, 00057 ACE_TEXT("OpenDDS_Shmem"), 00058 ACE_SVC_OBJ_T, 00059 &ACE_SVC_NAME(ShmemLoader), 00060 ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, 00061 0) 00062 00063 } // namespace DCPS 00064 } // namespace OpenDDS