#include <DataDurabilityCache.h>
Collaboration diagram for OpenDDS::DCPS::DataDurabilityCache::sample_data_type:
Public Member Functions | |
sample_data_type () | |
sample_data_type (DataSampleElement &element, ACE_Allocator *allocator) | |
sample_data_type (DDS::Time_t timestamp, const ACE_Message_Block &mb, ACE_Allocator *allocator) | |
sample_data_type (sample_data_type const &rhs) | |
~sample_data_type () | |
sample_data_type & | operator= (sample_data_type const &rhs) |
void | get_sample (char const *&s, size_t &len, DDS::Time_t &source_timestamp) |
void | set_allocator (ACE_Allocator *allocator) |
Private Member Functions | |
void | init (const ACE_Message_Block *data) |
Private Attributes | |
size_t | length_ |
char * | sample_ |
DDS::Time_t | source_timestamp_ |
ACE_Allocator * | allocator_ |
Definition at line 143 of file DataDurabilityCache.h.
OpenDDS::DCPS::DataDurabilityCache::sample_data_type::sample_data_type | ( | ) |
Definition at line 168 of file DataDurabilityCache.cpp.
00169 : length_(0) 00170 , sample_(0) 00171 , allocator_(0) 00172 { 00173 this->source_timestamp_.sec = 0; 00174 this->source_timestamp_.nanosec = 0; 00175 }
OpenDDS::DCPS::DataDurabilityCache::sample_data_type::sample_data_type | ( | DataSampleElement & | element, | |
ACE_Allocator * | allocator | |||
) |
Definition at line 177 of file DataDurabilityCache.cpp.
References OpenDDS::DCPS::DataSampleElement::get_header(), OpenDDS::DCPS::DataSampleElement::get_sample(), init(), DDS::Time_t::nanosec, DDS::Time_t::sec, source_timestamp_, OpenDDS::DCPS::DataSampleHeader::source_timestamp_nanosec_, and OpenDDS::DCPS::DataSampleHeader::source_timestamp_sec_.
00180 : length_(0) 00181 , sample_(0) 00182 , allocator_(a) 00183 { 00184 this->source_timestamp_.sec = element.get_header().source_timestamp_sec_; 00185 this->source_timestamp_.nanosec = element.get_header().source_timestamp_nanosec_; 00186 00187 // Only copy the data provided by the user. The DataSampleHeader 00188 // will be reconstructed when the durable data is retrieved by a 00189 // DataWriterImpl instance. 00190 // 00191 // The user's data is stored in the first message block 00192 // continuation. 00193 ACE_Message_Block const * const data = element.get_sample()->cont(); 00194 init(data); 00195 }
OpenDDS::DCPS::DataDurabilityCache::sample_data_type::sample_data_type | ( | DDS::Time_t | timestamp, | |
const ACE_Message_Block & | mb, | |||
ACE_Allocator * | allocator | |||
) |
Definition at line 197 of file DataDurabilityCache.cpp.
References init().
00199 : length_(0) 00200 , sample_(0) 00201 , source_timestamp_(timestamp) 00202 , allocator_(a) 00203 { 00204 init(&mb); 00205 }
OpenDDS::DCPS::DataDurabilityCache::sample_data_type::sample_data_type | ( | sample_data_type const & | rhs | ) |
Definition at line 227 of file DataDurabilityCache.cpp.
References length_, DDS::Time_t::nanosec, sample_, DDS::Time_t::sec, and source_timestamp_.
00229 : length_(rhs.length_) 00230 , sample_(0) 00231 , allocator_(rhs.allocator_) 00232 { 00233 this->source_timestamp_.sec = rhs.source_timestamp_.sec; 00234 this->source_timestamp_.nanosec = rhs.source_timestamp_.nanosec; 00235 00236 if (this->allocator_) { 00237 ACE_ALLOCATOR(this->sample_, 00238 static_cast<char *>( 00239 this->allocator_->malloc(rhs.length_))); 00240 ACE_OS::memcpy(this->sample_, rhs.sample_, rhs.length_); 00241 } 00242 }
OpenDDS::DCPS::DataDurabilityCache::sample_data_type::~sample_data_type | ( | ) |
Definition at line 244 of file DataDurabilityCache.cpp.
References allocator_.
00245 { 00246 if (this->allocator_) 00247 this->allocator_->free(this->sample_); 00248 }
void OpenDDS::DCPS::DataDurabilityCache::sample_data_type::get_sample | ( | char const *& | s, | |
size_t & | len, | |||
DDS::Time_t & | source_timestamp | |||
) |
Definition at line 267 of file DataDurabilityCache.cpp.
References length_, DDS::Time_t::nanosec, sample_, DDS::Time_t::sec, and source_timestamp_.
Referenced by OpenDDS::DCPS::DataDurabilityCache::get_data(), and OpenDDS::DCPS::DataDurabilityCache::insert().
00271 { 00272 s = this->sample_; 00273 len = this->length_; 00274 source_timestamp.sec = this->source_timestamp_.sec; 00275 source_timestamp.nanosec = this->source_timestamp_.nanosec; 00276 }
void OpenDDS::DCPS::DataDurabilityCache::sample_data_type::init | ( | const ACE_Message_Block * | data | ) | [private] |
Definition at line 209 of file DataDurabilityCache.cpp.
Referenced by sample_data_type().
00210 { 00211 this->length_ = data->total_length(); 00212 00213 ACE_ALLOCATOR(this->sample_, 00214 static_cast<char *>( 00215 this->allocator_->malloc(this->length_))); 00216 00217 char * buf = this->sample_; 00218 00219 for (ACE_Message_Block const * i = data; 00220 i != 0; 00221 i = i->cont()) { 00222 ACE_OS::memcpy(buf, i->rd_ptr(), i->length()); 00223 buf += i->length(); 00224 } 00225 }
OpenDDS::DCPS::DataDurabilityCache::sample_data_type & OpenDDS::DCPS::DataDurabilityCache::sample_data_type::operator= | ( | sample_data_type const & | rhs | ) |
Definition at line 251 of file DataDurabilityCache.cpp.
References allocator_, length_, DDS::Time_t::nanosec, sample_, DDS::Time_t::sec, source_timestamp_, and OpenDDS::DCPS::swap().
00253 { 00254 // Strongly exception-safe copy assignment. 00255 sample_data_type tmp(rhs); 00256 std::swap(this->length_, tmp.length_); 00257 std::swap(this->sample_, tmp.sample_); 00258 std::swap(this->allocator_, tmp.allocator_); 00259 00260 this->source_timestamp_.sec = rhs.source_timestamp_.sec; 00261 this->source_timestamp_.nanosec = rhs.source_timestamp_.nanosec; 00262 00263 return *this; 00264 }
void OpenDDS::DCPS::DataDurabilityCache::sample_data_type::set_allocator | ( | ACE_Allocator * | allocator | ) |
Definition at line 279 of file DataDurabilityCache.cpp.
References allocator_.
00281 { 00282 this->allocator_ = allocator; 00283 }
Definition at line 170 of file DataDurabilityCache.h.
Referenced by operator=(), set_allocator(), and ~sample_data_type().
size_t OpenDDS::DCPS::DataDurabilityCache::sample_data_type::length_ [private] |
Definition at line 167 of file DataDurabilityCache.h.
Referenced by get_sample(), operator=(), and sample_data_type().
char* OpenDDS::DCPS::DataDurabilityCache::sample_data_type::sample_ [private] |
Definition at line 168 of file DataDurabilityCache.h.
Referenced by get_sample(), operator=(), and sample_data_type().
Definition at line 169 of file DataDurabilityCache.h.
Referenced by get_sample(), operator=(), and sample_data_type().