OpenDDS  Snapshot(2023/04/28-20:55)
TopicImpl.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 OPENDDS_DCPS_TOPIC_IMPL_H
9 #define OPENDDS_DCPS_TOPIC_IMPL_H
10 
11 #include "dds/DdsDcpsTopicC.h"
12 #include "dds/DdsDcpsInfoUtilsC.h"
13 #include "EntityImpl.h"
14 #include "TopicDescriptionImpl.h"
15 #include "TopicCallbacks.h"
16 
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 #pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
20 
22 
23 namespace OpenDDS {
24 namespace DCPS {
25 
26 class TopicDescriptionImpl;
27 class Monitor;
28 
29 /**
30 * @class TopicImpl
31 *
32 * @brief Implements the DDS::Topic interface.
33 *
34 * See the DDS specification, OMG formal/2015-04-10, for a description of
35 * the interface this class is implementing.
36 */
38  : public virtual LocalObject<DDS::Topic>,
39  public virtual EntityImpl,
40  public virtual TopicCallbacks,
41  public virtual TopicDescriptionImpl {
42 public:
43  TopicImpl(const char* topic_name,
44  const char* type_name,
45  OpenDDS::DCPS::TypeSupport_ptr type_support,
46  const DDS::TopicQos & qos,
47  DDS::TopicListener_ptr a_listener,
48  const DDS::StatusMask & mask,
49  DomainParticipantImpl* participant);
50 
51  virtual ~TopicImpl();
52 
53  virtual DDS::InstanceHandle_t get_instance_handle();
54 
55  virtual DDS::ReturnCode_t set_qos(const DDS::TopicQos& qos);
56 
57  virtual DDS::ReturnCode_t get_qos(DDS::TopicQos& qos);
58 
59  virtual DDS::ReturnCode_t set_listener(DDS::TopicListener_ptr a_listener,
60  DDS::StatusMask mask);
61 
62  virtual DDS::TopicListener_ptr get_listener();
63 
64  virtual DDS::ReturnCode_t get_inconsistent_topic_status(
66 
67  virtual DDS::ReturnCode_t enable();
68 
69  /** This method is not defined in the IDL and is defined for
70  * internal use.
71  * Return the id given by discovery.
72  */
73  GUID_t get_id() const;
74 
75  // OpenDDS extension which doesn't duplicate the string to prevent
76  // the runtime costs of making a copy
77  const char* type_name() const;
78 
79  // OpenDDS extension which doesn't duplicate the string to prevent
80  // the runtime costs of making a copy
81  const char* topic_name() const;
82 
83  virtual void transport_config(const TransportConfig_rch& cfg);
84 
85  void inconsistent_topic(int count);
86 
87  /**
88  * Compare the QoS of the IDL Type and the Topic/DataWriter/DataReader to see
89  * whether the type matches all values in the QoS.
90  */
91  bool check_data_representation(const DDS::DataRepresentationIdSeq& qos_ids, bool is_data_writer);
92 
93 private:
94  /// The topic qos
96 
97  /// Mutex to protect listener info
99  /// The mask for which kind of events the listener
100  /// will be notified about.
102  /// The topic listener
103  DDS::TopicListener_var listener_;
104 
105  /// The id given by discovery.
107 
108  /// Mutex to protect status info
110  /// Count of discovered (readers/writers using) topics with the same
111  /// topic name but different characteristics (typename)
113 
114  /// Pointer to the monitor object for this entity
116 };
117 
118 
119 
120 } // namespace DCPS
121 } // namespace OpenDDS
122 
124 
125 #endif /* OPENDDS_DCPS_TOPIC_IMPL_H */
DDS::InconsistentTopicStatus inconsistent_topic_status_
Definition: TopicImpl.h:112
Implements the OpenDDS::DCPS::DomainParticipant interfaces.
Implements the OpenDDS::DCPS::Entity interfaces.
Definition: EntityImpl.h:37
DDS::StatusMask listener_mask_
Definition: TopicImpl.h:101
ACE_Thread_Mutex status_mutex_
Mutex to protect status info.
Definition: TopicImpl.h:109
DDS::TopicQos qos_
The topic qos.
Definition: TopicImpl.h:95
#define OpenDDS_Dcps_Export
Definition: dcps_export.h:24
sequence< DataRepresentationId_t > DataRepresentationIdSeq
Implements the DDS::Topic interface.
Definition: TopicImpl.h:37
DDS::TopicListener_var listener_
The topic listener.
Definition: TopicImpl.h:103
ACE_Thread_Mutex listener_mutex_
Mutex to protect listener info.
Definition: TopicImpl.h:98
HANDLE_TYPE_NATIVE InstanceHandle_t
Definition: DdsDcpsCore.idl:51
unsigned long StatusMask
Implements the DDS::TopicDescription interface.
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
unique_ptr< Monitor > monitor_
Pointer to the monitor object for this entity.
Definition: TopicImpl.h:115
Defines the interface for Discovery callbacks into the Topic.
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
GUID_t id_
The id given by discovery.
Definition: TopicImpl.h:106