00001
00002
00003
00004
00005
00006
00007
00008 #include "DataWriterRemoteImpl.h"
00009 #include "dds/DCPS/DataWriterCallbacks.h"
00010 #include "dds/DCPS/GuidConverter.h"
00011
00012 namespace OpenDDS {
00013 namespace DCPS {
00014
00015 DataWriterRemoteImpl::DataWriterRemoteImpl(DataWriterCallbacks* parent)
00016 : parent_(parent)
00017 {
00018 }
00019
00020
00021
00022 DataWriterRemoteImpl::~DataWriterRemoteImpl()
00023 {
00024 }
00025
00026 void
00027 DataWriterRemoteImpl::detach_parent()
00028 {
00029 ACE_GUARD(ACE_Thread_Mutex, g, this->mutex_);
00030 this->parent_ = 0;
00031 }
00032
00033 namespace
00034 {
00035 DDS::DataWriter_var getDataWriter(DataWriterCallbacks* callbacks)
00036 {
00037
00038 DDS::DataWriter_var var =
00039 DDS::DataWriter::_duplicate(dynamic_cast<DDS::DataWriter*>(callbacks));
00040 return var;
00041 }
00042 }
00043
00044 void
00045 DataWriterRemoteImpl::add_association(const RepoId& yourId,
00046 const ReaderAssociation& reader,
00047 bool active)
00048 {
00049 if (DCPS_debug_level) {
00050 GuidConverter writer_converter(yourId);
00051 GuidConverter reader_converter(reader.readerId);
00052 ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) DataWriterRemoteImpl::add_association - ")
00053 ACE_TEXT("local %C remote %C\n"),
00054 std::string(writer_converter).c_str(),
00055 std::string(reader_converter).c_str()));
00056 }
00057
00058 DataWriterCallbacks* parent = 0;
00059 DDS::DataWriter_var dwv;
00060 {
00061 ACE_GUARD(ACE_Thread_Mutex, g, this->mutex_);
00062 dwv = getDataWriter(this->parent_);
00063 parent = this->parent_;
00064 }
00065 if (parent) {
00066 parent->add_association(yourId, reader, active);
00067 }
00068 }
00069
00070 void
00071 DataWriterRemoteImpl::association_complete(const RepoId& remote_id)
00072 {
00073 DataWriterCallbacks* parent = 0;
00074 DDS::DataWriter_var dwv;
00075 {
00076 ACE_GUARD(ACE_Thread_Mutex, g, this->mutex_);
00077 dwv = getDataWriter(this->parent_);
00078 parent = this->parent_;
00079 }
00080 if (parent) {
00081 parent->association_complete(remote_id);
00082 }
00083 }
00084
00085 void
00086 DataWriterRemoteImpl::remove_associations(const ReaderIdSeq& readers,
00087 CORBA::Boolean notify_lost)
00088 {
00089 DataWriterCallbacks* parent = 0;
00090 DDS::DataWriter_var dwv;
00091 {
00092 ACE_GUARD(ACE_Thread_Mutex, g, this->mutex_);
00093 dwv = getDataWriter(this->parent_);
00094 parent = this->parent_;
00095 }
00096 if (parent) {
00097 parent->remove_associations(readers, notify_lost);
00098 }
00099 }
00100
00101 void
00102 DataWriterRemoteImpl::update_incompatible_qos(
00103 const IncompatibleQosStatus& status)
00104 {
00105 DataWriterCallbacks* parent = 0;
00106 DDS::DataWriter_var dwv;
00107 {
00108 ACE_GUARD(ACE_Thread_Mutex, g, this->mutex_);
00109 dwv = getDataWriter(this->parent_);
00110 parent = this->parent_;
00111 }
00112 if (parent) {
00113 parent->update_incompatible_qos(status);
00114 }
00115 }
00116
00117 void
00118 DataWriterRemoteImpl::update_subscription_params(const RepoId& readerId,
00119 const DDS::StringSeq& params)
00120 {
00121 DataWriterCallbacks* parent = 0;
00122 DDS::DataWriter_var dwv;
00123 {
00124 ACE_GUARD(ACE_Thread_Mutex, g, this->mutex_);
00125 dwv = getDataWriter(this->parent_);
00126 parent = this->parent_;
00127 }
00128 if (parent) {
00129 parent->update_subscription_params(readerId, params);
00130 }
00131 }
00132
00133 }
00134 }