00001
00002
00003
00004
00005
00006
00007
00008 #ifndef DCPS_IR_PARTICIPANT_H
00009 #define DCPS_IR_PARTICIPANT_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 #include "dds/DCPS/GuidUtils.h"
00017
00018 #include "ace/Map_Manager.h"
00019
00020 #include "DCPS_IR_Subscription.h"
00021 #include "DCPS_IR_Publication.h"
00022 #include "DCPS_IR_Topic.h"
00023
00024 #include <map>
00025
00026 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00027 #pragma once
00028 #endif
00029
00030
00031 class DCPS_IR_Domain;
00032 class TAO_DDS_DCPSFederationId;
00033
00034 namespace Update {
00035
00036 class Manager;
00037
00038 }
00039
00040 typedef std::map<OpenDDS::DCPS::RepoId, DCPS_IR_Subscription*,
00041 OpenDDS::DCPS::GUID_tKeyLessThan> DCPS_IR_Subscription_Map;
00042 typedef std::map<OpenDDS::DCPS::RepoId, DCPS_IR_Publication*,
00043 OpenDDS::DCPS::GUID_tKeyLessThan> DCPS_IR_Publication_Map;
00044 typedef std::map<OpenDDS::DCPS::RepoId, DCPS_IR_Topic*,
00045 OpenDDS::DCPS::GUID_tKeyLessThan> DCPS_IR_Topic_Map;
00046
00047 typedef ACE_Unbounded_Set<OpenDDS::DCPS::RepoId> TAO_DDS_RepoId_Set;
00048
00049
00050
00051
00052
00053
00054
00055
00056 class OpenDDS_InfoRepoLib_Export DCPS_IR_Participant {
00057 public:
00058
00059 enum { OWNER_NONE};
00060
00061 DCPS_IR_Participant(const TAO_DDS_DCPSFederationId& federationId,
00062 OpenDDS::DCPS::RepoId id,
00063 DCPS_IR_Domain* domain,
00064 DDS::DomainParticipantQos qos,
00065 Update::Manager* um);
00066
00067 virtual ~DCPS_IR_Participant();
00068
00069
00070 void takeOwnership();
00071
00072
00073 void changeOwner(long sender, long owner);
00074
00075
00076 long owner() const;
00077
00078
00079 bool isOwner() const;
00080
00081
00082 bool& isBitPublisher();
00083 bool isBitPublisher() const;
00084
00085
00086
00087
00088 int add_publication(DCPS_IR_Publication* pub);
00089
00090
00091 int find_publication_reference(OpenDDS::DCPS::RepoId pubId,
00092 DCPS_IR_Publication*& pub);
00093
00094
00095
00096
00097 int remove_publication(OpenDDS::DCPS::RepoId pubId);
00098
00099
00100
00101
00102 int add_subscription(DCPS_IR_Subscription* sub);
00103
00104
00105 int find_subscription_reference(OpenDDS::DCPS::RepoId subId,
00106 DCPS_IR_Subscription*& sub);
00107
00108
00109
00110
00111 int remove_subscription(OpenDDS::DCPS::RepoId subId);
00112
00113
00114
00115 int add_topic_reference(DCPS_IR_Topic* topic);
00116
00117
00118
00119
00120 int remove_topic_reference(OpenDDS::DCPS::RepoId topicId,
00121 DCPS_IR_Topic*& topic);
00122
00123
00124
00125
00126 int find_topic_reference(OpenDDS::DCPS::RepoId topicId,
00127 DCPS_IR_Topic*& topic);
00128
00129
00130
00131 void remove_all_dependents(CORBA::Boolean notify_lost);
00132
00133
00134
00135
00136
00137
00138 void mark_dead();
00139
00140 OpenDDS::DCPS::RepoId get_id();
00141
00142 CORBA::Boolean is_alive();
00143 void set_alive(CORBA::Boolean alive);
00144
00145
00146 void ignore_participant(OpenDDS::DCPS::RepoId id);
00147
00148 void ignore_topic(OpenDDS::DCPS::RepoId id);
00149
00150 void ignore_publication(OpenDDS::DCPS::RepoId id);
00151
00152 void ignore_subscription(OpenDDS::DCPS::RepoId id);
00153
00154
00155
00156 const DDS::DomainParticipantQos* get_qos();
00157
00158
00159
00160
00161
00162
00163 bool set_qos(const DDS::DomainParticipantQos & qos);
00164
00165 CORBA::Boolean is_participant_ignored(OpenDDS::DCPS::RepoId id);
00166 CORBA::Boolean is_topic_ignored(OpenDDS::DCPS::RepoId id);
00167 CORBA::Boolean is_publication_ignored(OpenDDS::DCPS::RepoId id);
00168 CORBA::Boolean is_subscription_ignored(OpenDDS::DCPS::RepoId id);
00169
00170 DDS::InstanceHandle_t get_handle();
00171 void set_handle(DDS::InstanceHandle_t handle);
00172
00173 CORBA::Boolean is_bit();
00174 void set_bit_status(CORBA::Boolean isBIT);
00175
00176 DCPS_IR_Domain* get_domain_reference() const;
00177
00178
00179 OpenDDS::DCPS::RepoId get_next_topic_id();
00180 OpenDDS::DCPS::RepoId get_next_publication_id();
00181 OpenDDS::DCPS::RepoId get_next_subscription_id();
00182
00183
00184 void last_topic_key(long key);
00185 void last_publication_key(long key);
00186 void last_subscription_key(long key);
00187
00188
00189 const DCPS_IR_Publication_Map& publications() const;
00190
00191
00192 const DCPS_IR_Subscription_Map& subscriptions() const;
00193
00194
00195 const DCPS_IR_Topic_Map& topics() const;
00196
00197 std::string dump_to_string(const std::string& prefix, int depth) const;
00198
00199 private:
00200 OpenDDS::DCPS::RepoId id_;
00201 DCPS_IR_Domain* domain_;
00202 DDS::DomainParticipantQos qos_;
00203 CORBA::Boolean aliveStatus_;
00204 DDS::InstanceHandle_t handle_;
00205 CORBA::Boolean isBIT_;
00206
00207 const TAO_DDS_DCPSFederationId& federationId_;
00208 long owner_;
00209
00210
00211 ACE_SYNCH_MUTEX ownerLock_;
00212
00213
00214 RepoIdGenerator topicIdGenerator_;
00215 RepoIdGenerator publicationIdGenerator_;
00216 RepoIdGenerator subscriptionIdGenerator_;
00217
00218 DCPS_IR_Subscription_Map subscriptions_;
00219 DCPS_IR_Publication_Map publications_;
00220 DCPS_IR_Topic_Map topicRefs_;
00221
00222
00223 TAO_DDS_RepoId_Set ignoredParticipants_;
00224 TAO_DDS_RepoId_Set ignoredTopics_;
00225 TAO_DDS_RepoId_Set ignoredPublications_;
00226 TAO_DDS_RepoId_Set ignoredSubscriptions_;
00227
00228
00229
00230
00231
00232
00233 Update::Manager* um_;
00234
00235
00236 bool isBitPublisher_;
00237 };
00238
00239 #endif