TransportRegistry.h
Go to the documentation of this file.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 "dds/DCPS/PoolAllocator.h"
00021 #include "ace/Synch_Traits.h"
00022
00023 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00024 class ACE_Configuration_Heap;
00025 ACE_END_VERSIONED_NAMESPACE_DECL
00026
00027 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00028
00029 namespace DDS {
00030 class Entity;
00031 typedef Entity* Entity_ptr;
00032 }
00033
00034 #define TheTransportRegistry OpenDDS::DCPS::TransportRegistry::instance()
00035
00036 namespace OpenDDS {
00037 namespace DCPS {
00038
00039
00040
00041
00042
00043 class OpenDDS_Dcps_Export TransportRegistry {
00044 public:
00045
00046
00047 static TransportRegistry* instance();
00048
00049
00050 static void close();
00051
00052
00053
00054
00055
00056 void release();
00057
00058 TransportInst_rch create_inst(const OPENDDS_STRING& name,
00059 const OPENDDS_STRING& transport_type);
00060 TransportInst_rch get_inst(const OPENDDS_STRING& name) const;
00061 void remove_inst(const TransportInst_rch& inst);
00062
00063 static const char DEFAULT_CONFIG_NAME[];
00064 static const char DEFAULT_INST_PREFIX[];
00065
00066 TransportConfig_rch create_config(const OPENDDS_STRING& name);
00067 TransportConfig_rch get_config(const OPENDDS_STRING& name) const;
00068 void remove_config(const TransportConfig_rch& cfg);
00069
00070 TransportConfig_rch global_config() const;
00071 void global_config(const TransportConfig_rch& cfg);
00072
00073 void domain_default_config(DDS::DomainId_t domain,
00074 const TransportConfig_rch& cfg);
00075 TransportConfig_rch domain_default_config(DDS::DomainId_t domain) const;
00076
00077 void bind_config(const OPENDDS_STRING& name, DDS::Entity_ptr entity);
00078 void bind_config(const TransportConfig_rch& cfg, DDS::Entity_ptr entity);
00079
00080
00081
00082
00083
00084 void register_type(const TransportType_rch& type);
00085
00086
00087
00088
00089
00090
00091
00092 int load_transport_configuration(const OPENDDS_STRING& file_name,
00093 ACE_Configuration_Heap& cf);
00094
00095
00096
00097
00098 TransportConfig_rch fix_empty_default();
00099
00100
00101
00102 void load_transport_lib(const OPENDDS_STRING& transport_type);
00103
00104 bool released() const;
00105
00106 private:
00107 friend class ACE_Singleton<TransportRegistry, ACE_Recursive_Thread_Mutex>;
00108
00109 TransportRegistry();
00110 ~TransportRegistry();
00111
00112 typedef OPENDDS_MAP(OPENDDS_STRING, TransportType_rch) TypeMap;
00113 typedef OPENDDS_MAP(OPENDDS_STRING, TransportConfig_rch) ConfigMap;
00114 typedef OPENDDS_MAP(OPENDDS_STRING, TransportInst_rch) InstMap;
00115 typedef OPENDDS_MAP(OPENDDS_STRING, OPENDDS_STRING) LibDirectiveMap;
00116 typedef OPENDDS_MAP(DDS::DomainId_t, TransportConfig_rch) DomainConfigMap;
00117
00118 typedef ACE_SYNCH_MUTEX LockType;
00119 typedef ACE_Guard<LockType> GuardType;
00120
00121 TypeMap type_map_;
00122 ConfigMap config_map_;
00123 InstMap inst_map_;
00124 LibDirectiveMap lib_directive_map_;
00125 DomainConfigMap domain_default_config_map_;
00126
00127 TransportConfig_rch global_config_;
00128 bool released_;
00129
00130 mutable LockType lock_;
00131 };
00132
00133 }
00134 }
00135
00136 OPENDDS_END_VERSIONED_NAMESPACE_DECL
00137
00138 #if defined (__ACE_INLINE__)
00139 #include "TransportRegistry.inl"
00140 #endif
00141
00142 #endif