DataReaderRemoteImpl.cpp

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 #include "DataReaderRemoteImpl.h"
00009 #include "dds/DCPS/DataReaderCallbacks.h"
00010 
00011 namespace OpenDDS {
00012 namespace DCPS {
00013 
00014 DataReaderRemoteImpl::DataReaderRemoteImpl(DataReaderCallbacks* parent) :
00015     parent_(parent)
00016 {
00017 }
00018 
00019 // This method is called when there are no longer any reference to the
00020 // the servant.
00021 DataReaderRemoteImpl::~DataReaderRemoteImpl()
00022 {
00023 }
00024 
00025 void
00026 DataReaderRemoteImpl::detach_parent()
00027 {
00028   ACE_GUARD(ACE_Thread_Mutex, g, this->mutex_);
00029   this->parent_ = 0;
00030 }
00031 
00032 namespace
00033 {
00034   DDS::DataReader_var getDataReader(DataReaderCallbacks* callbacks)
00035   {
00036     // the DataReaderCallbacks will always be a DataReader
00037     DDS::DataReader_var var =
00038       DDS::DataReader::_duplicate(dynamic_cast<DDS::DataReader*>(callbacks));
00039     return var;
00040   }
00041 }
00042 
00043 void
00044 DataReaderRemoteImpl::add_association(const RepoId& yourId,
00045                                       const WriterAssociation& writer,
00046                                       bool active)
00047 {
00048   DataReaderCallbacks* parent = 0;
00049   DDS::DataReader_var drv;
00050   {
00051     ACE_GUARD(ACE_Thread_Mutex, g, this->mutex_);
00052     drv = getDataReader(this->parent_);
00053     parent = this->parent_;
00054   }
00055   if (parent) {
00056     parent->add_association(yourId, writer, active);
00057   }
00058 }
00059 
00060 void
00061 DataReaderRemoteImpl::association_complete(const RepoId& remote_id)
00062 {
00063   DataReaderCallbacks* parent = 0;
00064   DDS::DataReader_var drv;
00065   {
00066     ACE_GUARD(ACE_Thread_Mutex, g, this->mutex_);
00067     drv = getDataReader(this->parent_);
00068     parent = this->parent_;
00069   }
00070   if (parent) {
00071     parent->association_complete(remote_id);
00072   }
00073 }
00074 
00075 void
00076 DataReaderRemoteImpl::remove_associations(const WriterIdSeq& writers,
00077                                           CORBA::Boolean notify_lost)
00078 {
00079   DataReaderCallbacks* parent = 0;
00080   DDS::DataReader_var drv;
00081   {
00082     ACE_GUARD(ACE_Thread_Mutex, g, this->mutex_);
00083     drv = getDataReader(this->parent_);
00084     parent = this->parent_;
00085   }
00086   if (parent) {
00087     parent->remove_associations(writers, notify_lost);
00088   }
00089 }
00090 
00091 void
00092 DataReaderRemoteImpl::update_incompatible_qos(
00093   const IncompatibleQosStatus& status)
00094 {
00095   DataReaderCallbacks* parent = 0;
00096   DDS::DataReader_var drv;
00097   {
00098     ACE_GUARD(ACE_Thread_Mutex, g, this->mutex_);
00099     drv = getDataReader(this->parent_);
00100     parent = this->parent_;
00101   }
00102   if (parent) {
00103     parent->update_incompatible_qos(status);
00104   }
00105 }
00106 
00107 } // namespace DCPS
00108 } // namespace OpenDDS

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