OpenDDS  Snapshot(2023/04/07-19:43)
Public Member Functions | Private Attributes | List of all members
OpenDDS::DCPS::TopicImpl Class Reference

Implements the DDS::Topic interface. More...

#include <TopicImpl.h>

Inheritance diagram for OpenDDS::DCPS::TopicImpl:
Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::TopicImpl:
Collaboration graph
[legend]

Public Member Functions

 TopicImpl (const char *topic_name, const char *type_name, OpenDDS::DCPS::TypeSupport_ptr type_support, const DDS::TopicQos &qos, DDS::TopicListener_ptr a_listener, const DDS::StatusMask &mask, DomainParticipantImpl *participant)
 
virtual ~TopicImpl ()
 
virtual DDS::InstanceHandle_t get_instance_handle ()
 
virtual DDS::ReturnCode_t set_qos (const DDS::TopicQos &qos)
 
virtual DDS::ReturnCode_t get_qos (DDS::TopicQos &qos)
 
virtual DDS::ReturnCode_t set_listener (DDS::TopicListener_ptr a_listener, DDS::StatusMask mask)
 
virtual DDS::TopicListener_ptr get_listener ()
 
virtual DDS::ReturnCode_t get_inconsistent_topic_status (DDS::InconsistentTopicStatus &a_status)
 
virtual DDS::ReturnCode_t enable ()
 
GUID_t get_id () const
 
const char * type_name () const
 
const char * topic_name () const
 
virtual void transport_config (const TransportConfig_rch &cfg)
 
void inconsistent_topic (int count)
 
bool check_data_representation (const DDS::DataRepresentationIdSeq &qos_ids, bool is_data_writer)
 
- Public Member Functions inherited from DDS::Topic
ReturnCode_t set_qos (in TopicQos qos)
 
ReturnCode_t get_qos (inout TopicQos qos)
 
ReturnCode_t set_listener (in TopicListener a_listener, in StatusMask mask)
 
ReturnCode_t get_inconsistent_topic_status (inout InconsistentTopicStatus a_status)
 
- Public Member Functions inherited from OpenDDS::DCPS::LocalObjectBase
virtual void _add_ref ()
 
virtual void _remove_ref ()
 
virtual CORBA::ULong _refcount_value () const
 
- Public Member Functions inherited from CORBA::LocalObject
virtual ~LocalObject (void)
 
virtual CORBA::Boolean _non_existent (void)
 
virtual char * _repository_id (void)
 
virtual CORBA::InterfaceDef_ptr _get_interface (void)
 
virtual CORBA::Object_ptr _get_component (void)
 
virtual void _create_request (CORBA::Context_ptr ctx, const char *operation, CORBA::NVList_ptr arg_list, CORBA::NamedValue_ptr result, CORBA::Request_ptr &request, CORBA::Flags req_flags)
 
virtual void _create_request (CORBA::Context_ptr ctx, const char *operation, CORBA::NVList_ptr arg_list, CORBA::NamedValue_ptr result, CORBA::ExceptionList_ptr exclist, CORBA::ContextList_ptr ctxtlist, CORBA::Request_ptr &request, CORBA::Flags req_flags)
 
virtual CORBA::Request_ptr _request (const char *operation)
 
CORBA::Policy_ptr _get_policy (CORBA::PolicyType type)
 
CORBA::Policy_ptr _get_cached_policy (TAO_Cached_Policy_Type type)
 
CORBA::Object_ptr _set_policy_overrides (const CORBA::PolicyList &policies, CORBA::SetOverrideType set_add)
 
CORBA::PolicyList_get_policy_overrides (const CORBA::PolicyTypeSeq &types)
 
CORBA::Boolean _validate_connection (CORBA::PolicyList_out inconsistent_policies)
 
virtual CORBA::ULong _hash (CORBA::ULong maximum)
 
virtual CORBA::Boolean _is_equivalent (CORBA::Object_ptr other_obj)
 
virtual CORBA::ORB_ptr _get_orb (void)
 
virtual TAO::ObjectKey_key (void)
 
- Public Member Functions inherited from CORBA::Object
virtual ~Object (void)
 
virtual TAO_Abstract_ServantBase_servant (void) const
 
virtual CORBA::Boolean _is_collocated (void) const
 
