RawDataSample.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 #include "DCPS/DdsDcps_pch.h" //Only the _pch include should start with DCPS/
00008 #include "dds/DCPS/RawDataSample.h"
00009 
00010 namespace OpenDDS {
00011 namespace DCPS {
00012 
00013 
00014 RawDataSample::RawDataSample()
00015   : message_id_(SAMPLE_DATA)
00016   , publication_id_(GUID_UNKNOWN)
00017   , sample_byte_order_(0)
00018   , sample_(0)
00019 {
00020   source_timestamp_.sec = 0;
00021   source_timestamp_.nanosec = 0;
00022 }
00023 
00024 RawDataSample::RawDataSample(MessageId          mid,
00025                              ACE_INT32            sec,
00026                              ACE_UINT32           nano_sec,
00027                              PublicationId      pid,
00028                              bool               byte_order,
00029                              ACE_Message_Block* blk)
00030   : message_id_(mid)
00031   , publication_id_(pid)
00032   , sample_byte_order_(byte_order)
00033   , sample_(blk->duplicate())
00034 {
00035   source_timestamp_.sec = sec;
00036   source_timestamp_.nanosec = nano_sec;
00037 }
00038 
00039 RawDataSample::~RawDataSample()
00040 {
00041   if (sample_)
00042     sample_->release();
00043 }
00044 
00045 RawDataSample::RawDataSample(const RawDataSample& other)
00046   : message_id_(other.message_id_)
00047   , source_timestamp_(other.source_timestamp_)
00048   , publication_id_(other.publication_id_)
00049   , sample_byte_order_(other.sample_byte_order_)
00050   , sample_(other.sample_->duplicate())
00051 {
00052 }
00053 
00054 
00055 RawDataSample&
00056 RawDataSample::operator=(const RawDataSample& other)
00057 {
00058   RawDataSample tmp(other);
00059   std::swap(*this, tmp);
00060   return *this;
00061 }
00062 
00063 } // namespace DCPS
00064 } // namespace OpenDDS

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