OpenDDS::DCPS::DataDurabilityCache::sample_data_type Class Reference

Sample list data type for all samples. More...

#include <DataDurabilityCache.h>

Collaboration diagram for OpenDDS::DCPS::DataDurabilityCache::sample_data_type:
Collaboration graph
[legend]

List of all members.

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_typeoperator= (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_Allocatorallocator_

Detailed Description

Sample list data type for all samples.

Definition at line 147 of file DataDurabilityCache.h.


Constructor & Destructor Documentation

OpenDDS::DCPS::DataDurabilityCache::sample_data_type::sample_data_type (  ) 

Definition at line 167 of file DataDurabilityCache.cpp.

00168   : length_(0)
00169   , sample_(0)
00170   , allocator_(0)
00171 {
00172   this->source_timestamp_.sec = 0;
00173   this->source_timestamp_.nanosec = 0;
00174 }

OpenDDS::DCPS::DataDurabilityCache::sample_data_type::sample_data_type ( DataSampleElement element,
ACE_Allocator allocator 
)

Definition at line 176 of file DataDurabilityCache.cpp.

References ACE_Message_Block::cont(), 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_.

00179   : length_(0)
00180   , sample_(0)
00181   , allocator_(a)
00182 {
00183   this->source_timestamp_.sec     = element.get_header().source_timestamp_sec_;
00184   this->source_timestamp_.nanosec = element.get_header().source_timestamp_nanosec_;
00185 
00186   // Only copy the data provided by the user.  The DataSampleHeader
00187   // will be reconstructed when the durable data is retrieved by a
00188   // DataWriterImpl instance.
00189   //
00190   // The user's data is stored in the first message block
00191   // continuation.
00192   ACE_Message_Block const * const data = element.get_sample()->cont();
00193   init(data);
00194 }

Here is the call graph for this function:

OpenDDS::DCPS::DataDurabilityCache::sample_data_type::sample_data_type ( DDS::Time_t  timestamp,
const ACE_Message_Block mb,
ACE_Allocator allocator 
)

Definition at line 196 of file DataDurabilityCache.cpp.

References init().

00198   : length_(0)
00199   , sample_(0)
00200   , source_timestamp_(timestamp)
00201   , allocator_(a)
00202 {
00203   init(&mb);
00204 }

Here is the call graph for this function:

OpenDDS::DCPS::DataDurabilityCache::sample_data_type::sample_data_type ( sample_data_type const &  rhs  ) 

Definition at line 226 of file DataDurabilityCache.cpp.

References allocator_, length_, ACE_Allocator::malloc(), ACE_OS::memcpy(), DDS::Time_t::nanosec, sample_, DDS::Time_t::sec, and source_timestamp_.

00228   : length_(rhs.length_)
00229   , sample_(0)
00230   , allocator_(rhs.allocator_)
00231 {
00232   this->source_timestamp_.sec     = rhs.source_timestamp_.sec;
00233   this->source_timestamp_.nanosec = rhs.source_timestamp_.nanosec;
00234 
00235   if (this->allocator_) {
00236     ACE_ALLOCATOR(this->sample_,
00237                   static_cast<char *>(
00238                     this->allocator_->malloc(rhs.length_)));
00239     ACE_OS::memcpy(this->sample_, rhs.sample_, rhs.length_);
00240   }
00241 }

Here is the call graph for this function:

OpenDDS::DCPS::DataDurabilityCache::sample_data_type::~sample_data_type (  ) 

Definition at line 243 of file DataDurabilityCache.cpp.

References allocator_, ACE_Allocator::free(), and sample_.

00244 {
00245   if (this->allocator_)
00246     this->allocator_->free(this->sample_);
00247 }

Here is the call graph for this function:


Member Function Documentation

void OpenDDS::DCPS::DataDurabilityCache::sample_data_type::get_sample ( char const *&  s,
size_t len,
DDS::Time_t source_timestamp 
)

Definition at line 266 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().

00270 {
00271   s = this->sample_;
00272   len = this->length_;
00273   source_timestamp.sec     = this->source_timestamp_.sec;
00274   source_timestamp.nanosec = this->source_timestamp_.nanosec;
00275 }

Here is the caller graph for this function:

void OpenDDS::DCPS::DataDurabilityCache::sample_data_type::init ( const ACE_Message_Block data  )  [private]

Definition at line 208 of file DataDurabilityCache.cpp.

References OpenDDS::DCPS::DataDurabilityCache::allocator_, ACE_Message_Block::cont(), ACE_OS::memcpy(), and ACE_Message_Block::total_length().

Referenced by sample_data_type().

00209 {
00210   this->length_ = data->total_length();
00211 
00212   ACE_ALLOCATOR(this->sample_,
00213                 static_cast<char *>(
00214                   this->allocator_->malloc(this->length_)));
00215 
00216   char * buf = this->sample_;
00217 
00218   for (ACE_Message_Block const * i = data;
00219        i != 0;
00220        i = i->cont()) {
00221     ACE_OS::memcpy(buf, i->rd_ptr(), i->length());
00222     buf += i->length();
00223   }
00224 }

Here is the call graph for this function:

Here is the caller graph for this function:

OpenDDS::DCPS::DataDurabilityCache::sample_data_type & OpenDDS::DCPS::DataDurabilityCache::sample_data_type::operator= ( sample_data_type const &  rhs  ) 

Definition at line 250 of file DataDurabilityCache.cpp.

References allocator_, length_, DDS::Time_t::nanosec, sample_, DDS::Time_t::sec, source_timestamp_, and OpenDDS::DCPS::swap().

00252 {
00253   // Strongly exception-safe copy assignment.
00254   sample_data_type tmp(rhs);
00255   std::swap(this->length_, tmp.length_);
00256   std::swap(this->sample_, tmp.sample_);
00257   std::swap(this->allocator_, tmp.allocator_);
00258 
00259   this->source_timestamp_.sec     = rhs.source_timestamp_.sec;
00260   this->source_timestamp_.nanosec = rhs.source_timestamp_.nanosec;
00261 
00262   return *this;
00263 }

Here is the call graph for this function:

void OpenDDS::DCPS::DataDurabilityCache::sample_data_type::set_allocator ( ACE_Allocator allocator  ) 

Definition at line 278 of file DataDurabilityCache.cpp.

References allocator_.

00280 {
00281   this->allocator_ = allocator;
00282 }


Member Data Documentation

Definition at line 171 of file DataDurabilityCache.h.

Referenced by get_sample(), operator=(), and sample_data_type().

Definition at line 172 of file DataDurabilityCache.h.

Referenced by get_sample(), operator=(), sample_data_type(), and ~sample_data_type().

Definition at line 173 of file DataDurabilityCache.h.

Referenced by get_sample(), operator=(), and sample_data_type().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1