virtual CORBA::Boolean _is_local (void) const
 
 Object (TAO_Stub *p, CORBA::Boolean collocated=false, TAO_Abstract_ServantBase *servant=0, TAO_ORB_Core *orb_core=0)
 
 Object (IOP::IOR *ior, TAO_ORB_Core *orb_core)
 
virtual TAO_Stub_stubobj (void) const
 
virtual TAO_Stub_stubobj (void)
 
virtual void _proxy_broker (TAO::Object_Proxy_Broker *proxy_broker)
 
virtual CORBA::Boolean marshal (TAO_OutputCDR &cdr)
 
CORBA::Boolean is_evaluated (void) const
 
TAO_ORB_Coreorb_core (void) const
 
IOP::IORsteal_ior (void)
 
const IOP::IORior (void) const
 
virtual bool can_convert_to_ior (void) const
 
virtual char * convert_to_ior (bool use_omg_ior_format, const char *ior_prefix) const
 
void _decr_refcount (void)
 
virtual CORBA::Boolean _is_a (const char *logical_type_id)
 
virtual const char * _interface_repository_id (void) const
 
CORBA::Policy_ptr _get_policy (CORBA::PolicyType type)
 
CORBA::Policy_ptr _get_cached_policy (TAO_Cached_Policy_Type type)
 
CORBA::Object_ptr _set_policy_overrides (const CORBA::PolicyList &policies, CORBA::SetOverrideType set_add)
 
CORBA::PolicyList_get_policy_overrides (const CORBA::PolicyTypeSeq &types)
 
CORBA::Boolean _validate_connection (CORBA::PolicyList_out inconsistent_policies)
 
- Public Member Functions inherited from OpenDDS::DCPS::RcObject
virtual ~RcObject ()
 
long ref_count () const
 
WeakObject_get_weak_object () const
 
- Public Member Functions inherited from OpenDDS::DCPS::EntityImpl
 EntityImpl ()
 
virtual ~EntityImpl ()
 
bool is_enabled () const
 
virtual DDS::StatusCondition_ptr get_statuscondition ()
 
virtual DDS::StatusMask get_status_changes ()
 
virtual DDS::DomainId_t get_domain_id ()
 
void set_status_changed_flag (DDS::StatusKind status, bool status_changed_flag)
 
void notify_status_condition ()
 
TransportConfig_rch transport_config () const
 
virtual RcHandle< EntityImplparent () const
 
void set_observer (Observer_rch observer, Observer::Event e)
 
Observer_rch get_observer (Observer::Event e)
 
- Public Member Functions inherited from OpenDDS::DCPS::TopicCallbacks
 TopicCallbacks ()
 
virtual ~TopicCallbacks ()
 
- Public Member Functions inherited from OpenDDS::DCPS::TopicDescriptionImpl
 TopicDescriptionImpl (const char *topic_name, const char *type_name, TypeSupport_ptr type_support, DomainParticipantImpl *participant)
 
virtual ~TopicDescriptionImpl ()
 
virtual char * get_type_name ()
 
virtual char * get_name ()
 
virtual DDS::DomainParticipant_ptr get_participant ()
 
OpenDDS::DCPS::TypeSupport_ptr get_type_support ()
 
bool has_entity_refs () const
 
void add_entity_ref ()
 
void remove_entity_ref ()
 

Private Attributes

DDS::TopicQos qos_
 The topic qos. More...
 
ACE_Thread_Mutex listener_mutex_
 Mutex to protect listener info. More...
 
DDS::StatusMask listener_mask_
 
DDS::TopicListener_var listener_
 The topic listener. More...
 
GUID_t id_
 The id given by discovery. More...
 
ACE_Thread_Mutex status_mutex_
 Mutex to protect status info. More...
 
DDS::InconsistentTopicStatus inconsistent_topic_status_
 
unique_ptr< Monitormonitor_
 Pointer to the monitor object for this entity. More...
 

Additional Inherited Members

- Public Types inherited from OpenDDS::DCPS::LocalObject< DDS::Topic >
typedef DDS::Topic ::_ptr_type _ptr_type
 
typedef DDS::Topic ::_var_type _var_type
 
- Public Types inherited from CORBA::LocalObject
typedef LocalObject_ptr _ptr_type
 
typedef LocalObject_var _var_type
 
typedef LocalObject_out _out_type
 
- Public Types inherited from CORBA::Object
typedef Object_ptr _ptr_type
 
typedef Object_var _var_type
 
