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

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