Main MRPT website > C++ reference for MRPT 1.5.6
xsbytearray.h
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 #ifndef XSBYTEARRAY_H
10 #define XSBYTEARRAY_H
11 
12 #include "xsarray.h"
13 #include "pstdint.h"
14 
15 #ifdef __cplusplus
16 #include "xsstring.h"
17 extern "C" {
18 #endif
19 
21 
22 #ifndef __cplusplus
23 #define XSBYTEARRAY_INITIALIZER XSARRAY_INITIALIZER(&g_xsByteArrayDescriptor)
25 typedef struct XsByteArray XsByteArray;
27 
28 // obsolete:
29 #define XsByteArray_ref(thisPtr, sz, src, flags) XsArray_ref(thisPtr, sz, src, flags)
30 #define XsByteArray_assign(thisPtr, sz, src) XsArray_assign(thisPtr, sz, src)
31 #define XsByteArray_destruct(thisPtr) XsArray_destruct(thisPtr)
32 #define XsByteArray_copy(thisPtr, copy) XsArray_copy(copy, thisPtr)
33 #define XsByteArray_append(thisPtr, other) XsArray_append(thisPtr, other)
34 #define XsByteArray_popFront(thisPtr, count) XsArray_erase(thisPtr, 0, count)
35 #define XsByteArray_popBack(thisPtr, count) XsArray_erase(thisPtr, (XsSize)-1, count)
36 #define XsByteArray_fromString(str, copy) XsArray_assign(copy, str->m_size?str->m_size:1, str->m_size?str->m_data:"\0")
37 #define XsByteArray_swap(a, b) XsArray_swap(a, b)
38 #define XsByteArray_erase(thisPtr, index, count) XsArray_erase(thisPtr, index, count)
39 
40 #else
41 } // extern "C"
42 #endif
43 
44 #ifdef __cplusplus
45 struct XsByteArray : public XsArrayImpl<uint8_t, g_xsByteArrayDescriptor, XsByteArray> {
46  //! \brief Constructs an XsByteArray
47  inline explicit XsByteArray(XsSize sz = 0, uint8_t const* src = 0)
48  : ArrayImpl(sz, src)
49  {
50  }
51 
52  //! \brief Constructs an XsByteArray as a copy of \a other
53  inline XsByteArray(XsByteArray const& other)
54  : ArrayImpl(other)
55  {
56  }
57 
58  //! \brief Constructs an XsByteArray that references the data supplied in \a ref
59  inline explicit XsByteArray(uint8_t* ref, XsSize sz, XsDataFlags flags = XSDF_None)
60  : ArrayImpl(ref, sz, flags)
61  {
62  }
63 #ifndef XSENS_NOITERATOR
64  //! \brief Constructs an XsByteArray with the array bound by the supplied iterators \a beginIt and \a endIt
65  template <typename Iterator>
66  inline XsByteArray(Iterator beginIt, Iterator endIt)
67  : ArrayImpl(beginIt, endIt)
68  {
69  }
70 #endif
71  //! \brief Constructs an XsByteArray as a copy of the supplied XsString, including the terminating 0
72  inline XsByteArray(XsString const& src)
73  : ArrayImpl()
74  {
75  assign(src.size()+1, reinterpret_cast<uint8_t const*>(src.c_str()));
76  }
77 
78  //! \brief Return a pointer to the internal data buffer
79  inline uint8_t* data() { return begin().operator ->(); }
80 
81  //! \brief Return a pointer to the internal data buffer
82  inline uint8_t const* data() const { return begin().operator ->(); }
83 };
84 #endif
85 #endif // file guard
This object describes how to treat the data in an array.
Definition: xsarray.h:51
struct XsByteArray XsByteArray
Definition: xsbytearray.h:25
EIGEN_STRONG_INLINE iterator begin()
Definition: eigen_plugins.h:26
size_t XsSize
XsSize must be unsigned number!
Definition: xstypedefs.h:17
GLuint src
Definition: glew.h:7126
No flag set.
Definition: xstypedefs.h:38
unsigned char uint8_t
Definition: rptypes.h:43
GLenum GLint ref
Definition: glew.h:1752
XsArrayDescriptor const XSTYPES_DLL_API g_xsByteArrayDescriptor
XSARRAY_STRUCT(XsByteArray, uint8_t)
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
Definition: glew.h:1284
EIGEN_STRONG_INLINE void assign(const Scalar v)
Definition: eigen_plugins.h:41
#define XSTYPES_DLL_API
Definition: xstypesconfig.h:9
GLuint GLuint GLsizei count
Definition: glew.h:1167
XSTYPES_DLL_API void XsByteArray_construct(XsByteArray *thisPtr, XsSize count, uint8_t const *src)
struct XsString XsString
Definition: xsstring.h:34
XsDataFlags
These flags define the behaviour of data contained by Xsens data structures.
Definition: xstypedefs.h:37



Page generated by Doxygen 1.8.6 for MRPT 1.5.6 Git: 4c65e84 Tue Apr 24 08:18:17 2018 +0200 at mar abr 24 08:26:17 CEST 2018