typedef Object_out _out_type
 
- Public Types inherited from OpenDDS::DCPS::LocalObject< DDS::Entity >
typedef DDS::Entity ::_ptr_type _ptr_type
 
typedef DDS::Entity ::_var_type _var_type
 
- Public Types inherited from OpenDDS::DCPS::LocalObject< DDS::TopicDescription >
typedef DDS::TopicDescription ::_ptr_type _ptr_type
 
typedef DDS::TopicDescription ::_var_type _var_type
 
- Static Public Member Functions inherited from OpenDDS::DCPS::LocalObject< DDS::Topic >
static _ptr_type _narrow (CORBA::Object_ptr obj)
 
- Static Public Member Functions inherited from CORBA::LocalObject
static LocalObject_ptr _duplicate (LocalObject_ptr obj)
 
static LocalObject_ptr _nil (void)
 
static LocalObject_ptr _narrow (CORBA::Object_ptr obj)
 
- Static Public Member Functions inherited from CORBA::Object
static CORBA::Boolean marshal (const Object_ptr x, TAO_OutputCDR &cdr)
 
static void _tao_any_destructor (void *)
 
static CORBA::Boolean is_nil_i (CORBA::Object_ptr obj)
 
static void tao_object_initialize (Object *)
 
static CORBA::Object_ptr _duplicate (CORBA::Object_ptr obj)
 
static CORBA::Object_ptr _nil (void)
 
static CORBA::Object_ptr _narrow (CORBA::Object_ptr obj)
 
- Static Public Member Functions inherited from OpenDDS::DCPS::LocalObject< DDS::Entity >
static _ptr_type _narrow (CORBA::Object_ptr obj)
 
- Static Public Member Functions inherited from OpenDDS::DCPS::LocalObject< DDS::TopicDescription >
static _ptr_type _narrow (CORBA::Object_ptr obj)
 
- Protected Member Functions inherited from CORBA::LocalObject
 LocalObject (void)
 
- Protected Member Functions inherited from CORBA::Object
 Object (int dummy=0)
 
TAO::Object_Proxy_Brokerproxy_broker () const
 
- Protected Member Functions inherited from OpenDDS::DCPS::RcObject
 RcObject ()
 
- Protected Member Functions inherited from OpenDDS::DCPS::EntityImpl
DDS::ReturnCode_t set_enabled ()
 
void set_deleted (bool state)
 
bool get_deleted () const
 
DDS::InstanceHandle_t get_entity_instance_handle (const GUID_t &id, const RcHandle< DomainParticipantImpl > &participant)
 
- Protected Attributes inherited from CORBA::Object
ACE_Atomic_Op< TAO_SYNCH_MUTEX, unsigned long > refcount_
 
- Protected Attributes inherited from OpenDDS::DCPS::EntityImpl
AtomicBool enabled_
 The flag indicates the entity is enabled. More...
 
AtomicBool entity_deleted_
 The flag indicates the entity is being deleted. More...
 
- Protected Attributes inherited from OpenDDS::DCPS::TopicDescriptionImpl
ACE_CString topic_name_
 The name of the topic. More...
 
ACE_CString type_name_
 The datatype of the topic. More...
 
DomainParticipantImplparticipant_
 The participant that creates this topic. More...
 
OpenDDS::DCPS::TypeSupport_var type_support_
 The type_support for this topic. More...
 
Atomic< ACE_UINT32 > entity_refs_
 The number of entities using this topic. More...
 

Detailed Description

Implements the DDS::Topic interface.

See the DDS specification, OMG formal/2015-04-10, for a description of the interface this class is implementing.

Definition at line 37 of file TopicImpl.h.

Constructor & Destructor Documentation

◆ TopicImpl()

OpenDDS::DCPS::TopicImpl::TopicImpl ( const char *  topic_name,
const char *  type_name,
OpenDDS::DCPS::TypeSupport_ptr  type_support,
const DDS::TopicQos qos,
DDS::TopicListener_ptr  a_listener,
const DDS::StatusMask mask,
DomainParticipantImpl participant 
)

Definition at line 26 of file TopicImpl.cpp.

References _duplicate(), inconsistent_topic_status_, monitor_, TheServiceParticipant, DDS::InconsistentTopicStatus::total_count, and DDS::InconsistentTopicStatus::total_count_change.

