Discovery.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_DDS_DCPS_DISCOVERY_H
00009 #define OPENDDS_DDS_DCPS_DISCOVERY_H
00010 
00011 #include "dds/DdsDcpsInfoUtilsC.h"
00012 #include "RcObject_T.h"
00013 #include "RcHandle_T.h"
00014 
00015 #include "dds/DCPS/DataReaderCallbacks.h"
00016 #include "dds/DCPS/DataWriterCallbacks.h"
00017 #include "dds/DdsDcpsSubscriptionC.h"
00018 
00019 #include "dds/DCPS/PoolAllocator.h"
00020 #include "dds/DCPS/PoolAllocationBase.h"
00021 
00022 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00023 #pragma once
00024 #endif /* ACE_LACKS_PRAGMA_ONCE */
00025 
00026 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00027 class ACE_Configuration_Heap;
00028 ACE_END_VERSIONED_NAMESPACE_DECL
00029 
00030 namespace OpenDDS {
00031 namespace DCPS {
00032 
00033 class DomainParticipantImpl;
00034 class DataWriterImpl;
00035 class DataReaderImpl;
00036 
00037 /**
00038  * @class Discovery
00039  *
00040  * @brief Discovery Strategy interface class
00041  *
00042  * This class is an abstract class that acts as an interface for both
00043  * InfoRepo-based discovery and RTPS Discovery.
00044  *
00045  */
00046 class OpenDDS_Dcps_Export Discovery : public RcObject<ACE_SYNCH_MUTEX> {
00047 public:
00048   /// Key type for storing discovery objects.
00049   /// Probably should just be Discovery::Key
00050   typedef OPENDDS_STRING RepoKey;
00051 
00052   explicit Discovery(const RepoKey& key) : key_(key) { }
00053 
00054   /// Key value for the default repository IOR.
00055   static const char DEFAULT_REPO[];
00056   static const char DEFAULT_RTPS[];
00057   static const char DEFAULT_STATIC[];
00058 
00059   // TODO: NEED TO REMOVE THIS once Service_Participant::repository_lost has been refactored
00060   virtual bool active() { return true; }
00061 
00062   virtual DDS::Subscriber_ptr init_bit(DomainParticipantImpl* participant) = 0;
00063 
00064   virtual void fini_bit(DCPS::DomainParticipantImpl* participant) = 0;
00065 
00066   virtual RepoId bit_key_to_repo_id(DomainParticipantImpl* participant,
00067                                     const char* bit_topic_name,
00068                                     const DDS::BuiltinTopicKey_t& key) const = 0;
00069 
00070   RepoKey key() const { return this->key_; }
00071 
00072   class OpenDDS_Dcps_Export Config : public PoolAllocationBase {
00073   public:
00074     virtual ~Config();
00075     virtual int discovery_config(ACE_Configuration_Heap& cf) = 0;
00076   };
00077 
00078   virtual bool attach_participant(
00079     DDS::DomainId_t domainId,
00080     const RepoId& participantId) = 0;
00081 
00082   virtual AddDomainStatus add_domain_participant(
00083     DDS::DomainId_t domain,
00084     const DDS::DomainParticipantQos& qos) = 0;
00085 
00086   virtual bool remove_domain_participant(
00087     DDS::DomainId_t domainId,
00088     const RepoId& participantId) = 0;
00089 
00090   virtual bool ignore_domain_participant(
00091     DDS::DomainId_t domainId,
00092     const RepoId& myParticipantId,
00093     const RepoId& ignoreId) = 0;
00094 
00095   virtual bool update_domain_participant_qos(
00096     DDS::DomainId_t domain,
00097     const RepoId& participantId,
00098     const DDS::DomainParticipantQos& qos) = 0;
00099 
00100 
00101   // Topic operations:
00102 
00103   virtual TopicStatus assert_topic(
00104     RepoId_out topicId,
00105     DDS::DomainId_t domainId,
00106     const RepoId& participantId,
00107     const char* topicName,
00108     const char* dataTypeName,
00109     const DDS::TopicQos& qos,
00110     bool hasDcpsKey) = 0;
00111 
00112   virtual TopicStatus find_topic(
00113     DDS::DomainId_t domainId,
00114     const char* topicName,
00115     CORBA::String_out dataTypeName,
00116     DDS::TopicQos_out qos,
00117     RepoId_out topicId) = 0;
00118 
00119   virtual TopicStatus remove_topic(
00120     DDS::DomainId_t domainId,
00121     const RepoId& participantId,
00122     const RepoId& topicId) = 0;
00123 
00124   virtual bool ignore_topic(
00125     DDS::DomainId_t domainId,
00126     const RepoId& myParticipantId,
00127     const RepoId& ignoreId) = 0;
00128 
00129   virtual bool update_topic_qos(
00130     const RepoId& topicId,
00131     DDS::DomainId_t domainId,
00132     const RepoId& participantId,
00133     const DDS::TopicQos& qos) = 0;
00134 
00135 
00136   // Publication operations:
00137 
00138   virtual void pre_writer(DataWriterImpl*) {}
00139 
00140   /// add the passed in publication into discovery.
00141   /// Discovery does not participate in memory management
00142   /// for the publication pointer, so it requires that
00143   /// the publication pointer remain valid until
00144   /// remove_publication is called.
00145   virtual RepoId add_publication(
00146     DDS::DomainId_t domainId,
00147     const RepoId& participantId,
00148     const RepoId& topicId,
00149     DataWriterCallbacks* publication,
00150     const DDS::DataWriterQos& qos,
00151     const TransportLocatorSeq& transInfo,
00152     const DDS::PublisherQos& publisherQos) = 0;
00153 
00154   virtual bool remove_publication(
00155     DDS::DomainId_t domainId,
00156     const RepoId& participantId,
00157     const RepoId& publicationId) = 0;
00158 
00159   virtual bool ignore_publication(
00160     DDS::DomainId_t domainId,
00161     const RepoId& myParticipantId,
00162     const RepoId& ignoreId) = 0;
00163 
00164   virtual bool update_publication_qos(
00165     DDS::DomainId_t domainId,
00166     const RepoId& partId,
00167     const RepoId& dwId,
00168     const DDS::DataWriterQos& qos,
00169     const DDS::PublisherQos& publisherQos) = 0;
00170 
00171 
00172   // Subscription operations:
00173 
00174   virtual void pre_reader(DataReaderImpl*) {}
00175 
00176   /// add the passed in subscription into discovery.
00177   /// Discovery does not participate in memory management
00178   /// for the subscription pointer, so it requires that
00179   /// the subscription pointer remain valid until
00180   /// remove_subscription is called.
00181   virtual RepoId add_subscription(
00182     DDS::DomainId_t domainId,
00183     const RepoId& participantId,
00184     const RepoId& topicId,
00185     DataReaderCallbacks* subscription,
00186     const DDS::DataReaderQos& qos,
00187     const TransportLocatorSeq& transInfo,
00188     const DDS::SubscriberQos& subscriberQos,
00189     const char* filterClassName,
00190     const char* filterExpression,
00191     const DDS::StringSeq& exprParams) = 0;
00192 
00193   virtual bool remove_subscription(
00194     DDS::DomainId_t domainId,
00195     const RepoId& participantId,
00196     const RepoId& subscriptionId) = 0;
00197 
00198   virtual bool ignore_subscription(
00199     DDS::DomainId_t domainId,
00200     const RepoId& myParticipantId,
00201     const RepoId& ignoreId) = 0;
00202 
00203   virtual bool update_subscription_qos(
00204     DDS::DomainId_t domainId,
00205     const RepoId& partId,
00206     const RepoId& drId,
00207     const DDS::DataReaderQos& qos,
00208     const DDS::SubscriberQos& subscriberQos) = 0;
00209 
00210   virtual bool update_subscription_params(
00211     DDS::DomainId_t domainId,
00212     const RepoId& participantId,
00213     const RepoId& subscriptionId,
00214     const DDS::StringSeq& params) = 0;
00215 
00216 
00217   // Managing reader/writer associations:
00218 
00219   virtual void association_complete(
00220     DDS::DomainId_t domainId,
00221     const RepoId& participantId,
00222     const RepoId& localId,
00223     const RepoId& remoteId) = 0;
00224 
00225   virtual bool supports_liveliness() const { return false; }
00226 
00227   virtual void signal_liveliness(const DDS::DomainId_t /*domain_id*/,
00228                                  const RepoId& /*part_id*/,
00229                                  DDS::LivelinessQosPolicyKind /*kind*/) { }
00230 
00231 protected:
00232   DDS::ReturnCode_t create_bit_topics(DomainParticipantImpl* participant);
00233 
00234 private:
00235   RepoKey        key_;
00236 
00237 };
00238 
00239 typedef RcHandle<Discovery> Discovery_rch;
00240 
00241 } // namespace DCPS
00242 } // namespace OpenDDS
00243 
00244 #endif /* OPENDDS_DCPS_DISCOVERY_H  */

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