OpenDDS  Snapshot(2023/04/28-20:55)
RawDataSample.cpp
Go to the documentation of this file.
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 
9 
10 namespace OpenDDS {
11 namespace DCPS {
12 
14  : message_id_(SAMPLE_DATA)
15  , publication_id_(GUID_UNKNOWN)
16  , sample_byte_order_(false)
17  , encoding_kind_(Encoding::KIND_UNALIGNED_CDR)
18 {
21 }
22 
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  Encoding::Kind encoding_kind)
31  : header_(header)
32  , message_id_(mid)
33  , publication_id_(pid)
34  , sample_byte_order_(byte_order)
35  , sample_(blk->duplicate())
36  , encoding_kind_(encoding_kind)
37 {
38  source_timestamp_.sec = sec;
39  source_timestamp_.nanosec = nano_sec;
40 }
41 
43 {
44 }
45 
47  : header_(other.header_)
48  , message_id_(other.message_id_)
52  , sample_(other.sample_->duplicate())
54 {
55 }
56 
59 {
60  RawDataSample tmp(other);
61  swap(*this, tmp);
62  return *this;
63 }
64 
66 {
67  using std::swap;
68  swap(lhs.header_, rhs.header_);
69  swap(lhs.message_id_, rhs.message_id_);
73  swap(lhs.sample_, rhs.sample_);
75 }
76 
77 } // namespace DCPS
78 } // namespace OpenDDS
79 
void swap(MessageBlock &lhs, MessageBlock &rhs)
MessageId message_id_
The enum indicating the message type.
Definition: RawDataSample.h:44
const GUID_t GUID_UNKNOWN
Nil value for GUID.
Definition: GuidUtils.h:59
Message_Block_Ptr sample_
The data in unspecified format.
Definition: RawDataSample.h:53
GUID_t publication_id_
Id of the datawriter that sent the sample.
Definition: RawDataSample.h:48
MessageId
One byte message id (<256)
Christopher Diggins *renamed files *fixing compilation errors *adding Visual C project file *removed make Max Lybbert *removed references to missing and unused header
Definition: CHANGELOG.txt:8
DataSampleHeader header_
The sample data header.
Definition: RawDataSample.h:42
unsigned long nanosec
RawDataSample & operator=(const RawDataSample &)
DDS::Time_t source_timestamp_
The timestamp the sender put on the sample.
Definition: RawDataSample.h:46
void swap(RawDataSample &lhs, RawDataSample &rhs)
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
Encoding::Kind encoding_kind_
Holds information on which type of encoding was read from the encapsulation header.
Definition: RawDataSample.h:55