34  type_name,
35  type_support,
36  participant),
37  qos_(qos),
38  listener_mask_(mask),
39  listener_(DDS::TopicListener::_duplicate(a_listener)),
41 {
44  monitor_.reset(TheServiceParticipant->monitor_factory_->create_topic_monitor(this));
45 }
DDS::TopicListener_var listener_
The topic listener.
Definition: TopicImpl.h:103
const GUID_t GUID_UNKNOWN
Nil value for GUID.
Definition: GuidUtils.h:59
unique_ptr< Monitor > monitor_
Pointer to the monitor object for this entity.
Definition: TopicImpl.h:115
const char * type_name() const
Definition: TopicImpl.cpp:184
const char * topic_name() const
Definition: TopicImpl.cpp:190
TopicDescriptionImpl(const char *topic_name, const char *type_name, TypeSupport_ptr type_support, DomainParticipantImpl *participant)
GUID_t id_
The id given by discovery.
Definition: TopicImpl.h:106
DDS::TopicQos qos_
The topic qos.
Definition: TopicImpl.h:95
#define TheServiceParticipant
DDS::InconsistentTopicStatus inconsistent_topic_status_
Definition: TopicImpl.h:112
DDS::StatusMask listener_mask_
Definition: TopicImpl.h:101

◆ ~TopicImpl()

OpenDDS::DCPS::TopicImpl::~TopicImpl ( )
virtual

Definition at line 47 of file TopicImpl.cpp.

48 {
49 }

Member Function Documentation

◆ check_data_representation()

bool OpenDDS::DCPS::TopicImpl::check_data_representation ( const DDS::DataRepresentationIdSeq qos_ids,
bool  is_data_writer 
)

Compare the QoS of the IDL Type and the Topic/DataWriter/DataReader to see whether the type matches all values in the QoS.

Definition at line 232 of file TopicImpl.cpp.

References ACE_ERROR, LM_NOTICE, OpenDDS::DCPS::log_level, OpenDDS::DCPS::LogLevel::Notice, OPENDDS_END_VERSIONED_NAMESPACE_DECL, OpenDDS::DCPS::repr_seq_to_string(), and OpenDDS::DCPS::TopicDescriptionImpl::type_support_.

233 {
234  if (!type_support_) {
235  return true;
236  }
237  DDS::DataRepresentationIdSeq type_allowed_reprs;
238  type_support_->representations_allowed_by_type(type_allowed_reprs);
239  //default for blank annotation is to allow all types of data representation
240  if (type_allowed_reprs.length() == 0) {
241  return true;
242  }
243  if (qos_ids.length() == 0) {
244  if (log_level >= LogLevel::Notice) {
245  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: TopicImpl::check_data_representation: "
246  "representation qos is blank.\n"));
247  }
248  return false;
249  }
250  //Data Writer will only use the 1st QoS declared
251  if (is_data_writer) {
252  DDS::DataRepresentationId_t id = qos_ids[0];
253  for (CORBA::ULong j = 0; j < type_allowed_reprs.length(); ++j) {
254  if (id == type_allowed_reprs[j]) {
255  return true;
256  }
257  }
258  } else { // if data reader compare both lists for a compatible QoS
259  for (CORBA::ULong i = 0; i < qos_ids.length(); ++i) {
260  for (CORBA::ULong j = 0; j < type_allowed_reprs.length(); ++j) {
261  if (qos_ids[i] == type_allowed_reprs[j]) {
262  return true;
263  }
264  }
265  }
266  }
267  if (log_level >= LogLevel::Notice) {
268  ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: TopicImpl::check_data_representation: "
269  "none of the data representation QoS: %C is allowed by the "
270  "topic type IDL annotations: %C\n", repr_seq_to_string(qos_ids, is_data_writer).c_str(), repr_seq_to_string(type_allowed_reprs).c_str()));
271  }
272  return false;
273 }
OpenDDS_Dcps_Export LogLevel log_level
#define ACE_ERROR(X)
short DataRepresentationId_t
ACE_CDR::ULong ULong
sequence< DataRepresentationId_t > DataRepresentationIdSeq
DCPS::String repr_seq_to_string(const DDS::DataRepresentationIdSeq &id_seq, bool is_data_writer)
Definition: DCPS_Utils.cpp:495
OpenDDS::DCPS::TypeSupport_var type_support_
The type_support for this topic.

◆ enable()

DDS::ReturnCode_t OpenDDS::DCPS::TopicImpl::enable ( )
virtual

