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 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00011 
00012 namespace OpenDDS {
00013 namespace DCPS {
00014 
00015 
00016 RawDataSample::RawDataSample()
00017   : message_id_(SAMPLE_DATA)
00018   , publication_id_(GUID_UNKNOWN)
00019   , sample_byte_order_(0)
00020 {
00021   source_timestamp_.sec = 0;
00022   source_timestamp_.nanosec = 0;
00023 }
00024 
00025 RawDataSample::RawDataSample(MessageId          mid,
00026                              ACE_INT32            sec,
00027                              ACE_UINT32           nano_sec,
00028                              PublicationId      pid,
00029                              bool               byte_order,
00030                              ACE_Message_Block* blk)
00031   : message_id_(mid)
00032   , publication_id_(pid)
00033   , sample_byte_order_(byte_order)
00034   , sample_(blk->duplicate())
00035 {
00036   source_timestamp_.sec = sec;
00037   source_timestamp_.nanosec = nano_sec;
00038 }
00039 
00040 RawDataSample::~RawDataSample()
00041 {
00042 }
00043 
00044 RawDataSample::RawDataSample(const RawDataSample& other)
00045   : message_id_(other.message_id_)
00046   , source_timestamp_(other.source_timestamp_)
00047   , publication_id_(other.publication_id_)
00048   , sample_byte_order_(other.sample_byte_order_)
00049   , sample_(other.sample_->duplicate())
00050 {
00051 }
00052 
00053 
00054 RawDataSample&
00055 RawDataSample::operator=(const RawDataSample& other)
00056 {
00057   RawDataSample tmp(other);
00058   swap(*this, tmp);
00059   return *this;
00060 }
00061 
00062 void swap(RawDataSample& lhs, RawDataSample& rhs)
00063 {
00064   using std::swap;
00065   swap(lhs.message_id_, rhs.message_id_);
00066   swap(lhs.publication_id_, rhs.publication_id_);
00067   swap(lhs.sample_byte_order_, rhs.sample_byte_order_);
00068   swap(lhs.sample_, rhs.sample_);
00069 }
00070 
00071 } // namespace DCPS
00072 } // namespace OpenDDS
00073 
00074 OPENDDS_END_VERSIONED_NAMESPACE_DECL
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1