OpenDDS  Snapshot(2023/04/28-20:55)
DCPS_IR_Topic_Description.h
Go to the documentation of this file.
1 /*
2  *
3  *
4  * Distributed under the OpenDDS License.
5  * See: http://www.opendds.org/license.html
6  */
7 
8 #ifndef DCPS_IR_TOPIC_DESCRIPTION_H
9 #define DCPS_IR_TOPIC_DESCRIPTION_H
10 
11 #include "inforepo_export.h"
12 #include /**/ "ace/Unbounded_Set.h"
13 #include /**/ "ace/SString.h"
14 #include /**/ "tao/corbafwd.h"
15 #include "dds/DCPS/unique_ptr.h"
16 
17 #include <string>
18 
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 
24 
26 
27 // forward declarations
29 class DCPS_IR_Domain;
30 
33 
36 
37 /**
38  * @class DCPS_IR_Topic_Description
39  *
40  * @brief Representative of a Topic Description
41  *
42  */
44  : public OpenDDS::DCPS::EnableContainerSupportedUniquePtr<DCPS_IR_Topic_Description> {
45 public:
47  DCPS_IR_Domain* domain,
48  const char* name,
49  const char* dataTypeName);
50 
52 
53  /// Adds the subscription to the list of subscriptions
54  /// Tries to associate with existing publications if successfully added
55  /// 'associate' switch toggles association attempt.
56  /// Returns 0 if added, 1 if already exists, -1 other failure
57  int add_subscription_reference(DCPS_IR_Subscription* subscription
58  , bool associate = true);
59 
60  /// Removes the subscription from the list of subscriptions
61  /// Returns 0 if successful
62  int remove_subscription_reference(DCPS_IR_Subscription* subscription);
63 
64  /// Add a topic
65  /// Takes ownership of memory pointed to by topic
66  /// Returns 0 if added, 1 if already exists, -1 other failure
67  int add_topic(DCPS_IR_Topic* topic);
68 
69  /// Removes the topic from the list of topics
70  /// Gives ownership of the memory pointed to by topic
71  /// to the caller
72  /// Returns 0 if successful
73  int remove_topic(DCPS_IR_Topic* topic);
74 
75  /// Gets the first topic in the topic list
76  DCPS_IR_Topic* get_first_topic();
77 
78  /// Tries to associate the publication will each of
79  /// the subscriptions in the subscription list
80  void try_associate_publication(DCPS_IR_Publication* publication);
81 
82  /// Tries to associate the subscription will each of
83  /// the publications in each topic in the topic list
84  void try_associate_subscription(DCPS_IR_Subscription* subscription);
85 
86  /// Checks to see if the publication and subscription can
87  /// be associated.
88  bool try_associate(DCPS_IR_Publication* publication,
89  DCPS_IR_Subscription* subscription);
90 
91  /// Associate the publication and subscription
92  void associate(DCPS_IR_Publication* publication,
93  DCPS_IR_Subscription* subscription);
94 
95  /// Re-evaluate the association between the provided publication and
96  /// the subscriptions it maintains.
97  void reevaluate_associations(DCPS_IR_Publication* publication);
98 
99  /// Re-evaluate the association between the provided subscription and
100  /// the publications in all its maintained topics.
101  void reevaluate_associations(DCPS_IR_Subscription* subscription);
102 
103  const char* get_name() const ;
104  const char* get_dataTypeName() const;
105 
106  /// Returns the number of topics
107  CORBA::ULong get_number_topics() const;
108 
109  std::string dump_to_string(const std::string& prefix, int depth) const;
110 
111 private:
115 
118 };
119 
121 
122 #endif /* DCPS_IR_TOPIC_DESCRIPTION_H */
ACE_Unbounded_Set< DCPS_IR_Subscription * > DCPS_IR_Subscription_Set
DCPS_IR_Subscription_Set subscriptionRefs_
#define OpenDDS_InfoRepoLib_Export
ACE_Unbounded_Set< DCPS_IR_Topic * > DCPS_IR_Topic_Set
ACE_CDR::ULong ULong
Representative of a Topic.
Definition: DCPS_IR_Topic.h:43
const char *const name
Definition: debug.cpp:60
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
Representative of a Subscription.
Representation of a Domain in the system.
Representative of a Topic Description.
Representative of a Publication.