Implements DDS::Entity.

Definition at line 127 of file TopicImpl.cpp.

References ACE_ERROR, ACE_TEXT(), ACE_String_Base< char >::c_str(), OpenDDS::DCPS::CREATED, OpenDDS::DCPS::DCPS_debug_level, OpenDDS::DCPS::FOUND, OpenDDS::DCPS::DomainParticipantImpl::get_domain_id(), OpenDDS::DCPS::DomainParticipantImpl::get_id(), OpenDDS::DCPS::GUID_UNKNOWN, id_, OpenDDS::DCPS::EntityImpl::is_enabled(), LM_ERROR, monitor_, OpenDDS::DCPS::TopicDescriptionImpl::participant_, qos_, DDS::RETCODE_ERROR, DDS::RETCODE_OK, DDS::RETCODE_PRECONDITION_NOT_MET, OpenDDS::DCPS::EntityImpl::set_enabled(), TheServiceParticipant, OpenDDS::DCPS::TopicDescriptionImpl::topic_name_, OpenDDS::DCPS::topicstatus_to_string(), OpenDDS::DCPS::TopicDescriptionImpl::type_name_, and OpenDDS::DCPS::TopicDescriptionImpl::type_support_.

Referenced by OpenDDS::DCPS::DomainParticipantImpl::create_new_topic().

128 {
129  //According spec:
130  // - Calling enable on an already enabled Entity returns OK and has no
131  // effect.
132  // - Calling enable on an Entity whose factory is not enabled will fail
133  // and return PRECONDITION_NOT_MET.
134 
135  if (this->is_enabled()) {
136  return DDS::RETCODE_OK;
137  }
138 
139  if (!this->participant_->is_enabled()) {
141  }
142 
143  if (id_ == GUID_UNKNOWN) {
144  const DDS::DomainId_t dom_id = participant_->get_domain_id();
145  Discovery_rch disco = TheServiceParticipant->get_discovery(dom_id);
146  TopicStatus status = disco->assert_topic(id_,
147  dom_id,
148  participant_->get_id(),
149  topic_name_.c_str(),
150  type_name_.c_str(),
151  qos_,
152  type_support_ ? type_support_->has_dcps_key() : false,
153  this);
154  if (status != CREATED && status != FOUND) {
155  if (DCPS_debug_level >= 1) {
156  ACE_ERROR((LM_ERROR,
157  ACE_TEXT("(%P|%t) ERROR: TopicImpl::enable, ")
158  ACE_TEXT("assert_topic failed with return value <%C>.\n"),
159  topicstatus_to_string(status)));
160  }
161  return DDS::RETCODE_ERROR;
162  }
163  }
164 
165  if (this->monitor_) {
166  monitor_->report();
167  }
168  return this->set_enabled();
169 }
#define ACE_ERROR(X)
const char * c_str(void) const
RcHandle< Discovery > Discovery_rch
Definition: Discovery.h:296
const ReturnCode_t RETCODE_OK
const GUID_t GUID_UNKNOWN
Nil value for GUID.
Definition: GuidUtils.h:59
unique_ptr< Monitor > monitor_
Pointer to the monitor object for this entity.
Definition: TopicImpl.h:115
DOMAINID_TYPE_NATIVE DomainId_t
const char * topicstatus_to_string(TopicStatus value)
Definition: DCPS_Utils.cpp:70
DDS::ReturnCode_t set_enabled()
Definition: EntityImpl.cpp:40
const ReturnCode_t RETCODE_PRECONDITION_NOT_MET
const ReturnCode_t RETCODE_ERROR
ACE_CString topic_name_
The name of the topic.
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
Definition: debug.cpp:30
ACE_TEXT("TCP_Factory")
DomainParticipantImpl * participant_
The participant that creates this topic.
GUID_t id_
The id given by discovery.
Definition: TopicImpl.h:106
DDS::TopicQos qos_
The topic qos.
Definition: TopicImpl.h:95
ACE_CString type_name_
The datatype of the topic.
#define TheServiceParticipant
OpenDDS::DCPS::TypeSupport_var type_support_
The type_support for this topic.

◆ get_id()

GUID_t OpenDDS::DCPS::TopicImpl::get_id ( void  ) const
virtual

This method is not defined in the IDL and is defined for internal use. Return the id given by discovery.

