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]

List of all members.

Public Member Functions

 TopicImpl (const RepoId topic_id, 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 ()
RepoId get_id () const
const char * type_name () const
virtual void transport_config (const TransportConfig_rch &cfg)
void inconsistent_topic ()

Private Attributes

DDS::TopicQos qos_
 The topic qos.
DDS::StatusMask listener_mask_
DDS::TopicListener_var listener_
 The topic listener.
RepoId id_
 The id given by discovery.
DDS::InconsistentTopicStatus inconsistent_topic_status_
Monitormonitor_
 Pointer to the monitor object for this entity.

Detailed Description

Implements the DDS::Topic interface.

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

Definition at line 36 of file TopicImpl.h.


Constructor & Destructor Documentation

OpenDDS::DCPS::TopicImpl::TopicImpl ( const RepoId  topic_id,
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 23 of file TopicImpl.cpp.

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

00031   : TopicDescriptionImpl(topic_name,
00032                          type_name,
00033                          type_support,
00034                          participant),
00035     qos_(qos),
00036     listener_mask_(mask),
00037     listener_(DDS::TopicListener::_duplicate(a_listener)),
00038     id_(topic_id),
00039     monitor_(0)
00040 {
00041   inconsistent_topic_status_.total_count = 0;
00042   inconsistent_topic_status_.total_count_change = 0;
00043   monitor_ =
00044     TheServiceParticipant->monitor_factory_->create_topic_monitor(this);
00045 }

Here is the call graph for this function:

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

Definition at line 47 of file TopicImpl.cpp.

00048 {
00049 }


Member Function Documentation

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

Implements DDS::Entity.

Definition at line 124 of file TopicImpl.cpp.

References ACE_TEXT(), ACE_String_Base< ACE_CHAR_T >::c_str(), OpenDDS::DCPS::CREATED, 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_, OpenDDS::DCPS::Monitor::report(), DDS::RETCODE_ERROR, DDS::RETCODE_OK, DDS::RETCODE_PRECONDITION_NOT_MET, OpenDDS::DCPS::EntityImpl::set_enabled(), status, TheServiceParticipant, OpenDDS::DCPS::TopicDescriptionImpl::topic_name_, OpenDDS::DCPS::TopicDescriptionImpl::type_name_, and OpenDDS::DCPS::TopicDescriptionImpl::type_support_.

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

00125 {
00126   //According spec:
00127   // - Calling enable on an already enabled Entity returns OK and has no
00128   // effect.
00129   // - Calling enable on an Entity whose factory is not enabled will fail
00130   // and return PRECONDITION_NOT_MET.
00131 
00132   if (this->is_enabled()) {
00133     return DDS::RETCODE_OK;
00134   }
00135 
00136   if (!this->participant_->is_enabled()) {
00137     return DDS::RETCODE_PRECONDITION_NOT_MET;
00138   }
00139 
00140   if (id_ == GUID_UNKNOWN) {
00141     const DDS::DomainId_t dom_id = participant_->get_domain_id();
00142     Discovery_rch disco = TheServiceParticipant->get_discovery(dom_id);
00143     TopicStatus status = disco->assert_topic(id_,
00144                                              dom_id,
00145                                              participant_->get_id(),
00146                                              topic_name_.c_str(),
00147                                              type_name_.c_str(),
00148                                              qos_,
00149                                              type_support_->has_dcps_key());
00150     if (status != CREATED && status != FOUND) {
00151       ACE_ERROR((LM_ERROR,
00152                  ACE_TEXT("(%P|%t) ERROR: TopicImpl::enable, ")
00153                  ACE_TEXT("assert_topic failed with return value %d.\n"),
00154                  status));
00155       return DDS::RETCODE_ERROR;
00156     }
00157   }
00158 
00159   if (this->monitor_) {
00160     monitor_->report();
00161   }
00162   return this->set_enabled();
00163 }

Here is the call graph for this function:

Here is the caller graph for this function:

RepoId OpenDDS::DCPS::TopicImpl::get_id ( void   )  const

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

Definition at line 166 of file TopicImpl.cpp.

References id_.

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

00167 {
00168   return id_;
00169 }

Here is the caller graph for this function:

DDS::ReturnCode_t OpenDDS::DCPS::TopicImpl::get_inconsistent_topic_status ( DDS::InconsistentTopicStatus a_status  )  [virtual]
DDS::InstanceHandle_t OpenDDS::DCPS::TopicImpl::get_instance_handle (  )  [virtual]

Implements OpenDDS::DCPS::EntityImpl.

Definition at line 172 of file TopicImpl.cpp.

References id_, OpenDDS::DCPS::DomainParticipantImpl::id_to_handle(), and OpenDDS::DCPS::TopicDescriptionImpl::participant_.

00173 {
00174   return this->participant_->id_to_handle(this->id_);
00175 }

Here is the call graph for this function:

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

Implements DDS::Topic.

Definition at line 109 of file TopicImpl.cpp.

References CORBA::LocalObject::_duplicate(), and listener_.

00110 {
00111   return DDS::TopicListener::_duplicate(listener_.in());
00112 }

Here is the call graph for this function:

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.

00094 {
00095   qos = qos_;
00096   return DDS::RETCODE_OK;
00097 }

void OpenDDS::DCPS::TopicImpl::inconsistent_topic (  ) 
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 CORBA::LocalObject::_duplicate(), listener_, listener_mask_, and DDS::RETCODE_OK.

00101 {
00102   listener_mask_ = mask;
00103   //note: OK to duplicate  a nil object ref
00104   listener_ = DDS::TopicListener::_duplicate(a_listener);
00105   return DDS::RETCODE_OK;
00106 }

Here is the call graph for this function:

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

Definition at line 52 of file TopicImpl.cpp.

References 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, status, TheServiceParticipant, and OpenDDS::DCPS::Qos_Helper::valid().

00053 {
00054 
00055   OPENDDS_NO_OWNERSHIP_KIND_EXCLUSIVE_COMPATIBILITY_CHECK(qos, DDS::RETCODE_UNSUPPORTED);
00056   OPENDDS_NO_OWNERSHIP_PROFILE_COMPATIBILITY_CHECK(qos, DDS::RETCODE_UNSUPPORTED);
00057   OPENDDS_NO_DURABILITY_SERVICE_COMPATIBILITY_CHECK(qos, DDS::RETCODE_UNSUPPORTED);
00058   OPENDDS_NO_DURABILITY_KIND_TRANSIENT_PERSISTENT_COMPATIBILITY_CHECK(qos, DDS::RETCODE_UNSUPPORTED);
00059 
00060   if (Qos_Helper::valid(qos) && Qos_Helper::consistent(qos)) {
00061     if (qos_ == qos)
00062       return DDS::RETCODE_OK;
00063 
00064     // for the not changeable qos, it can be changed before enable
00065     if (!Qos_Helper::changeable(qos_, qos) && enabled_ == true) {
00066       return DDS::RETCODE_IMMUTABLE_POLICY;
00067 
00068     } else {
00069       qos_ = qos;
00070 
00071       Discovery_rch disco =
00072         TheServiceParticipant->get_discovery(participant_->get_domain_id());
00073       const bool status =
00074         disco->update_topic_qos(this->id_, participant_->get_domain_id(),
00075                                participant_->get_id(), qos_);
00076 
00077       if (!status) {
00078         ACE_ERROR_RETURN((LM_ERROR,
00079                           ACE_TEXT("(%P|%t) TopicImpl::set_qos, ")
00080                           ACE_TEXT("failed on compatibility check. \n")),
00081                          DDS::RETCODE_ERROR);
00082       }
00083     }
00084 
00085     return DDS::RETCODE_OK;
00086 
00087   } else {
00088     return DDS::RETCODE_INCONSISTENT_POLICY;
00089   }
00090 }

Here is the call graph for this function:

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

Reimplemented from OpenDDS::DCPS::EntityImpl.

Definition at line 184 of file TopicImpl.cpp.

00185 {
00186   throw Transport::MiscProblem();
00187 }

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

Definition at line 178 of file TopicImpl.cpp.

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

00179 {
00180   return this->type_name_.c_str();
00181 }

Here is the call graph for this function:


Member Data Documentation

The id given by discovery.

Definition at line 94 of file TopicImpl.h.

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

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

Definition at line 98 of file TopicImpl.h.

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

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

The topic listener.

Definition at line 91 of file TopicImpl.h.

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

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

Definition at line 89 of file TopicImpl.h.

Referenced by inconsistent_topic(), and set_listener().

Pointer to the monitor object for this entity.

Definition at line 101 of file TopicImpl.h.

Referenced by enable(), and TopicImpl().

The topic qos.

Definition at line 85 of file TopicImpl.h.

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


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1