Line data Source code
1 : /* 2 : * Distributed under the OpenDDS License. 3 : * See: http://www.opendds.org/license.html 4 : */ 5 : #include "DCPS/DdsDcps_pch.h" //Only the _pch include should start with DCPS/ 6 : #include "RawDataSample.h" 7 : 8 : OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 9 : 10 : namespace OpenDDS { 11 : namespace DCPS { 12 : 13 0 : RawDataSample::RawDataSample() 14 0 : : message_id_(SAMPLE_DATA) 15 0 : , publication_id_(GUID_UNKNOWN) 16 0 : , sample_byte_order_(false) 17 0 : , encoding_kind_(Encoding::KIND_UNALIGNED_CDR) 18 : { 19 0 : source_timestamp_.sec = 0; 20 0 : source_timestamp_.nanosec = 0; 21 0 : } 22 : 23 0 : RawDataSample::RawDataSample(const DataSampleHeader& header, 24 : MessageId mid, 25 : ACE_INT32 sec, 26 : ACE_UINT32 nano_sec, 27 : GUID_t pid, 28 : bool byte_order, 29 : ACE_Message_Block* blk, 30 0 : Encoding::Kind encoding_kind) 31 0 : : header_(header) 32 0 : , message_id_(mid) 33 0 : , publication_id_(pid) 34 0 : , sample_byte_order_(byte_order) 35 0 : , sample_(blk->duplicate()) 36 0 : , encoding_kind_(encoding_kind) 37 : { 38 0 : source_timestamp_.sec = sec; 39 0 : source_timestamp_.nanosec = nano_sec; 40 0 : } 41 : 42 0 : RawDataSample::~RawDataSample() 43 : { 44 0 : } 45 : 46 0 : RawDataSample::RawDataSample(const RawDataSample& other) 47 0 : : header_(other.header_) 48 0 : , message_id_(other.message_id_) 49 0 : , source_timestamp_(other.source_timestamp_) 50 0 : , publication_id_(other.publication_id_) 51 0 : , sample_byte_order_(other.sample_byte_order_) 52 0 : , sample_(other.sample_->duplicate()) 53 0 : , encoding_kind_(other.encoding_kind_) 54 : { 55 0 : } 56 : 57 : RawDataSample& 58 0 : RawDataSample::operator=(const RawDataSample& other) 59 : { 60 0 : RawDataSample tmp(other); 61 0 : swap(*this, tmp); 62 0 : return *this; 63 0 : } 64 : 65 0 : void swap(RawDataSample& lhs, RawDataSample& rhs) 66 : { 67 : using std::swap; 68 0 : swap(lhs.header_, rhs.header_); 69 0 : swap(lhs.message_id_, rhs.message_id_); 70 0 : swap(lhs.source_timestamp_, rhs.source_timestamp_); 71 0 : swap(lhs.publication_id_, rhs.publication_id_); 72 0 : swap(lhs.sample_byte_order_, rhs.sample_byte_order_); 73 0 : swap(lhs.sample_, rhs.sample_); 74 0 : swap(lhs.encoding_kind_, rhs.encoding_kind_); 75 0 : } 76 : 77 : } // namespace DCPS 78 : } // namespace OpenDDS 79 : 80 : OPENDDS_END_VERSIONED_NAMESPACE_DECL