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 }
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:3547
GLuint GLuint GLsizei count
Definition: glext.h:3528
GLfloat GLfloat p
Definition: glext.h:6305
#define PACKETLOG(...)
unsigned __int16 uint16_t
Definition: rptypes.h:44
A structure containing fixed packet data, which should not change during a measurement for the same d...
bool m_xm
Indicates that xbus-formatting is used.
~PacketFixedData()
Destructor.
uint16_t m_itemCount
The number of data items in the message.
void operator=(const PacketFixedData &data)
Assignment operator, copies contents from data.
XsDataFormat * m_formatList
A list of the formats of the data items.
XsDeviceId * m_idList
A list of the device-ids in this packet.
PacketFixedData()
Default constructor, creates an empty (invalid) object.
PacketInfo * m_infoList
Contains information about data in the packet and the format of that data.
Contains offset information about data in the packet.
A structure for storing data formats.
Definition: xsdataformat.h:18



Page generated by Doxygen 1.9.1 for MRPT 1.9.9 Git: 814d80880 Fri Aug 24 01:51:28 2018 +0200 at mar 26 may 2026 12:30:59 CEST