Main MRPT website > C++ reference for MRPT 1.5.7
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
GLuint GLuint GLsizei count
Definition: glext.h:3512
This object describes how to treat the data in an array.
Definition: xsarray.h:51
GLenum GLint ref
Definition: glext.h:3888
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: glext.h:6303
No flag set.
Definition: xstypedefs.h:38
unsigned char uint8_t
Definition: rptypes.h:43
XsArrayDescriptor const XSTYPES_DLL_API g_xsByteArrayDescriptor
XSARRAY_STRUCT(XsByteArray, uint8_t)
EIGEN_STRONG_INLINE void assign(const Scalar v)
Definition: eigen_plugins.h:41
#define XSTYPES_DLL_API
Definition: xstypesconfig.h:9
XSTYPES_DLL_API void XsByteArray_construct(XsByteArray *thisPtr, XsSize count, uint8_t const *src)
struct XsString XsString
Definition: xsstring.h:34
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:3520
XsDataFlags
These flags define the behaviour of data contained by Xsens data structures.
Definition: xstypedefs.h:37



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