Reimplemented from OpenDDS::DCPS::EntityImpl.

Definition at line 172 of file TopicImpl.cpp.

References id_.

Referenced by OpenDDS::DCPS::DomainParticipantImpl::delete_topic_i(), OpenDDS::DCPS::TopicMonitorImpl::report(), and OpenDDS::DCPS::DWMonitorImpl::report().

173 {
174  return id_;
175 }
GUID_t id_
The id given by discovery.
Definition: TopicImpl.h:106

◆ get_inconsistent_topic_status()

DDS::ReturnCode_t OpenDDS::DCPS::TopicImpl::get_inconsistent_topic_status ( DDS::InconsistentTopicStatus a_status)
virtual

◆ get_instance_handle()

DDS::InstanceHandle_t OpenDDS::DCPS::TopicImpl::get_instance_handle ( )
virtual

Implements OpenDDS::DCPS::EntityImpl.

Definition at line 178 of file TopicImpl.cpp.

References OpenDDS::DCPS::EntityImpl::get_entity_instance_handle(), id_, OpenDDS::DCPS::TopicDescriptionImpl::participant_, and OpenDDS::DCPS::rchandle_from().

179 {
181 }
DDS::InstanceHandle_t get_entity_instance_handle(const GUID_t &id, const RcHandle< DomainParticipantImpl > &participant)
Definition: EntityImpl.cpp:142
DomainParticipantImpl * participant_
The participant that creates this topic.
RcHandle< T > rchandle_from(T *pointer)
Definition: RcHandle_T.h:310
GUID_t id_
The id given by discovery.
Definition: TopicImpl.h:106

◆ get_listener()

DDS::TopicListener_ptr OpenDDS::DCPS::TopicImpl::get_listener ( )
virtual

Implements DDS::Topic.

Definition at line 110 of file TopicImpl.cpp.

References listener_, and listener_mutex_.

111 {
113  return DDS::TopicListener::_duplicate(listener_.in());
114 }
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

◆ get_qos()

DDS::ReturnCode_t OpenDDS::DCPS::TopicImpl::get_qos ( DDS::TopicQos qos)
virtual

Definition at line 93 of file TopicImpl.cpp.

References qos_, and DDS::RETCODE_OK.

94 {
95  qos = qos_;
96  return DDS::RETCODE_OK;
97 }
const ReturnCode_t RETCODE_OK
DDS::TopicQos qos_
The topic qos.
Definition: TopicImpl.h:95

◆ inconsistent_topic()

void OpenDDS::DCPS::TopicImpl::inconsistent_topic ( int  count)
virtual

Implements OpenDDS::DCPS::TopicCallbacks.

Definition at line 203 of file TopicImpl.cpp.

References DDS::INCONSISTENT_TOPIC_STATUS, inconsistent_topic_status_, listener_, OpenDDS::DCPS::DomainParticipantImpl::listener_for(), listener_mask_, listener_mutex_, OpenDDS::DCPS::EntityImpl::notify_status_condition(), OpenDDS::DCPS::TopicDescriptionImpl::participant_, ACE_Guard< ACE_LOCK >::release(), OpenDDS::DCPS::EntityImpl::set_status_changed_flag(), status_mutex_, DDS::InconsistentTopicStatus::total_count, and DDS::InconsistentTopicStatus::total_count_change.

204 {
208 
210 
211  DDS::TopicListener_var listener;
212  {
214  listener = listener_;
215  if (!listener || !(listener_mask_ & DDS::INCONSISTENT_TOPIC_STATUS)) {
216  g.release();
217  listener = participant_->listener_for(DDS::INCONSISTENT_TOPIC_STATUS);
218  }
219  }
220  if (listener) {
223  status_guard.release();
224  listener->on_inconsistent_topic(this, status);
225  } else {
226  status_guard.release();
227  }
228 
230 }
DDS::DomainParticipantListener_ptr listener_for(DDS::StatusKind kind)
DDS::TopicListener_var listener_
The topic listener.
Definition: TopicImpl.h:103
const StatusKind INCONSISTENT_TOPIC_STATUS
void set_status_changed_flag(DDS::StatusKind status, bool status_changed_flag)
Definition: EntityImpl.cpp:68
DomainParticipantImpl * participant_
The participant that creates this topic.
ACE_Thread_Mutex listener_mutex_
Mutex to protect listener info.
Definition: TopicImpl.h:98
DDS::InconsistentTopicStatus inconsistent_topic_status_
Definition: TopicImpl.h:112
DDS::StatusMask listener_mask_
Definition: TopicImpl.h:101
ACE_Thread_Mutex status_mutex_
Mutex to protect status info.
Definition: TopicImpl.h:109

