DCPS_IR_Domain.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef DCPS_IR_DOMAIN_H
00009 #define DCPS_IR_DOMAIN_H
00010
00011 #include "inforepo_export.h"
00012 #include "dds/DdsDcpsInfrastructureC.h"
00013 #include "dds/DCPS/InfoRepoDiscovery/InfoS.h"
00014
00015 #include "dds/DCPS/RepoIdGenerator.h"
00016
00017 #include "dds/DdsDcpsDomainC.h"
00018 #include "dds/DdsDcpsInfoUtilsC.h"
00019
00020 #if !defined (DDS_HAS_MINIMUM_BIT)
00021 #include "dds/DdsDcpsCoreTypeSupportImpl.h"
00022 #endif // !defined (DDS_HAS_MINIMUM_BIT)
00023
00024 #include "dds/DCPS/transport/framework/TransportConfig.h"
00025 #include "dds/DCPS/transport/tcp/TcpTransport.h"
00026 #include "dds/DCPS/transport/framework/TransportConfig_rch.h"
00027 #include "ace/Unbounded_Set.h"
00028
00029 #include <set>
00030 #include <map>
00031
00032 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00033 #pragma once
00034 #endif
00035
00036 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00037
00038
00039 class DCPS_IR_Topic_Description;
00040 typedef std::map<std::string,
00041 OpenDDS::DCPS::container_supported_unique_ptr<DCPS_IR_Topic_Description> > DCPS_IR_Topic_Description_Set;
00042
00043 class DCPS_IR_Participant;
00044 typedef OpenDDS::DCPS::RcHandle<DCPS_IR_Participant> DCPS_IR_Participant_rch;
00045 typedef std::set<DCPS_IR_Participant_rch > DCPS_IR_Participant_Set;
00046
00047 typedef std::map<OpenDDS::DCPS::RepoId,
00048 DCPS_IR_Participant_rch ,
00049 OpenDDS::DCPS::GUID_tKeyLessThan> DCPS_IR_Participant_Map;
00050
00051 class DCPS_IR_Topic;
00052 class DCPS_IR_Subscription;
00053 class DCPS_IR_Publication;
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064 class OpenDDS_InfoRepoLib_Export DCPS_IR_Domain
00065 : public OpenDDS::DCPS::EnableContainerSupportedUniquePtr<DCPS_IR_Domain>{
00066 public:
00067 DCPS_IR_Domain(DDS::DomainId_t id, OpenDDS::DCPS::RepoIdGenerator& generator);
00068
00069 ~DCPS_IR_Domain();
00070
00071
00072
00073 int add_participant(DCPS_IR_Participant_rch participant);
00074
00075
00076
00077
00078
00079
00080
00081 int remove_participant(const OpenDDS::DCPS::RepoId& particpantId,
00082 CORBA::Boolean notify_lost);
00083
00084
00085 DCPS_IR_Participant* participant(const OpenDDS::DCPS::RepoId& id) const;
00086
00087
00088
00089
00090 OpenDDS::DCPS::TopicStatus add_topic(OpenDDS::DCPS::RepoId_out topicId,
00091 const char * topicName,
00092 const char * dataTypeName,
00093 const DDS::TopicQos & qos,
00094 DCPS_IR_Participant* participantPtr);
00095
00096 OpenDDS::DCPS::TopicStatus force_add_topic(const OpenDDS::DCPS::RepoId& topicId,
00097 const char* topicName,
00098 const char* dataTypeName,
00099 const DDS::TopicQos & qos,
00100 DCPS_IR_Participant* participantPtr);
00101
00102
00103
00104
00105
00106 OpenDDS::DCPS::TopicStatus find_topic(const char * topicName,
00107 DCPS_IR_Topic*& topic);
00108
00109
00110 DCPS_IR_Topic* find_topic(const OpenDDS::DCPS::RepoId& id);
00111
00112
00113
00114
00115 OpenDDS::DCPS::TopicStatus remove_topic(DCPS_IR_Participant* part,
00116 DCPS_IR_Topic*& topic);
00117
00118
00119
00120
00121 void remove_topic_id_mapping(const OpenDDS::DCPS::RepoId& topicId);
00122
00123
00124
00125
00126 void add_dead_participant(DCPS_IR_Participant_rch participant);
00127
00128
00129 void remove_dead_participants();
00130
00131 DDS::DomainId_t get_id();
00132
00133
00134 OpenDDS::DCPS::RepoId get_next_participant_id();
00135
00136
00137 void last_participant_key(long key);
00138
00139
00140
00141
00142 int init_built_in_topics(bool federated, bool persistent);
00143
00144
00145 int cleanup_built_in_topics();
00146
00147
00148
00149
00150
00151 int reassociate_built_in_topic_pubs();
00152
00153
00154 void publish_participant_bit(DCPS_IR_Participant* participant);
00155
00156 void publish_topic_bit(DCPS_IR_Topic* topic);
00157
00158 void publish_subscription_bit(DCPS_IR_Subscription* subscription);
00159
00160 void publish_publication_bit(DCPS_IR_Publication* publication);
00161
00162
00163 void dispose_participant_bit(DCPS_IR_Participant* participant);
00164
00165 void dispose_topic_bit(DCPS_IR_Topic* topic);
00166
00167 void dispose_subscription_bit(DCPS_IR_Subscription* subscription);
00168
00169 void dispose_publication_bit(DCPS_IR_Publication* publication);
00170
00171
00172 const DCPS_IR_Participant_Map& participants() const;
00173
00174 std::string dump_to_string(const std::string& prefix, int depth) const;
00175
00176 bool useBIT() const { return useBIT_; }
00177
00178 private:
00179 OpenDDS::DCPS::TopicStatus add_topic_i(OpenDDS::DCPS::RepoId& topicId,
00180 const char * topicName,
00181 const char * dataTypeName,
00182 const DDS::TopicQos & qos,
00183 DCPS_IR_Participant* participantPtr,
00184 bool isBIT);
00185
00186
00187
00188
00189
00190
00191 int add_topic_description(OpenDDS::DCPS::unique_ptr<DCPS_IR_Topic_Description> desc);
00192
00193
00194
00195
00196
00197 int find_topic_description(const char* name,
00198 const char* dataTypeName,
00199 DCPS_IR_Topic_Description*& desc);
00200
00201
00202 int remove_topic_description(DCPS_IR_Topic_Description* desc);
00203
00204
00205
00206
00207
00208
00209
00210 int init_built_in_topics_topics();
00211 int init_built_in_topics_datawriters(bool federated);
00212 int init_built_in_topics_transport(bool persistent);
00213
00214
00215 DDS::DomainId_t id_;
00216
00217
00218
00219 OpenDDS::DCPS::RepoIdGenerator& participantIdGenerator_;
00220
00221
00222 DCPS_IR_Participant_Map participants_;
00223
00224
00225
00226 DCPS_IR_Participant_Set deadParticipants_;
00227
00228
00229 DCPS_IR_Topic_Description_Set topicDescriptions_;
00230
00231
00232 typedef std::map<OpenDDS::DCPS::RepoId,
00233 OpenDDS::DCPS::container_supported_unique_ptr<DCPS_IR_Topic>,
00234 OpenDDS::DCPS::GUID_tKeyLessThan> IdToTopicMap;
00235
00236
00237 IdToTopicMap idToTopicMap_;
00238
00239
00240 bool useBIT_;
00241
00242
00243
00244 DDS::DomainParticipantFactory_var bitParticipantFactory_;
00245 DDS::DomainParticipant_var bitParticipant_;
00246 DDS::DomainParticipantListener_var bitParticipantListener_;
00247 DDS::Publisher_var bitPublisher_;
00248
00249 #if !defined (DDS_HAS_MINIMUM_BIT)
00250 OpenDDS::DCPS::TransportConfig_rch transportConfig_;
00251
00252 DDS::Topic_var bitParticipantTopic_;
00253 DDS::ParticipantBuiltinTopicDataDataWriter_var bitParticipantDataWriter_;
00254
00255 DDS::Topic_var bitTopicTopic_;
00256 DDS::TopicBuiltinTopicDataDataWriter_var bitTopicDataWriter_;
00257
00258 DDS::Topic_var bitSubscriptionTopic_;
00259 DDS::SubscriptionBuiltinTopicDataDataWriter_var bitSubscriptionDataWriter_;
00260
00261 DDS::Topic_var bitPublicationTopic_;
00262 DDS::PublicationBuiltinTopicDataDataWriter_var bitPublicationDataWriter_;
00263 #endif // !defined (DDS_HAS_MINIMUM_BIT)
00264
00265
00266
00267
00268 DCPS_IR_Domain(const DCPS_IR_Domain&);
00269 };
00270
00271 OPENDDS_END_VERSIONED_NAMESPACE_DECL
00272
00273 #endif