9 #include "DCPS_IR_Participant.h"
13 #include "DCPS_IR_Domain.h"
14 #include "DCPS_IR_Subscription.h"
15 #include "DCPS_IR_Publication.h"
16 #include "DCPS_IR_Topic.h"
17 #include "DCPS_IR_Topic_Description.h"
19 #include "dds/DCPS/RepoIdConverter.h"
22 #include "tao/debug.h"
37 federationId_(federationId),
38 owner_(federationId.overridden() ? OWNER_NONE : federationId.id()),
41 OpenDDS::DCPS::RepoIdConverter(id).participantId(),
43 publicationIdGenerator_(
45 OpenDDS::DCPS::RepoIdConverter(id).participantId(),
47 subscriptionIdGenerator_(
49 OpenDDS::DCPS::RepoIdConverter(id).participantId(),
52 isBitPublisher_(isBit)
92 ACE_TEXT(
"(%P|%t) DCPS_IR_Participant::take_ownership: ")
93 ACE_TEXT(
"pushing ownership %C in domain %d.\n"),
94 std::string(converter).c_str(),
153 DCPS_IR_Publication_Map::iterator where = this->
publications_.find(pubId);
168 ACE_TEXT(
"(%P|%t) DCPS_IR_Participant::add_publication: ")
169 ACE_TEXT(
"participant %C successfully added publication %C at 0x%x.\n"),
170 std::string(part_converter).c_str(),
171 std::string(pub_converter).c_str(),
182 ACE_TEXT(
"(%P|%t) NOTICE: DCPS_IR_Participant::add_publication: ")
183 ACE_TEXT(
"participant %C attempted to add existing publication %C.\n"),
184 std::string(part_converter).c_str(),
185 std::string(pub_converter).c_str()));
195 DCPS_IR_Publication_Map::iterator where = this->
publications_.find(pubId);
198 pub = where->second.get();
204 ACE_TEXT(
"(%P|%t) DCPS_IR_Participant::find_publication_reference: ")
205 ACE_TEXT(
"participant %C found publication %C at 0x%x.\n"),
206 std::string(part_converter).c_str(),
207 std::string(pub_converter).c_str(),
218 ACE_TEXT(
"(%P|%t) DCPS_IR_Participant::find_publication_reference: ")
219 ACE_TEXT(
"participant %C could not find publication %C.\n"),
220 std::string(part_converter).c_str(),
221 std::string(pub_converter).c_str()));
230 DCPS_IR_Publication_Map::iterator where = this->
publications_.find(pubId);
236 if (0 != where->second->remove_associations(
false)) {
241 ACE_TEXT(
"(%P|%t) ERROR: DCPS_IR_Participant::remove_publication: ")
242 ACE_TEXT(
"participant %C unable to remove associations from publication %C\n"),
243 std::string(part_converter).c_str(),
244 std::string(pub_converter).c_str()));
256 ACE_TEXT(
"(%P|%t) DCPS_IR_Participant::remove_publication: ")
257 ACE_TEXT(
"participant %C removed publication %C.\n"),
258 std::string(part_converter).c_str(),
259 std::string(pub_converter).c_str()));
268 ACE_TEXT(
"(%P|%t) ERROR: DCPS_IR_Participant::remove_publication: ")
269 ACE_TEXT(
"participant %C unable to remove publication %C.\n"),
270 std::string(part_converter).c_str(),
271 std::string(pub_converter).c_str()));
279 DCPS_IR_Subscription_Map::iterator where = this->
subscriptions_.find(subId);
295 ACE_TEXT(
"(%P|%t) DCPS_IR_Participant::add_subscription: ")
296 ACE_TEXT(
"participant %C successfully added subscription %C at 0x%x.\n"),
297 std::string(part_converter).c_str(),
298 std::string(sub_converter).c_str(),
309 ACE_TEXT(
"(%P|%t) NOTICE: DCPS_IR_Participant::add_subscription: ")
310 ACE_TEXT(
"participant %C attempted to add existing subscription %C.\n"),
311 std::string(part_converter).c_str(),
312 std::string(sub_converter).c_str()));
322 DCPS_IR_Subscription_Map::iterator where = this->
subscriptions_.find(subId);
325 sub = where->second.get();
331 ACE_TEXT(
"(%P|%t) DCPS_IR_Participant::find_subscription_reference: ")
332 ACE_TEXT(
"participant %C found subscription %C at 0x%x.\n"),
333 std::string(part_converter).c_str(),
334 std::string(sub_converter).c_str(),
345 ACE_TEXT(
"(%P|%t) DCPS_IR_Participant::find_subscription_reference: ")
346 ACE_TEXT(
"participant %C could not find subscription %C.\n"),
347 std::string(part_converter).c_str(),
348 std::string(sub_converter).c_str()));
357 DCPS_IR_Subscription_Map::iterator where = this->
subscriptions_.find(subId);
363 if (0 != where->second->remove_associations(
false)) {
368 ACE_TEXT(
"(%P|%t) ERROR: DCPS_IR_Participant::remove_subscription: ")
369 ACE_TEXT(
"participant %C unable to remove associations from subscription %C\n"),
370 std::string(part_converter).c_str(),
371 std::string(sub_converter).c_str()));
383 ACE_TEXT(
"(%P|%t) DCPS_IR_Participant::remove_subscription: ")
384 ACE_TEXT(
"participant %C removed subscription %C.\n"),
385 std::string(part_converter).c_str(),
386 std::string(sub_converter).c_str()));
395 ACE_TEXT(
"(%P|%t) ERROR: DCPS_IR_Participant::remove_subscription: ")
396 ACE_TEXT(
"participant %C unable to remove subscription %C.\n"),
397 std::string(part_converter).c_str(),
398 std::string(sub_converter).c_str()));
406 DCPS_IR_Topic_Map::iterator where = this->
topicRefs_.find(topicId);
410 where, DCPS_IR_Topic_Map::value_type(topicId, topic));
420 ACE_TEXT(
"(%P|%t) DCPS_IR_Participant::add_topic_reference: ")
421 ACE_TEXT(
"participant %C successfully added topic %C at 0x%x.\n"),
422 std::string(part_converter).c_str(),
423 std::string(topic_converter).c_str(),
434 ACE_TEXT(
"(%P|%t) NOTICE: DCPS_IR_Participant::add_topic_reference: ")
435 ACE_TEXT(
"participant %C attempted to add existing topic %C.\n"),
436 std::string(part_converter).c_str(),
437 std::string(topic_converter).c_str()));
447 DCPS_IR_Topic_Map::iterator where = this->
topicRefs_.find(topicId);
450 topic = where->second;
457 ACE_TEXT(
"(%P|%t) DCPS_IR_Participant::remove_topic_reference: ")
458 ACE_TEXT(
"participant %C removed topic %C at 0x%x.\n"),
459 std::string(part_converter).c_str(),
460 std::string(topic_converter).c_str(),
471 ACE_TEXT(
"(%P|%t) WARNING: DCPS_IR_Participant::remove_topic_reference: ")
472 ACE_TEXT(
"participant %C unable to find topic %C for removal.\n"),
473 std::string(part_converter).c_str(),
474 std::string(topic_converter).c_str()));
484 DCPS_IR_Topic_Map::iterator where = this->
topicRefs_.find(topicId);
487 topic = where->second;
493 ACE_TEXT(
"(%P|%t) DCPS_IR_Participant::find_topic_reference: ")
494 ACE_TEXT(
"participant %C found topic %C at %x.\n"),
495 std::string(part_converter).c_str(),
496 std::string(topic_converter).c_str(),
506 ACE_TEXT(
"(%P|%t) ERROR: DCPS_IR_Participant::find_topic_reference: ")
507 ACE_TEXT(
"participant %C unable to find topic %C.\n"),
508 std::string(part_converter).c_str(),
509 std::string(topic_converter).c_str()));
519 DCPS_IR_Publication_Map::const_iterator next = this->
publications_.begin();
522 DCPS_IR_Publication_Map::const_iterator current = next;
527 if (0 != current->second->remove_associations(notify_lost)) {
536 DCPS_IR_Subscription_Map::const_iterator next = this->
subscriptions_.begin();
539 DCPS_IR_Subscription_Map::const_iterator current = next;
544 if (0 != current->second->remove_associations(notify_lost)) {
553 DCPS_IR_Topic_Map::const_iterator next = this->
topicRefs_.begin();
556 DCPS_IR_Topic_Map::const_iterator current = next;
564 current->second->get_id());
571 ACE_TEXT(
"(%P|%t) DCPS_IR_Participant::remove_all_dependents: ")
572 ACE_TEXT(
"pushing deletion of topic %C in domain %d.\n"),
573 std::string(converter).c_str(),
592 ACE_TEXT(
"(%P|%t) DCPS_IR_Participant::remove_all_dependents: ")
593 ACE_TEXT(
"domain %d participant %C removed topic %C.\n"),
595 std::string(part_converter).c_str(),
596 std::string(topic_converter).c_str()));
611 for (DCPS_IR_Publication_Map::const_iterator current = this->
publications_.begin();
619 current->second->get_id());
626 ACE_TEXT(
"(%P|%t) DCPS_IR_Participant::remove_all_dependents: ")
627 ACE_TEXT(
"pushing deletion of publication %C in domain %d.\n"),
628 std::string(converter).c_str(),
638 for (DCPS_IR_Subscription_Map::const_iterator current
647 current->second->get_id());
654 ACE_TEXT(
"(%P|%t) DCPS_IR_Participant::remove_all_dependents: ")
655 ACE_TEXT(
"pushing deletion of subscription %C in domain %d.\n"),
656 std::string(converter).c_str(),
693 ACE_TEXT(
"(%P|%t) DCPS_IR_Participant::ignore_participant: ")
694 ACE_TEXT(
"participant %C now ignoring participant %C.\n"),
695 std::string(part_converter).c_str(),
696 std::string(ignore_converter).c_str()));
702 for (DCPS_IR_Publication_Map::const_iterator current = this->
publications_.begin();
705 current->second->disassociate_participant(
id);
709 for (DCPS_IR_Subscription_Map::const_iterator current = this->
subscriptions_.begin();
712 current->second->disassociate_participant(
id);
722 ACE_TEXT(
"(%P|%t) DCPS_IR_Participant::ignore_topic: ")
723 ACE_TEXT(
"participant %C now ignoring topic %C.\n"),
724 std::string(part_converter).c_str(),
725 std::string(ignore_converter).c_str()));
731 for (DCPS_IR_Publication_Map::const_iterator current = this->
publications_.begin();
734 current->second->disassociate_topic(
id);
738 for (DCPS_IR_Subscription_Map::const_iterator current = this->
subscriptions_.begin();
741 current->second->disassociate_topic(
id);
751 ACE_TEXT(
"(%P|%t) DCPS_IR_Participant::ignore_publication: ")
752 ACE_TEXT(
"participant %C now ignoring publication %C.\n"),
753 std::string(part_converter).c_str(),
754 std::string(ignore_converter).c_str()));
760 for (DCPS_IR_Subscription_Map::const_iterator current = this->
subscriptions_.begin();
763 current->second->disassociate_publication(
id);
773 ACE_TEXT(
"(%P|%t) DCPS_IR_Participant::ignore_subscription: ")
774 ACE_TEXT(
"participant %C now ignoring subscription %C.\n"),
775 std::string(part_converter).c_str(),
776 std::string(ignore_converter).c_str()));
782 for (DCPS_IR_Publication_Map::const_iterator current = this->
publications_.begin();
785 current->second->disassociate_subscription(
id);
883 #if !defined (OPENDDS_INFOREPO_REDUCED_FOOTPRINT) 886 for (
int i=0; i < depth; i++)
888 std::string indent = str + prefix;
889 str +=
"DCPS_IR_Participant[";
890 str += std::string(local_converter);
894 std::ostringstream os;
899 os <<
"] owner[" <<
owner_ <<
"]";
904 str += indent +
"Topics:\n";
905 for (DCPS_IR_Topic_Map::const_iterator tm =
topicRefs_.begin();
909 str += tm->second->dump_to_string(prefix, depth+1);
912 str += indent +
"Publications:\n";
913 for (DCPS_IR_Publication_Map::const_iterator pm =
publications_.begin();
917 str += pm->second->dump_to_string(prefix, depth+1);
920 str += indent +
"Subscriptions:\n";
921 for (DCPS_IR_Subscription_Map::const_iterator sm =
subscriptions_.begin();
925 str += sm->second->dump_to_string(prefix, depth+1);
928 str += indent +
"ignored Participants [ ";
934 str += std::string(ipart_converter);
938 str += indent +
"ignored Topics [ ";
945 str += std::string(itop_converter);
949 str += indent +
"ignored Publications [ ";
956 str += std::string(ipub_converter);
960 str += indent +
"ignored Subscriptions [ ";
967 str += std::string(isub_converter);
972 #endif // !defined (OPENDDS_INFOREPO_REDUCED_FOOTPRINT) TAO_DDS_RepoId_Set ignoredPublications_
RcHandle< T > rchandle_from(T *pointer)
int find_topic_reference(OpenDDS::DCPS::GUID_t topicId, DCPS_IR_Topic *&topic)
#define ACE_GUARD(MUTEX, OBJ, LOCK)
void set_bit_status(CORBA::Boolean isBIT)
CORBA::Boolean is_subscription_ignored(OpenDDS::DCPS::GUID_t id)
int add_subscription(OpenDDS::DCPS::unique_ptr< DCPS_IR_Subscription > sub)
OpenDDS::DCPS::GUID_t get_id()
Conversion processing and value testing utilities for DCPS Information Repository identifiers...
OpenDDS::DCPS::RepoIdGenerator publicationIdGenerator_
DDS::DomainParticipantQos qos_
OpenDDS::DCPS::GUID_t get_id() const
ENTITYKIND_BUILTIN_WRITER_WITH_KEY and ENTITYKIND_USER_WRITER_NO_KEY.
const DDS::DomainParticipantQos * get_qos()
const DCPS_IR_Topic_Map & topics() const
Expose a readable reference to the topic map.
void destroy(const IdPath &id, ItemType type, ActorType actor=DataWriter)
virtual ~DCPS_IR_Participant()
void set_bit_status(CORBA::Boolean isBIT)
OpenDDS::DCPS::GUID_t get_next_publication_id(bool builtin)
int remove_publication_reference(DCPS_IR_Publication *publication)
void ignore_participant(OpenDDS::DCPS::GUID_t id)
Ignore the participant with the id.
OpenDDS::DCPS::GUID_t get_next_topic_id(bool builtin)
OpenDDS::DCPS::GUID_t get_next_subscription_id(bool builtin)
T::rv_reference move(T &p)
int remove_subscription(OpenDDS::DCPS::GUID_t subId)
ENTITYKIND_USER_WRITER_WITH_KEY and ENTITYKIND_USER_WRITER_NO_KEY.
bool set_qos(const DDS::DomainParticipantQos &qos)
void create(const UType &info)
void ignore_publication(OpenDDS::DCPS::GUID_t id)
Ignore the publication with the id.
ENTITYKIND_BUILTIN_TOPIC.
OpenDDS::DCPS::GUID_t id_
CORBA::Boolean aliveStatus_
void last_topic_key(long key)
std::map< OpenDDS::DCPS::GUID_t, OpenDDS::DCPS::container_supported_unique_ptr< DCPS_IR_Publication >, OpenDDS::DCPS::GUID_tKeyLessThan > DCPS_IR_Publication_Map
OpenDDS::DCPS::TopicStatus remove_topic(DCPS_IR_Participant *part, DCPS_IR_Topic *&topic)
const DCPS_IR_Publication_Map & publications() const
Expose a readable reference to the publication map.
DCPS_IR_Topic_Map topicRefs_
DCPS_IR_Subscription_Map subscriptions_
ENTITYKIND_OPENDDS_TOPIC.
CORBA::Boolean is_participant_ignored(OpenDDS::DCPS::GUID_t id)
void changeOwner(long sender, long owner)
Process an incoming update that changes ownership.
ENTITYKIND_USER_READER_WITH_KEY and ENTITYKIND_USER_READER_NO_KEY.
const TAO_DDS_DCPSFederationId & federationId_
TAO_DDS_RepoId_Set ignoredSubscriptions_
ACE_SYNCH_MUTEX ownerLock_
Lock portions ownership processing.
DCPS_IR_Publication_Map publications_
TAO_DDS_RepoId_Set ignoredParticipants_
long owner() const
Value of the owner for this participant.
int insert(const T &new_item)
Representative of a Topic.
CORBA::Boolean is_publication_ignored(OpenDDS::DCPS::GUID_t id)
DDS::InstanceHandle_t get_handle()
void set_handle(DDS::InstanceHandle_t handle)
DDS::InstanceHandle_t handle_
int remove_topic_reference(OpenDDS::DCPS::GUID_t topicId, DCPS_IR_Topic *&topic)
bool isBitPublisher_
Flag indicating this participant publishes built-in topics.
OpenDDS::DCPS::GUID_t get_id()
GUID_t next(bool builtin=false)
Obtain the next GUID_t value.
HANDLE_TYPE_NATIVE InstanceHandle_t
CORBA::Boolean is_topic_ignored(OpenDDS::DCPS::GUID_t id)
int find_publication_reference(OpenDDS::DCPS::GUID_t pubId, DCPS_IR_Publication *&pub)
Return the publication object.
void add_dead_participant(DCPS_IR_Participant_rch participant)
std::string dump_to_string(const std::string &prefix, int depth) const
std::map< OpenDDS::DCPS::GUID_t, DCPS_IR_Topic *, OpenDDS::DCPS::GUID_tKeyLessThan > DCPS_IR_Topic_Map
void publish_participant_bit(DCPS_IR_Participant *participant)
Publish Participant in the Participant Built-In Topic.
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
OpenDDS::DCPS::GUID_t get_id()
void set_bit_status(CORBA::Boolean isBIT)
TAO_DDS_RepoId_Set ignoredTopics_
void ignore_subscription(OpenDDS::DCPS::GUID_t id)
Ignore the subscription with the id.
int remove_publication(OpenDDS::DCPS::GUID_t pubId)
OpenDDS::DCPS::RepoIdGenerator topicIdGenerator_
int find(const T &item) const
bool isOwner() const
Indication of whether the current repository is the owner of this participant.
void set_alive(CORBA::Boolean alive)
std::map< OpenDDS::DCPS::GUID_t, OpenDDS::DCPS::container_supported_unique_ptr< DCPS_IR_Subscription >, OpenDDS::DCPS::GUID_tKeyLessThan > DCPS_IR_Subscription_Map
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
Representative of a Subscription.
void dispose_subscription_bit(DCPS_IR_Subscription *subscription)
Dispose Subscription in the Subscription Built-In Topic.
int add_publication(OpenDDS::DCPS::unique_ptr< DCPS_IR_Publication > pub)
Representation of a Domain in the system.
DCPS_IR_Domain * get_domain_reference() const
int add_topic_reference(DCPS_IR_Topic *topic)
DCPS_IR_Participant(const TAO_DDS_DCPSFederationId &federationId, OpenDDS::DCPS::GUID_t id, DCPS_IR_Domain *domain, DDS::DomainParticipantQos qos, Update::Manager *um, bool isBit)
int find_subscription_reference(OpenDDS::DCPS::GUID_t subId, DCPS_IR_Subscription *&sub)
Return the subscription object.
CORBA::Boolean is_alive()
void dispose_publication_bit(DCPS_IR_Publication *publication)
Dispose Publication in the Publication Built-In Topic.
void last_subscription_key(long key)
OpenDDS::DCPS::RepoIdGenerator subscriptionIdGenerator_
void ignore_topic(OpenDDS::DCPS::GUID_t id)
Ignore the topic with the id.
int remove_subscription_reference(DCPS_IR_Subscription *subscription)
The Internal API and Implementation of OpenDDS.
ENTITYKIND_BUILTIN_READER_WITH_KEY and ENTITYKIND_USER_READER_NO_KEY.
void takeOwnership()
Take local ownership of this participant and publish an update.
const DCPS_IR_Subscription_Map & subscriptions() const
Expose a readable reference to the subscription map.
Representative of a Publication.
void remove_all_dependents(CORBA::Boolean notify_lost)
Removes all topics, publications and.
void release(bool removing)
void last_publication_key(long key)