Main MRPT website > C++ reference for MRPT 1.5.7
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-2017, 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(NULL)
23  , m_formatList(NULL)
24  , m_idList(NULL)
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 worth of data
32  \details The constructor sets the xbus flag to false
33  \param count The number of devices whose metadata is stored in the object
34 */
36  : m_infoList(NULL)
37  , m_formatList(NULL)
38  , m_idList(NULL)
39  , m_xm(false)
40  , m_itemCount(count)
41 {
42  PACKETLOG("%s creating %p with %d items\n", __FUNCTION__, this, count);
46 }
47 
48 /*! \brief Copy constructor
49  \param p The object to copy the contents from
50 */
52  : m_infoList(NULL)
53  , m_formatList(NULL)
54  , m_idList(NULL)
55  , m_xm(false)
56  , m_itemCount(0)
57 {
58  PACKETLOG("%s creating %p from %p\n", __FUNCTION__, this, &p);
59  *this = p;
60  PACKETLOG("%s done creating %p\n", __FUNCTION__, this);
61 }
62 
63 /*! \brief Destructor
64 */
66 {
67  PACKETLOG("%s %p\n", __FUNCTION__, this);
68  m_itemCount = 0;
69  delete[] m_formatList;
70  delete[] m_infoList;
71  delete[] m_idList;
72  PACKETLOG("%s %p exit\n", __FUNCTION__, this);
73 }
74 
75 /*! \brief Assignment operator, copies contents from \a data
76  \param data The object to copy from
77 */
79 {
80  if (this == &data)
81  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 = NULL;
89  m_idList = NULL;
90  m_infoList = NULL;
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 }
107 
GLuint GLuint GLsizei count
Definition: glext.h:3512
XsDataFormat * m_formatList
A list of the formats of the data items.
unsigned __int16 uint16_t
Definition: rptypes.h:46
uint16_t m_itemCount
The number of data items in the message.
PacketFixedData()
Default constructor, creates an empty (invalid) object.
Contains offset information about data in the packet.
PacketInfo * m_infoList
Contains information about data in the packet and the format of that data.
#define PACKETLOG(...)
~PacketFixedData()
Destructor.
A structure for storing data formats.
Definition: xsdataformat.h:17
A structure containing fixed packet data, which should not change during a measurement for the same d...
void operator=(const PacketFixedData &data)
Assignment operator, copies contents from data.
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:3520
GLfloat GLfloat p
Definition: glext.h:5587
bool m_xm
Indicates that xbus-formatting is used.
XsDeviceId * m_idList
A list of the device-ids in this packet.



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019