DCPS_IR_Topic_Description.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 DCPS_IR_TOPIC_DESCRIPTION_H
00009 #define DCPS_IR_TOPIC_DESCRIPTION_H
00010 
00011 #include  "inforepo_export.h"
00012 #include /**/ "ace/Unbounded_Set.h"
00013 #include /**/ "ace/SString.h"
00014 #include /**/ "tao/corbafwd.h"
00015 #include "dds/DCPS/unique_ptr.h"
00016 
00017 #include <string>
00018 
00019 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00020 #pragma once
00021 #endif /* ACE_LACKS_PRAGMA_ONCE */
00022 
00023 #include "dds/Versioned_Namespace.h"
00024 
00025 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00026 
00027 // forward declarations
00028 class DCPS_IR_Publication;
00029 class DCPS_IR_Domain;
00030 
00031 class DCPS_IR_Subscription;
00032 typedef ACE_Unbounded_Set<DCPS_IR_Subscription*> DCPS_IR_Subscription_Set;
00033 
00034 class DCPS_IR_Topic;
00035 typedef ACE_Unbounded_Set<DCPS_IR_Topic*> DCPS_IR_Topic_Set;
00036 
00037 /**
00038  * @class DCPS_IR_Topic_Description
00039  *
00040  * @brief Representative of a Topic Description
00041  *
00042  */
00043 class OpenDDS_InfoRepoLib_Export DCPS_IR_Topic_Description
00044   : public OpenDDS::DCPS::EnableContainerSupportedUniquePtr<DCPS_IR_Topic_Description> {
00045 public:
00046   DCPS_IR_Topic_Description(
00047     DCPS_IR_Domain* domain,
00048     const char* name,
00049     const char* dataTypeName);
00050 
00051   ~DCPS_IR_Topic_Description();
00052 
00053   /// Adds the subscription to the list of subscriptions
00054   /// Tries to associate with existing publications if successfully added
00055   /// 'associate' switch toggles association attempt.
00056   /// Returns 0 if added, 1 if already exists, -1 other failure
00057   int add_subscription_reference(DCPS_IR_Subscription* subscription
00058                                  , bool associate = true);
00059 
00060   /// Removes the subscription from the list of subscriptions
00061   /// Returns 0 if successful
00062   int remove_subscription_reference(DCPS_IR_Subscription* subscription);
00063 
00064   /// Add a topic
00065   /// Takes ownership of memory pointed to by topic
00066   /// Returns 0 if added, 1 if already exists, -1 other failure
00067   int add_topic(DCPS_IR_Topic* topic);
00068 
00069   /// Removes the topic from the list of topics
00070   /// Gives ownership of the memory pointed to by topic
00071   ///  to the caller
00072   /// Returns 0 if successful
00073   int remove_topic(DCPS_IR_Topic* topic);
00074 
00075   /// Gets the first topic in the topic list
00076   DCPS_IR_Topic* get_first_topic();
00077 
00078   /// Tries to associate the publication will each of
00079   ///  the subscriptions in the subscription list
00080   void try_associate_publication(DCPS_IR_Publication* publication);
00081 
00082   /// Tries to associate the subscription will each of
00083   ///  the publications in each topic in the topic list
00084   void try_associate_subscription(DCPS_IR_Subscription* subscription);
00085 
00086   /// Checks to see if the publication and subscription can
00087   ///  be associated.
00088   bool try_associate(DCPS_IR_Publication* publication,
00089                      DCPS_IR_Subscription* subscription);
00090 
00091   /// Associate the publication and subscription
00092   void associate(DCPS_IR_Publication* publication,
00093                  DCPS_IR_Subscription* subscription);
00094 
00095   /// Re-evaluate the association between the provided publication and
00096   /// the subscriptions it maintains.
00097   void reevaluate_associations(DCPS_IR_Publication* publication);
00098 
00099   /// Re-evaluate the association between the provided subscription and
00100   /// the publications in all its maintained topics.
00101   void reevaluate_associations(DCPS_IR_Subscription* subscription);
00102 
00103   const char* get_name() const ;
00104   const char* get_dataTypeName() const;
00105 
00106   /// Returns the number of topics
00107   CORBA::ULong get_number_topics() const;
00108 
00109   std::string dump_to_string(const std::string& prefix, int depth) const;
00110 
00111 private:
00112   ACE_CString name_;
00113   ACE_CString dataTypeName_;
00114   DCPS_IR_Domain* domain_;
00115 
00116   DCPS_IR_Subscription_Set subscriptionRefs_;
00117   DCPS_IR_Topic_Set topics_;
00118 };
00119 
00120 OPENDDS_END_VERSIONED_NAMESPACE_DECL
00121 
00122 #endif /* DCPS_IR_TOPIC_DESCRIPTION_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1