◆ set_listener()

DDS::ReturnCode_t OpenDDS::DCPS::TopicImpl::set_listener ( DDS::TopicListener_ptr  a_listener,
DDS::StatusMask  mask 
)
virtual

Definition at line 100 of file TopicImpl.cpp.

References listener_, listener_mask_, listener_mutex_, and DDS::RETCODE_OK.

101 {
103  listener_mask_ = mask;
104  //note: OK to duplicate a nil object ref
105  listener_ = DDS::TopicListener::_duplicate(a_listener);
106  return DDS::RETCODE_OK;
107 }
const ReturnCode_t RETCODE_OK
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
DDS::StatusMask listener_mask_
Definition: TopicImpl.h:101

◆ set_qos()

DDS::ReturnCode_t OpenDDS::DCPS::TopicImpl::set_qos ( const DDS::TopicQos qos)
virtual

Definition at line 51 of file TopicImpl.cpp.

References ACE_ERROR_RETURN, ACE_TEXT(), OpenDDS::DCPS::Qos_Helper::changeable(), OpenDDS::DCPS::Qos_Helper::consistent(), OpenDDS::DCPS::EntityImpl::enabled_, OpenDDS::DCPS::DomainParticipantImpl::get_domain_id(), OpenDDS::DCPS::DomainParticipantImpl::get_id(), id_, LM_ERROR, OPENDDS_NO_DURABILITY_KIND_TRANSIENT_PERSISTENT_COMPATIBILITY_CHECK, OPENDDS_NO_DURABILITY_SERVICE_COMPATIBILITY_CHECK, OPENDDS_NO_OWNERSHIP_KIND_EXCLUSIVE_COMPATIBILITY_CHECK, OPENDDS_NO_OWNERSHIP_PROFILE_COMPATIBILITY_CHECK, OpenDDS::DCPS::TopicDescriptionImpl::participant_, qos_, DDS::RETCODE_ERROR, DDS::RETCODE_IMMUTABLE_POLICY, DDS::RETCODE_INCONSISTENT_POLICY, DDS::RETCODE_OK, DDS::RETCODE_UNSUPPORTED, TheServiceParticipant, and OpenDDS::DCPS::Qos_Helper::valid().

