DCPSInfo_i.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 DCPSINFO_I_H
00009 #define DCPSINFO_I_H
00010 
00011 #include  "inforepo_export.h"
00012 #include /**/ "DCPS_IR_Topic.h"
00013 #include /**/ "DCPS_IR_Topic_Description.h"
00014 #include /**/ "DCPS_IR_Participant.h"
00015 #include /**/ "DCPS_IR_Publication.h"
00016 #include /**/ "DCPS_IR_Subscription.h"
00017 #include /**/ "DCPS_IR_Domain.h"
00018 #include "dds/DCPS/RepoIdGenerator.h"
00019 #include "FederationId.h"
00020 #include "UpdateManager.h"
00021 
00022 #include /**/ "dds/DCPS/InfoRepoDiscovery/InfoS.h"
00023 #include /**/ "dds/DCPS/InfoRepoDiscovery/DataReaderRemoteC.h"
00024 #include /**/ "dds/DCPS/InfoRepoDiscovery/DataWriterRemoteC.h"
00025 
00026 #include "tao/ORB_Core.h"
00027 
00028 #include <map>
00029 
00030 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00031 #pragma once
00032 #endif /* ACE_LACKS_PRAGMA_ONCE */
00033 
00034 // typedef declarations
00035 typedef std::map<DDS::DomainId_t, DCPS_IR_Domain*> DCPS_IR_Domain_Map;
00036 
00037 // Forward declaration
00038 namespace Update {
00039 class Manager;
00040 }
00041 
00042 class ShutdownInterface;
00043 
00044 /**
00045  * @class TAO_DDS_DCPSInfo_i
00046  *
00047  * @brief Implementation of the DCPSInfo
00048  *
00049  * This is the Information Repository object.  Clients of
00050  * the system will use the CORBA reference of this object.
00051  */
00052 class  OpenDDS_InfoRepoLib_Export TAO_DDS_DCPSInfo_i
00053   : public virtual POA_OpenDDS::DCPS::DCPSInfo,
00054     public ACE_Event_Handler {
00055 public:
00056   //Constructor
00057   TAO_DDS_DCPSInfo_i(
00058     CORBA::ORB_ptr orb,
00059     bool reincarnate,
00060     ShutdownInterface* shutdown,
00061     const TAO_DDS_DCPSFederationId& federation);
00062 
00063   //Destructor
00064   virtual ~TAO_DDS_DCPSInfo_i();
00065 
00066   virtual int handle_timeout(const ACE_Time_Value& now,
00067                              const void* arg);
00068 
00069   virtual CORBA::Boolean attach_participant(
00070     DDS::DomainId_t domainId,
00071     const OpenDDS::DCPS::RepoId& participantId);
00072 
00073   virtual OpenDDS::DCPS::TopicStatus assert_topic(
00074     OpenDDS::DCPS::RepoId_out topicId,
00075     DDS::DomainId_t domainId,
00076     const OpenDDS::DCPS::RepoId& participantId,
00077     const char * topicName,
00078     const char * dataTypeName,
00079     const DDS::TopicQos & qos,
00080     bool hasDcpsKey);
00081 
00082   /**
00083    * @brief Add a previously existing topic to the repository.
00084    *
00085    * @param topicId       the Topic Entity GUID Id to use.
00086    * @param domainId      the Domain in which the Topic is contained.
00087    * @param participantId the Participant in which the Topic is contained.
00088    * @param topicName     the name of the Topic.
00089    * @param dataTypeName  the name of the data type.
00090    * @param qos           the QoS value to use for the Topic.
00091    *
00092    * Adds a Topic Entity to the repository using a specified TopicId
00093    * value.  If the TopicId indicates that this Topic was created by
00094    * within this repository (the federation Id is the current repositories
00095    * federation Id), this method will ensure that any subsequent calls to
00096    * add a Topic and obtain a newly generated Id value will return an Id
00097    * value greater than the Id value of the current one.
00098    */
00099   bool add_topic(const OpenDDS::DCPS::RepoId& topicId,
00100                  DDS::DomainId_t domainId,
00101                  const OpenDDS::DCPS::RepoId& participantId,
00102                  const char* topicName,
00103                  const char* dataTypeName,
00104                  const DDS::TopicQos& qos);
00105 
00106   virtual OpenDDS::DCPS::TopicStatus find_topic(
00107     DDS::DomainId_t domainId,
00108     const char * topicName,
00109     CORBA::String_out dataTypeName,
00110     DDS::TopicQos_out qos,
00111     OpenDDS::DCPS::RepoId_out topicId);
00112 
00113   virtual OpenDDS::DCPS::TopicStatus remove_topic(
00114     DDS::DomainId_t domainId,
00115     const OpenDDS::DCPS::RepoId& participantId,
00116     const OpenDDS::DCPS::RepoId& topicId);
00117 
00118   virtual OpenDDS::DCPS::RepoId add_publication(
00119     DDS::DomainId_t domainId,
00120     const OpenDDS::DCPS::RepoId& participantId,
00121     const OpenDDS::DCPS::RepoId& topicId,
00122     OpenDDS::DCPS::DataWriterRemote_ptr publication,
00123     const DDS::DataWriterQos & qos,
00124     const OpenDDS::DCPS::TransportLocatorSeq & transInfo,
00125     const DDS::PublisherQos & publisherQos);
00126 
00127   /**
00128    * @brief Add a previously existing publication to the repository.
00129    *
00130    * @param domainId      the Domain in which the Publication is contained.
00131    * @param participantId the Participant in which the Publication is contained.
00132    * @param topicId       the Topic of the Publication.
00133    * @param pubId         the GUID Id value to use for the Publication.
00134    * @param pub_str       stringified publication callback to DataWriter.
00135    * @param qos           the QoS value of the DataWriter.
00136    * @param transInfo     the transport information for the Publication.
00137    * @param publisherQos  the QoS value of the Publisher.
00138    * @param associate     indicate whether to create new associations.
00139    *
00140    * Adds a Publication to the repository using a specified Publication
00141    * GUID Id value.  If the PublicationId indicates that this Publication
00142    * was created by within this repository (the federation Id is the
00143    * current repositories federation Id), this method will ensure that any
00144    * subsequent calls to add a Publication and obtain a newly generated
00145    * Id value will return an Id value greater than the Id value of the
00146    * current one.
00147    */
00148   bool add_publication(DDS::DomainId_t domainId,
00149                        const OpenDDS::DCPS::RepoId& participantId,
00150                        const OpenDDS::DCPS::RepoId& topicId,
00151                        const OpenDDS::DCPS::RepoId& pubId,
00152                        const char* pub_str,
00153                        const DDS::DataWriterQos & qos,
00154                        const OpenDDS::DCPS::TransportLocatorSeq & transInfo,
00155                        const DDS::PublisherQos & publisherQos,
00156                        bool associate = false);
00157 
00158   virtual void remove_publication(
00159     DDS::DomainId_t domainId,
00160     const OpenDDS::DCPS::RepoId& participantId,
00161     const OpenDDS::DCPS::RepoId& publicationId);
00162 
00163   virtual OpenDDS::DCPS::RepoId add_subscription(
00164     DDS::DomainId_t domainId,
00165     const OpenDDS::DCPS::RepoId& participantId,
00166     const OpenDDS::DCPS::RepoId& topicId,
00167     OpenDDS::DCPS::DataReaderRemote_ptr subscription,
00168     const DDS::DataReaderQos & qos,
00169     const OpenDDS::DCPS::TransportLocatorSeq & transInfo,
00170     const DDS::SubscriberQos & subscriberQos,
00171     const char* filterClassName,
00172     const char* filterExpression,
00173     const DDS::StringSeq& exprParams);
00174 
00175   /**
00176    * @brief Add a previously existing subscription to the repository.
00177    *
00178    * @param domainId      the Domain in which the Subscription is contained.
00179    * @param participantId the Participant in which the Subscription is contained.
00180    * @param topicId       the Topic of the Subscription.
00181    * @param subId         the GUID Id value to use for the Subscription.
00182    * @param sub_str       stringified publication callback to DataReader.
00183    * @param qos           the QoS value of the DataReader.
00184    * @param transInfo     the transport information for the Subscription.
00185    * @param subscriberQos the QoS value of the Subscriber.
00186    * @param associate     indicate whether to create new associations.
00187    *
00188    * Adds a Subscription to the repository using a specified Subscription
00189    * GUID Id value.  If the SubscriptionId indicates that this Subscription
00190    * was created by within this repository (the federation Id is the
00191    * current repositories federation Id), this method will ensure that any
00192    * subsequent calls to add a Publication and obtain a newly generated
00193    * Id value will return an Id value greater than the Id value of the
00194    * current one.
00195    */
00196   bool add_subscription(DDS::DomainId_t domainId,
00197                         const OpenDDS::DCPS::RepoId& participantId,
00198                         const OpenDDS::DCPS::RepoId& topicId,
00199                         const OpenDDS::DCPS::RepoId& subId,
00200                         const char* sub_str,
00201                         const DDS::DataReaderQos & qos,
00202                         const OpenDDS::DCPS::TransportLocatorSeq & transInfo,
00203                         const DDS::SubscriberQos & subscriberQos,
00204                         const char* filterClassName,
00205                         const char* filterExpression,
00206                         const DDS::StringSeq& exprParams,
00207                         bool associate = false);
00208 
00209   virtual void remove_subscription(
00210     DDS::DomainId_t domainId,
00211     const OpenDDS::DCPS::RepoId& participantId,
00212     const OpenDDS::DCPS::RepoId& subscriptionId);
00213 
00214   virtual OpenDDS::DCPS::AddDomainStatus add_domain_participant(
00215     DDS::DomainId_t domain,
00216     const DDS::DomainParticipantQos & qos);
00217 
00218   /**
00219    * @brief Add a previously existing participant to the repository.
00220    *
00221    * @param domainId      the Domain in which the Participant is contained.
00222    * @param participantId the GUID Id value to use for the Participant.
00223    * @param qos           the QoS value of the Participant.
00224    *
00225    * Adds a Participant to the repository using a specified Participant
00226    * GUID Id value.  If the ParticipantId indicates that this Participant
00227    * was created by within this repository (the federation Id is the
00228    * current repositories federation Id), this method will ensure that any
00229    * subsequent calls to add a Publication and obtain a newly generated
00230    * Id value will return an Id value greater than the Id value of the
00231    * current one.
00232    */
00233   bool add_domain_participant(DDS::DomainId_t domainId
00234                               , const OpenDDS::DCPS::RepoId& participantId
00235                               , const DDS::DomainParticipantQos & qos);
00236 
00237   virtual void remove_domain_participant(
00238     DDS::DomainId_t domainId,
00239     const OpenDDS::DCPS::RepoId& participantId);
00240 
00241   virtual void association_complete(DDS::DomainId_t domainId,
00242                                     const OpenDDS::DCPS::RepoId& participantId,
00243                                     const OpenDDS::DCPS::RepoId& localId,
00244                                     const OpenDDS::DCPS::RepoId& remoteId);
00245 
00246   bool remove_by_owner(
00247     DDS::DomainId_t domain,
00248     long              owner);
00249 
00250   virtual void disassociate_participant(
00251     DDS::DomainId_t domainId,
00252     const OpenDDS::DCPS::RepoId& local_id,
00253     const OpenDDS::DCPS::RepoId& remote_id);
00254 
00255   virtual void disassociate_subscription(
00256     DDS::DomainId_t domainId,
00257     const OpenDDS::DCPS::RepoId& participantId,
00258     const OpenDDS::DCPS::RepoId& local_id,
00259     const OpenDDS::DCPS::RepoId& remote_id);
00260 
00261   virtual void disassociate_publication(
00262     DDS::DomainId_t domainId,
00263     const OpenDDS::DCPS::RepoId& participantId,
00264     const OpenDDS::DCPS::RepoId& local_id,
00265     const OpenDDS::DCPS::RepoId& remote_id);
00266 
00267   virtual void ignore_domain_participant(
00268     DDS::DomainId_t domainId,
00269     const OpenDDS::DCPS::RepoId& myParticipantId,
00270     const OpenDDS::DCPS::RepoId& ignoreId);
00271 
00272   virtual void ignore_topic(
00273     DDS::DomainId_t domainId,
00274     const OpenDDS::DCPS::RepoId& myParticipantId,
00275     const OpenDDS::DCPS::RepoId& ignoreId);
00276 
00277   virtual void ignore_subscription(
00278     DDS::DomainId_t domainId,
00279     const OpenDDS::DCPS::RepoId& myParticipantId,
00280     const OpenDDS::DCPS::RepoId& ignoreId);
00281 
00282   virtual void ignore_publication(
00283     DDS::DomainId_t domainId,
00284     const OpenDDS::DCPS::RepoId& myParticipantId,
00285     const OpenDDS::DCPS::RepoId& ignoreId);
00286 
00287   virtual CORBA::Boolean update_publication_qos(
00288     DDS::DomainId_t domainId,
00289     const OpenDDS::DCPS::RepoId& partId,
00290     const OpenDDS::DCPS::RepoId& dwId,
00291     const DDS::DataWriterQos & qos,
00292     const DDS::PublisherQos & publisherQos);
00293 
00294   /// Entry for federation updates of DataWriterQos values.
00295   void update_publication_qos(
00296     DDS::DomainId_t            domainId,
00297     const OpenDDS::DCPS::RepoId& partId,
00298     const OpenDDS::DCPS::RepoId& dwId,
00299     const DDS::DataWriterQos&  qos);
00300 
00301   /// Entry for federation updates of PublisherQos values.
00302   void update_publication_qos(
00303     DDS::DomainId_t            domainId,
00304     const OpenDDS::DCPS::RepoId& partId,
00305     const OpenDDS::DCPS::RepoId& dwId,
00306     const DDS::PublisherQos&   qos);
00307 
00308   virtual CORBA::Boolean update_subscription_qos(
00309     DDS::DomainId_t domainId,
00310     const OpenDDS::DCPS::RepoId& partId,
00311     const OpenDDS::DCPS::RepoId& drId,
00312     const DDS::DataReaderQos & qos,
00313     const DDS::SubscriberQos & subscriberQos);
00314 
00315   /// Entry for federation updates of DataReaderQos values.
00316   void update_subscription_qos(
00317     DDS::DomainId_t            domainId,
00318     const OpenDDS::DCPS::RepoId& partId,
00319     const OpenDDS::DCPS::RepoId& drId,
00320     const DDS::DataReaderQos&  qos);
00321 
00322   /// Entry for federation updates of SubscriberQos values.
00323   void update_subscription_qos(
00324     DDS::DomainId_t            domainId,
00325     const OpenDDS::DCPS::RepoId& partId,
00326     const OpenDDS::DCPS::RepoId& drId,
00327     const DDS::SubscriberQos&  qos);
00328 
00329   virtual ::CORBA::Boolean update_subscription_params(
00330     DDS::DomainId_t domainId,
00331     const OpenDDS::DCPS::RepoId& participantId,
00332     const OpenDDS::DCPS::RepoId& subscriptionId,
00333     const DDS::StringSeq& params);
00334 
00335   virtual CORBA::Boolean update_topic_qos(
00336     const OpenDDS::DCPS::RepoId& topicId,
00337     DDS::DomainId_t domainId,
00338     const OpenDDS::DCPS::RepoId& participantId,
00339     const DDS::TopicQos & qos);
00340 
00341   virtual CORBA::Boolean update_domain_participant_qos(
00342     DDS::DomainId_t domain,
00343     const OpenDDS::DCPS::RepoId& participantId,
00344     const DDS::DomainParticipantQos & qos);
00345 
00346   /// Cause the entire repository to exit.
00347   virtual void shutdown();
00348 
00349   /// Dump the Repos state to string.
00350   virtual char* dump_to_string();
00351 
00352   /**
00353    * @brief assert new ownership for a participant and its contained entities.
00354    *
00355    * @param domainId      the domain in which the participant resides.
00356    * @param participantId the participant to be owned.
00357    * @param sender        the repository sending the update data.
00358    * @param owner         the repository which is to make callbacks for
00359    *                      entities within the participant.
00360    * @return boolean indicating that ownership has been assigned.
00361    *
00362    * This establishes @c owner as the new owner of the participant.
00363    * Ownership consists of calling back to the reader and writer remote
00364    * interfaces when associations are established and removed from a
00365    * publication or subscription.  Owner may be the special value of
00366    * OWNER_NONE to indicate that the previous owner is no longer
00367    * available to make callbacks and the application has not indicated
00368    * which repository is to replace it in this capacity.
00369    *
00370    * The @c sender of the update is included so that the participant can
00371    * check that transitions to OWNER_NONE are only honored when initiated
00372    * by the current owner of the participant.
00373    *
00374    * A return value of @c false indicates that the ownership was
00375    * specified for a domain or participant which could not be found.
00376    */
00377   bool changeOwnership(
00378     DDS::DomainId_t              domainId,
00379     const OpenDDS::DCPS::RepoId& participantId,
00380     long                           sender,
00381     long                           owner);
00382 
00383   /// Initialize the transport for the Built-In Topics
00384   /// Returns 0 (zero) if succeeds
00385   int init_transport(int listen_address_given,
00386                      const char* listen_str);
00387 
00388   bool receive_image(const Update::UImage& image);
00389 
00390   /// Add an additional Updater interface.
00391   void add(Update::Updater* updater);
00392 
00393   /// Convert a domain Id into a reference to a DCPS_IR_Domain object.
00394   DCPS_IR_Domain* domain(DDS::DomainId_t domain);
00395 
00396   /// Expose a readable reference of the domain map.
00397   const DCPS_IR_Domain_Map& domains() const;
00398 
00399   /// Expose the ORB.
00400   CORBA::ORB_ptr orb();
00401 
00402   bool init_persistence();
00403 
00404   bool init_reassociation(const ACE_Time_Value& delay);
00405 
00406   bool init_dispatchChecking(const ACE_Time_Value& delay);
00407 
00408   /// Cleanup state for shutdown.
00409   void finalize();
00410 
00411 private:
00412   DCPS_IR_Domain_Map domains_;
00413   CORBA::ORB_var orb_;
00414   CORBA::ORB_var dispatchingOrb_;
00415 
00416   const TAO_DDS_DCPSFederationId& federation_;
00417   RepoIdGenerator participantIdGenerator_;
00418 
00419   Update::Manager* um_;
00420   bool reincarnate_;
00421 
00422   /// Interface to effect shutdown of the process.
00423   ShutdownInterface* shutdown_;
00424 
00425   ACE_Recursive_Thread_Mutex lock_;
00426 
00427   long reassociate_timer_id_;
00428   long dispatch_check_timer_id_;
00429 };
00430 
00431 #endif /* DCPSINFO_I_H */

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