TopicDescriptionImpl.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #ifndef OPENDDS_DCPS_TOPIC_DESCRIPTION_IMPL_H
00009 #define OPENDDS_DCPS_TOPIC_DESCRIPTION_IMPL_H
00010 
00011 #include "dds/DdsDcpsTopicC.h"
00012 #include "dds/DdsDcpsTypeSupportExtC.h"
00013 #include "Definitions.h"
00014 #include "ace/SString.h"
00015 #include "ace/Atomic_Op.h"
00016 #include "LocalObject.h"
00017 
00018 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00019 #pragma once
00020 #endif /* ACE_LACKS_PRAGMA_ONCE */
00021 
00022 namespace OpenDDS {
00023 namespace DCPS {
00024 
00025 class DomainParticipantImpl;
00026 
00027 /**
00028 * @class TopicDescriptionImpl
00029 *
00030 * @brief Implements the DDS::TopicDescription interface.
00031 *
00032 * See the DDS specification, OMG formal/04-12-02, for a description of
00033 * the interface this class is implementing.
00034 *
00035 */
00036 class OpenDDS_Dcps_Export TopicDescriptionImpl
00037   : public virtual OpenDDS::DCPS::LocalObject<DDS::TopicDescription> {
00038 public:
00039 
00040   //Constructor
00041   TopicDescriptionImpl(const char*            topic_name,
00042                        const char*            type_name,
00043                        TypeSupport_ptr        type_support,
00044                        DomainParticipantImpl* participant);
00045 
00046   //Destructor
00047   virtual ~TopicDescriptionImpl();
00048 
00049   virtual char * get_type_name();
00050 
00051   virtual char * get_name();
00052 
00053   virtual DDS::DomainParticipant_ptr get_participant();
00054 
00055   /** This method is not defined in the IDL and is defined for
00056   *  internal use.
00057   *  Return the type support of the topic.
00058   */
00059   OpenDDS::DCPS::TypeSupport_ptr get_type_support();
00060 
00061 #if !defined(OPENDDS_NO_CONTENT_FILTERED_TOPIC) || !defined(OPENDDS_NO_MULTI_TOPIC)
00062 
00063   bool has_reader() const {
00064     return reader_count_ > 0;
00065   }
00066 
00067   void update_reader_count(bool increment) {
00068     if (increment) ++reader_count_;
00069     else --reader_count_;
00070   }
00071 
00072 #endif
00073 
00074 protected:
00075   /// The name of the topic.
00076   ACE_CString                    topic_name_;
00077   /// The datatype of the topic.
00078   ACE_CString                    type_name_;
00079 
00080   /// The participant that creates this topic.
00081   DomainParticipantImpl*         participant_;
00082 
00083   /// The type_support for this topic.
00084   OpenDDS::DCPS::TypeSupport_ptr type_support_;
00085 
00086 #if !defined(OPENDDS_NO_CONTENT_FILTERED_TOPIC) || !defined(OPENDDS_NO_MULTI_TOPIC)
00087   ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> reader_count_;
00088 #endif
00089 };
00090 
00091 } // namespace DCPS
00092 } // namespace OpenDDS
00093 
00094 #endif /* OPENDDS_DCPS_TOPIC_DESCRIPTION_IMPL_H  */

Generated on Fri Feb 12 20:05:28 2016 for OpenDDS by  doxygen 1.4.7