52 {
53  DDS::TopicQos qos = qos_arg;
54 
59 
60  if (Qos_Helper::valid(qos) && Qos_Helper::consistent(qos)) {
61  if (qos_ == qos)
62  return DDS::RETCODE_OK;
63 
64  // for the not changeable qos, it can be changed before enable
65  if (!Qos_Helper::changeable(qos_, qos) && enabled_) {
67 
68  } else {
69  qos_ = qos;
70 
71  Discovery_rch disco =
73  const bool status =
74  disco->update_topic_qos(this->id_, participant_->get_domain_id(),
76 
77  if (!status) {
78  ACE_ERROR_RETURN((LM_ERROR,
79  ACE_TEXT("(%P|%t) TopicImpl::set_qos, ")
80  ACE_TEXT("failed on compatibility check.\n")),
82  }
83  }
84 
85  return DDS::RETCODE_OK;
86 
87  } else {
89  }
90 }
RcHandle< Discovery > Discovery_rch
Definition: Discovery.h:296
const ReturnCode_t RETCODE_OK
#define OPENDDS_NO_DURABILITY_SERVICE_COMPATIBILITY_CHECK(qos, error_rtn_value)
static bool consistent(const DDS::ResourceLimitsQosPolicy &resource_limits, const DDS::HistoryQosPolicy &history)
Definition: Qos_Helper.inl:596
#define OPENDDS_NO_OWNERSHIP_KIND_EXCLUSIVE_COMPATIBILITY_CHECK(qos, error_rtn_value)
#define OPENDDS_NO_OWNERSHIP_PROFILE_COMPATIBILITY_CHECK(qos, error_rtn_value)
const ReturnCode_t RETCODE_INCONSISTENT_POLICY
const ReturnCode_t RETCODE_ERROR
static bool valid(const DDS::UserDataQosPolicy &qos)
Definition: Qos_Helper.inl:723
const ReturnCode_t RETCODE_IMMUTABLE_POLICY
ACE_TEXT("TCP_Factory")
static bool changeable(const DDS::UserDataQosPolicy &qos1, const DDS::UserDataQosPolicy &qos2)
Definition: Qos_Helper.inl:948
DomainParticipantImpl * participant_
The participant that creates this topic.
GUID_t id_
The id given by discovery.
Definition: TopicImpl.h:106
DDS::TopicQos qos_
The topic qos.
Definition: TopicImpl.h:95
#define ACE_ERROR_RETURN(X, Y)
const ReturnCode_t RETCODE_UNSUPPORTED
#define TheServiceParticipant
AtomicBool enabled_
The flag indicates the entity is enabled.
Definition: EntityImpl.h:82
#define OPENDDS_NO_DURABILITY_KIND_TRANSIENT_PERSISTENT_COMPATIBILITY_CHECK(qos, error_rtn_value)

◆ topic_name()

const char * OpenDDS::DCPS::TopicImpl::topic_name ( ) const

Definition at line 190 of file TopicImpl.cpp.

References ACE_String_Base< char >::c_str(), and OpenDDS::DCPS::TopicDescriptionImpl::topic_name_.

191 {
192  return this->topic_name_.c_str();
193 }
const char * c_str(void) const
ACE_CString topic_name_
The name of the topic.

◆ transport_config()

void OpenDDS::DCPS::TopicImpl::transport_config ( const TransportConfig_rch cfg)
virtual

Reimplemented from OpenDDS::DCPS::EntityImpl.

Definition at line 197 of file TopicImpl.cpp.

198 {
199  throw Transport::MiscProblem();
200 }

◆ type_name()

const char * OpenDDS::DCPS::TopicImpl::type_name ( ) const

Definition at line 184 of file TopicImpl.cpp.

References ACE_String_Base< char >::c_str(), and OpenDDS::DCPS::TopicDescriptionImpl::type_name_.

185 {
186  return this->type_name_.c_str();
187 }
const char * c_str(void) const
ACE_CString type_name_
The datatype of the topic.

Member Data Documentation

◆ id_

GUID_t OpenDDS::DCPS::TopicImpl::id_
private

The id given by discovery.

Definition at line 106 of file TopicImpl.h.

Referenced by enable(), get_id(), get_instance_handle(), and set_qos().

◆ inconsistent_topic_status_

DDS::InconsistentTopicStatus OpenDDS::DCPS::TopicImpl::inconsistent_topic_status_
private

Count of discovered (readers/writers using) topics with the same topic name but different characteristics (typename)

Definition at line 112 of file TopicImpl.h.

Referenced by get_inconsistent_topic_status(), inconsistent_topic(), and TopicImpl().

◆ listener_

DDS::TopicListener_var OpenDDS::DCPS::TopicImpl::listener_
private

The topic listener.

Definition at line 103 of file TopicImpl.h.

Referenced by get_listener(), inconsistent_topic(), and set_listener().

◆ listener_mask_

DDS::StatusMask OpenDDS::DCPS::TopicImpl::listener_mask_
private

The mask for which kind of events the listener will be notified about.

Definition at line 101 of file TopicImpl.h.

Referenced by inconsistent_topic(), and set_listener().

◆ listener_mutex_

ACE_Thread_Mutex OpenDDS::DCPS::TopicImpl::listener_mutex_
private

Mutex to protect listener info.

Definition at line 98 of file TopicImpl.h.

Referenced by get_listener(), inconsistent_topic(), and set_listener().

◆ monitor_

unique_ptr<Monitor> OpenDDS::DCPS::TopicImpl::monitor_
private

Pointer to the monitor object for this entity.

Definition at line 115 of file TopicImpl.h.

Referenced by enable(), and TopicImpl().

◆ qos_

DDS::TopicQos OpenDDS::DCPS::TopicImpl::qos_
private

The topic qos.

Definition at line 95 of file TopicImpl.h.

Referenced by enable(), get_qos(), and set_qos().

◆ status_mutex_

ACE_Thread_Mutex OpenDDS::DCPS::TopicImpl::status_mutex_
private

Mutex to protect status info.

Definition at line 109 of file TopicImpl.h.

Referenced by get_inconsistent_topic_status(), and inconsistent_topic().


The documentation for this class was generated from the following files: