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
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
00037 class DCPS_IR_Topic_Description;
00038 typedef std::set<DCPS_IR_Topic_Description*> DCPS_IR_Topic_Description_Set;
00039
00040 class DCPS_IR_Participant;
00041 typedef ACE_Unbounded_Set<DCPS_IR_Participant*> DCPS_IR_Participant_Set;
00042
00043 typedef std::map<OpenDDS::DCPS::RepoId, DCPS_IR_Participant*,
00044 OpenDDS::DCPS::GUID_tKeyLessThan> DCPS_IR_Participant_Map;
00045
00046 class DCPS_IR_Topic;
00047 class DCPS_IR_Subscription;
00048 class DCPS_IR_Publication;
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 class OpenDDS_InfoRepoLib_Export DCPS_IR_Domain {
00060 public:
00061 DCPS_IR_Domain(DDS::DomainId_t id, RepoIdGenerator& generator);
00062
00063 ~DCPS_IR_Domain();
00064
00065
00066
00067
00068 int add_participant(DCPS_IR_Participant* participant);
00069
00070
00071
00072
00073
00074
00075
00076 int remove_participant(const OpenDDS::DCPS::RepoId& particpantId,
00077 CORBA::Boolean notify_lost);
00078
00079
00080 DCPS_IR_Participant* participant(const OpenDDS::DCPS::RepoId& id) const;
00081
00082
00083
00084 OpenDDS::DCPS::TopicStatus add_topic(OpenDDS::DCPS::RepoId_out topicId,
00085 const char * topicName,
00086 const char * dataTypeName,
00087 const DDS::TopicQos & qos,
00088 DCPS_IR_Participant* participantPtr);
00089
00090 OpenDDS::DCPS::TopicStatus force_add_topic(const OpenDDS::DCPS::RepoId& topicId,
00091 const char* topicName,
00092 const char* dataTypeName,
00093 const DDS::TopicQos & qos,
00094 DCPS_IR_Participant* participantPtr);
00095
00096
00097
00098
00099 OpenDDS::DCPS::TopicStatus find_topic(const char * topicName,
00100 DCPS_IR_Topic*& topic);
00101
00102
00103 DCPS_IR_Topic* find_topic(const OpenDDS::DCPS::RepoId& id);
00104
00105
00106
00107
00108 OpenDDS::DCPS::TopicStatus remove_topic(DCPS_IR_Participant* part,
00109 DCPS_IR_Topic*& topic);
00110
00111
00112
00113
00114 void remove_topic_id_mapping(const OpenDDS::DCPS::RepoId& topicId);
00115
00116
00117
00118
00119 void add_dead_participant(DCPS_IR_Participant* participant);
00120
00121
00122 void remove_dead_participants();
00123
00124 DDS::DomainId_t get_id();
00125
00126
00127 OpenDDS::DCPS::RepoId get_next_participant_id();
00128
00129
00130 void last_participant_key(long key);
00131
00132
00133
00134
00135 int init_built_in_topics(bool federated = false);
00136
00137
00138 int cleanup_built_in_topics();
00139
00140
00141
00142
00143
00144 int reassociate_built_in_topic_pubs();
00145
00146
00147 void publish_participant_bit(DCPS_IR_Participant* participant);
00148 void publish_topic_bit(DCPS_IR_Topic* topic);
00149 void publish_subscription_bit(DCPS_IR_Subscription* subscription);
00150 void publish_publication_bit(DCPS_IR_Publication* publication);
00151
00152
00153 void dispose_participant_bit(DCPS_IR_Participant* participant);
00154 void dispose_topic_bit(DCPS_IR_Topic* topic);
00155 void dispose_subscription_bit(DCPS_IR_Subscription* subscription);
00156 void dispose_publication_bit(DCPS_IR_Publication* publication);
00157
00158
00159 const DCPS_IR_Participant_Map& participants() const;
00160
00161 std::string dump_to_string(const std::string& prefix, int depth) const;
00162
00163 private:
00164 OpenDDS::DCPS::TopicStatus add_topic_i(OpenDDS::DCPS::RepoId& topicId,
00165 const char * topicName,
00166 const char * dataTypeName,
00167 const DDS::TopicQos & qos,
00168 DCPS_IR_Participant* participantPtr);
00169
00170
00171
00172
00173
00174
00175 int add_topic_description(DCPS_IR_Topic_Description*& desc);
00176
00177
00178
00179
00180
00181 int find_topic_description(const char* name,
00182 const char* dataTypeName,
00183 DCPS_IR_Topic_Description*& desc);
00184
00185
00186
00187
00188 int remove_topic_description(DCPS_IR_Topic_Description*& desc);
00189
00190
00191
00192
00193 int init_built_in_topics_topics();
00194 int init_built_in_topics_datawriters(bool federated);
00195 int init_built_in_topics_transport();
00196
00197 DDS::DomainId_t id_;
00198
00199
00200
00201 RepoIdGenerator& participantIdGenerator_;
00202
00203
00204 DCPS_IR_Participant_Map participants_;
00205
00206
00207
00208 DCPS_IR_Participant_Set deadParticipants_;
00209
00210
00211 DCPS_IR_Topic_Description_Set topicDescriptions_;
00212
00213
00214 typedef std::map<OpenDDS::DCPS::RepoId, DCPS_IR_Topic*,
00215 OpenDDS::DCPS::GUID_tKeyLessThan> IdToTopicMap;
00216
00217
00218 IdToTopicMap idToTopicMap_;
00219
00220
00221 bool useBIT_;
00222
00223
00224 DDS::DomainParticipantFactory_var bitParticipantFactory_;
00225 DDS::DomainParticipant_var bitParticipant_;
00226 DDS::DomainParticipantListener_var bitParticipantListener_;
00227 DDS::Publisher_var bitPublisher_;
00228
00229 #if !defined (DDS_HAS_MINIMUM_BIT)
00230 OpenDDS::DCPS::TransportConfig_rch transportConfig_;
00231
00232 DDS::Topic_var bitParticipantTopic_;
00233 DDS::ParticipantBuiltinTopicDataDataWriter_var bitParticipantDataWriter_;
00234
00235 DDS::Topic_var bitTopicTopic_;
00236 DDS::TopicBuiltinTopicDataDataWriter_var bitTopicDataWriter_;
00237
00238 DDS::Topic_var bitSubscriptionTopic_;
00239 DDS::SubscriptionBuiltinTopicDataDataWriter_var bitSubscriptionDataWriter_;
00240
00241 DDS::Topic_var bitPublicationTopic_;
00242 DDS::PublicationBuiltinTopicDataDataWriter_var bitPublicationDataWriter_;
00243 #endif // !defined (DDS_HAS_MINIMUM_BIT)
00244 };
00245
00246 #endif