00001
00002
00003
00004
00005
00006
00007
00008 #include <algorithm>
00009
00010 namespace OpenDDS {
00011 namespace DCPS {
00012
00013 ACE_INLINE
00014 DataSampleElement::DataSampleElement(
00015 PublicationId publication_id,
00016 TransportSendListener* send_listener,
00017 PublicationInstance* handle,
00018 TransportSendElementAllocator* tse_allocator,
00019 TransportCustomizedElementAllocator* tce_allocator)
00020 : transaction_id_(0),
00021 sample_(0),
00022 publication_id_(publication_id),
00023 num_subs_(0),
00024 send_listener_(send_listener),
00025 handle_(handle),
00026 transport_send_element_allocator_(tse_allocator),
00027 transport_customized_element_allocator_(tce_allocator),
00028 previous_writer_sample_(0),
00029 next_writer_sample_(0),
00030 next_instance_sample_(0),
00031 next_send_sample_(0),
00032 previous_send_sample_(0)
00033
00034 {
00035 std::fill(subscription_ids_,
00036 subscription_ids_ + OpenDDS::DCPS::MAX_READERS_PER_ELEM,
00037 GUID_UNKNOWN);
00038 }
00039
00040 ACE_INLINE
00041 DataSampleElement::DataSampleElement(const DataSampleElement& elem)
00042 : transaction_id_(elem.transaction_id_)
00043 , header_(elem.header_)
00044 , sample_(elem.sample_->duplicate())
00045 , publication_id_(elem.publication_id_)
00046 , num_subs_(elem.num_subs_)
00047 , send_listener_(elem.send_listener_)
00048 , handle_(elem.handle_)
00049 , transport_send_element_allocator_(
00050 elem.transport_send_element_allocator_)
00051 , transport_customized_element_allocator_(
00052 elem.transport_customized_element_allocator_)
00053 , filter_out_(elem.filter_out_)
00054 , filter_per_link_(elem.filter_per_link_)
00055 , previous_writer_sample_(elem.previous_writer_sample_)
00056 , next_writer_sample_(elem.next_writer_sample_)
00057 , next_instance_sample_(elem.next_instance_sample_)
00058 , next_send_sample_(elem.next_send_sample_)
00059 , previous_send_sample_(elem.previous_send_sample_)
00060
00061 {
00062 std::copy(elem.subscription_ids_,
00063 elem.subscription_ids_ + num_subs_,
00064 subscription_ids_);
00065 }
00066
00067 ACE_INLINE
00068 DataSampleElement::~DataSampleElement()
00069 {
00070 if (sample_) {
00071 sample_->release();
00072 }
00073 }
00074
00075 ACE_INLINE
00076 DataSampleElement&
00077 DataSampleElement::operator=(const DataSampleElement& rhs)
00078 {
00079 transaction_id_ = rhs.transaction_id_;
00080 header_ = rhs.header_;
00081 sample_ = rhs.sample_->duplicate();
00082 publication_id_ = rhs.publication_id_;
00083 num_subs_ = rhs.num_subs_;
00084
00085 std::copy(rhs.subscription_ids_,
00086 rhs.subscription_ids_ + num_subs_,
00087 subscription_ids_);
00088
00089 previous_writer_sample_ = rhs.previous_writer_sample_;
00090 next_writer_sample_ = rhs.next_writer_sample_;
00091 next_instance_sample_ = rhs.next_instance_sample_;
00092 next_send_sample_ = rhs.next_send_sample_;
00093 previous_send_sample_ = rhs.previous_send_sample_;
00094 send_listener_ = rhs.send_listener_;
00095 handle_ = rhs.handle_;
00096 transport_send_element_allocator_ = rhs.transport_send_element_allocator_;
00097 transport_customized_element_allocator_ =
00098 rhs.transport_customized_element_allocator_;
00099 filter_out_ = rhs.filter_out_;
00100 filter_per_link_ = rhs.filter_per_link_;
00101
00102 return *this;
00103 }
00104
00105 ACE_INLINE
00106 DataSampleElement*
00107 DataSampleElement::get_next_send_sample() const
00108 {
00109 return next_send_sample_;
00110 };
00111
00112 ACE_INLINE
00113 void
00114 DataSampleElement::set_next_send_sample(DataSampleElement* next_send_sample)
00115 {
00116 this->next_send_sample_ = next_send_sample;
00117 };
00118
00119 ACE_INLINE
00120 const DataSampleHeader&
00121 DataSampleElement::get_header() const
00122 {
00123 return header_;
00124 }
00125
00126 ACE_INLINE
00127 DataSampleHeader&
00128 DataSampleElement::get_header()
00129 {
00130 return const_cast<DataSampleHeader&>(static_cast<const DataSampleElement &>(*this).get_header());
00131 }
00132
00133 ACE_INLINE
00134 DataSample*
00135 DataSampleElement::get_sample() const
00136 {
00137 return sample_;
00138 }
00139
00140 ACE_INLINE
00141 DataSample*
00142 DataSampleElement::get_sample()
00143 {
00144 return sample_;
00145 }
00146
00147 ACE_INLINE
00148 void
00149 DataSampleElement::set_sample(DataSample* sample)
00150 {
00151 this->sample_ = sample;
00152 }
00153
00154 ACE_INLINE
00155 PublicationId
00156 DataSampleElement::get_pub_id() const
00157 {
00158 return publication_id_;
00159 }
00160
00161 ACE_INLINE
00162 CORBA::ULong
00163 DataSampleElement::get_num_subs() const
00164 {
00165 return num_subs_;
00166 }
00167
00168 ACE_INLINE
00169 void
00170 DataSampleElement::set_num_subs(int num_subs)
00171 {
00172 this->num_subs_ = num_subs;
00173 }
00174
00175 ACE_INLINE
00176 const OpenDDS::DCPS::RepoId*
00177 DataSampleElement::get_sub_ids() const
00178 {
00179 return subscription_ids_;
00180 }
00181
00182 ACE_INLINE
00183 OpenDDS::DCPS::RepoId
00184 DataSampleElement::get_sub_id(int index) const
00185 {
00186 return subscription_ids_[index];
00187 }
00188
00189 ACE_INLINE
00190 void
00191 DataSampleElement::set_sub_id(int index, OpenDDS::DCPS::RepoId id)
00192 {
00193 this->subscription_ids_[index] = id;
00194 }
00195
00196 ACE_INLINE
00197 TransportSendListener*
00198 DataSampleElement::get_send_listener() const
00199 {
00200 return send_listener_;
00201 }
00202
00203 ACE_INLINE
00204 TransportSendListener*
00205 DataSampleElement::get_send_listener()
00206 {
00207 return send_listener_;
00208 }
00209
00210 ACE_INLINE
00211 PublicationInstance*
00212 DataSampleElement::get_handle() const
00213 {
00214 return handle_;
00215 }
00216
00217 ACE_INLINE
00218 TransportSendElementAllocator*
00219 DataSampleElement::get_transport_send_element_allocator() const
00220 {
00221 return transport_send_element_allocator_;
00222 }
00223
00224 ACE_INLINE
00225 TransportCustomizedElementAllocator*
00226 DataSampleElement::get_transport_customized_element_allocator() const
00227 {
00228 return transport_customized_element_allocator_;
00229 }
00230
00231 ACE_INLINE
00232 DataSampleElement::DataLinkIdTypeGUIDMap&
00233 DataSampleElement::get_filter_per_link()
00234 {
00235 return filter_per_link_;
00236 }
00237
00238 ACE_INLINE
00239 void
00240 DataSampleElement::set_filter_out(GUIDSeq *filter_out)
00241 {
00242 filter_out_ = filter_out;
00243 }
00244
00245 ACE_INLINE
00246 void
00247 DataSampleElement::set_transaction_id(ACE_UINT64 transaction_id)
00248 {
00249 transaction_id_ = transaction_id;
00250 }
00251
00252 ACE_INLINE
00253 ACE_UINT64
00254 DataSampleElement::transaction_id() const
00255 {
00256 return transaction_id_;
00257 }
00258
00259 }
00260 }