00001
00002
00003
00004
00005
00006
00007
00008 #ifndef OPENDDS_DCPS_TRANSPORTREGISTRY_H
00009 #define OPENDDS_DCPS_TRANSPORTREGISTRY_H
00010
00011 #include "dds/DCPS/dcps_export.h"
00012 #include "TransportDefs.h"
00013 #include "TransportImpl_rch.h"
00014 #include "TransportReactorTask_rch.h"
00015 #include "TransportType.h"
00016 #include "TransportType_rch.h"
00017 #include "TransportInst_rch.h"
00018 #include "TransportConfig_rch.h"
00019 #include "TransportConfig.h"
00020 #include "ace/Synch.h"
00021 #include "dds/DCPS/PoolAllocator.h"
00022
00023
00024 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00025 class ACE_Configuration_Heap;
00026 ACE_END_VERSIONED_NAMESPACE_DECL
00027
00028 namespace DDS {
00029 class Entity;
00030 typedef Entity* Entity_ptr;
00031 }
00032
00033 #define TheTransportRegistry OpenDDS::DCPS::TransportRegistry::instance()
00034
00035 namespace OpenDDS {
00036 namespace DCPS {
00037
00038
00039
00040
00041
00042 class OpenDDS_Dcps_Export TransportRegistry {
00043 public:
00044
00045
00046 static TransportRegistry* instance();
00047
00048
00049
00050
00051
00052 void release();
00053
00054 TransportInst_rch create_inst(const OPENDDS_STRING& name,
00055 const OPENDDS_STRING& transport_type);
00056 TransportInst_rch get_inst(const OPENDDS_STRING& name) const;
00057 void remove_inst(const TransportInst_rch& inst);
00058
00059 static const char DEFAULT_CONFIG_NAME[];
00060 static const char DEFAULT_INST_PREFIX[];
00061
00062 TransportConfig_rch create_config(const OPENDDS_STRING& name);
00063 TransportConfig_rch get_config(const OPENDDS_STRING& name) const;
00064 void remove_config(const TransportConfig_rch& cfg);
00065
00066 TransportConfig_rch global_config() const;
00067 void global_config(const TransportConfig_rch& cfg);
00068
00069 void domain_default_config(DDS::DomainId_t domain,
00070 const TransportConfig_rch& cfg);
00071 TransportConfig_rch domain_default_config(DDS::DomainId_t domain) const;
00072
00073 void bind_config(const OPENDDS_STRING& name, DDS::Entity_ptr entity);
00074 void bind_config(const TransportConfig_rch& cfg, DDS::Entity_ptr entity);
00075
00076
00077
00078
00079
00080 void register_type(const TransportType_rch& type);
00081
00082
00083
00084
00085
00086
00087
00088 int load_transport_configuration(const OPENDDS_STRING& file_name,
00089 ACE_Configuration_Heap& cf);
00090
00091
00092
00093
00094 TransportConfig_rch fix_empty_default();
00095
00096
00097
00098 void load_transport_lib(const OPENDDS_STRING& transport_type);
00099
00100 private:
00101 friend class ACE_Singleton<TransportRegistry, ACE_Recursive_Thread_Mutex>;
00102
00103 TransportRegistry();
00104 ~TransportRegistry();
00105
00106 typedef OPENDDS_MAP(OPENDDS_STRING, TransportType_rch) TypeMap;
00107 typedef OPENDDS_MAP(OPENDDS_STRING, TransportConfig_rch) ConfigMap;
00108 typedef OPENDDS_MAP(OPENDDS_STRING, TransportInst_rch) InstMap;
00109 typedef OPENDDS_MAP(OPENDDS_STRING, OPENDDS_STRING) LibDirectiveMap;
00110 typedef OPENDDS_MAP(DDS::DomainId_t, TransportConfig_rch) DomainConfigMap;
00111
00112 typedef ACE_SYNCH_MUTEX LockType;
00113 typedef ACE_Guard<LockType> GuardType;
00114
00115 TypeMap type_map_;
00116 ConfigMap config_map_;
00117 InstMap inst_map_;
00118 LibDirectiveMap lib_directive_map_;
00119 DomainConfigMap domain_default_config_map_;
00120
00121 TransportConfig_rch global_config_;
00122
00123 mutable LockType lock_;
00124 };
00125
00126 }
00127 }
00128
00129 #if defined (__ACE_INLINE__)
00130 #include "TransportRegistry.inl"
00131 #endif
00132
00133 #endif