Main MRPT website > C++ reference for MRPT 1.9.9
packetfixeddata.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #include <xsens/xsdataformat.h>
10 #include "packetfixeddata.h"
11 
12 #ifdef LOG_PACKET
13 #include "xslog.h"
14 #define PACKETLOG XSENSLOG
15 #else
16 #define PACKETLOG(...)
17 #endif
18 
19 /*! \brief Default constructor, creates an empty (invalid) object
20 */
22  : m_infoList(nullptr),
23  m_formatList(nullptr),
24  m_idList(nullptr),
25  m_xm(false),
26  m_itemCount(0)
27 {
28  PACKETLOG("%s creating default %p\n", __FUNCTION__, this);
29 }
30 
31 /*! \brief Sized constructor, creates an object with room for \a count device's
32  worth of data
33  \details The constructor sets the xbus flag to false
34  \param count The number of devices whose metadata is stored in the object
35 */
37  : m_infoList(nullptr),
38  m_formatList(nullptr),
39  m_idList(nullptr),
40  m_xm(false),
41  m_itemCount(count)
42 {
43  PACKETLOG("%s creating %p with %d items\n", __FUNCTION__, this, count);
47 }
48 
49 /*! \brief Copy constructor
50  \param p The object to copy the contents from
51 */
53  : m_infoList(nullptr),
54  m_formatList(nullptr),
55  m_idList(nullptr),
56  m_xm(false),
57  m_itemCount(0)
58 {
59  PACKETLOG("%s creating %p from %p\n", __FUNCTION__, this, &p);
60  *this = p;
61  PACKETLOG("%s done creating %p\n", __FUNCTION__, this);
62 }
63 
64 /*! \brief Destructor
65 */
67 {
68  PACKETLOG("%s %p\n", __FUNCTION__, this);
69  m_itemCount = 0;
70  delete[] m_formatList;
71  delete[] m_infoList;
72  delete[] m_idList;
73  PACKETLOG("%s %p exit\n", __FUNCTION__, this);
74 }
75 
76 /*! \brief Assignment operator, copies contents from \a data
77  \param data The object to copy from
78 */
80 {
81  if (this == &data) return;
82 
83  PACKETLOG("%s copy from %p to %p\n", __FUNCTION__, &data, this);
84 
85  delete[] m_formatList;
86  delete[] m_idList;
87  delete[] m_infoList;
88  m_formatList = nullptr;
89  m_idList = nullptr;
90  m_infoList = nullptr;
91 
92  m_itemCount = data.m_itemCount;
93  m_formatList = new XsDataFormat[data.m_itemCount];
94  m_idList = new XsDeviceId[data.m_itemCount];
95  m_infoList = new PacketInfo[data.m_itemCount];
96 
97  for (uint16_t i = 0; i < data.m_itemCount; ++i)
98  {
99  m_formatList[i] = data.m_formatList[i];
100  m_infoList[i] = data.m_infoList[i];
101  m_idList[i] = data.m_idList[i];
102  }
103  m_xm = data.m_xm;
104 
105  PACKETLOG("%s exit\n", __FUNCTION__);
106 }
PacketFixedData::m_itemCount
uint16_t m_itemCount
The number of data items in the message.
Definition: packetfixeddata.h:182
uint16_t
unsigned __int16 uint16_t
Definition: rptypes.h:44
XsDeviceId
Definition: xsdeviceid.h:65
PacketFixedData::m_infoList
PacketInfo * m_infoList
Contains information about data in the packet and the format of that data.
Definition: packetfixeddata.h:174
PacketFixedData::m_formatList
XsDataFormat * m_formatList
A list of the formats of the data items.
Definition: packetfixeddata.h:176
PACKETLOG
#define PACKETLOG(...)
Definition: packetfixeddata.cpp:16
PacketFixedData::m_xm
bool m_xm
Indicates that xbus-formatting is used.
Definition: packetfixeddata.h:180
p
GLfloat GLfloat p
Definition: glext.h:6305
PacketFixedData
A structure containing fixed packet data, which should not change during a measurement for the same d...
Definition: packetfixeddata.h:163
data
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:3547
PacketInfo
Contains offset information about data in the packet.
Definition: packetfixeddata.h:30
count
GLuint GLuint GLsizei count
Definition: glext.h:3528
XsDataFormat
A structure for storing data formats.
Definition: xsdataformat.h:17
PacketFixedData::~PacketFixedData
~PacketFixedData()
Destructor.
Definition: packetfixeddata.cpp:66
packetfixeddata.h
PacketFixedData::m_idList
XsDeviceId * m_idList
A list of the device-ids in this packet.
Definition: packetfixeddata.h:178
xsdataformat.h
PacketFixedData::operator=
void operator=(const PacketFixedData &data)
Assignment operator, copies contents from data.
Definition: packetfixeddata.cpp:79
PacketFixedData::PacketFixedData
PacketFixedData()
Default constructor, creates an empty (invalid) object.
Definition: packetfixeddata.cpp:21



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST