Main MRPT website > C++ reference for MRPT 1.4.0
integer_select.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-2016, 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
10#pragma once
11
13
14namespace mrpt
15{
16 namespace utils
17 {
18 /** \addtogroup mrpt_int_select Templates to declare integers by byte count (in #include <mrpt/utils/integer_select.h>)
19 * \ingroup mrpt_base_grp
20 * @{ */
21
22 /** Usage: `int_select_by_bytecount<N>::type var;` allows defining var as a signed integer with, at least, N bytes. */
23 template<unsigned int num_bytes> struct int_select_by_bytecount;
24 template<> struct int_select_by_bytecount<1> { typedef int8_t type; };
25 template<> struct int_select_by_bytecount<2> { typedef int16_t type; };
26 template<> struct int_select_by_bytecount<3> { typedef int32_t type; };
27 template<> struct int_select_by_bytecount<4> { typedef int32_t type; };
28 template<> struct int_select_by_bytecount<8> { typedef int64_t type; };
29
30 /** Usage: `uint_select_by_bytecount<N>::type var;` allows defining var as a unsigned integer with, at least, N bytes. */
31 template<unsigned int num_bytes> struct uint_select_by_bytecount;
32 template<> struct uint_select_by_bytecount<1> { typedef uint8_t type; };
33 template<> struct uint_select_by_bytecount<2> { typedef uint16_t type; };
34 template<> struct uint_select_by_bytecount<3> { typedef uint32_t type; };
35 template<> struct uint_select_by_bytecount<4> { typedef uint32_t type; };
36 template<> struct uint_select_by_bytecount<8> { typedef uint64_t type; };
37
38 /** @} */
39 } // End of namespace
40} // end of namespace
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
unsigned long uint32_t
Definition: pstdint.h:216
unsigned int uint16_t
Definition: pstdint.h:170
signed long int32_t
Definition: pstdint.h:247
signed int int16_t
Definition: pstdint.h:194
unsigned char uint8_t
Definition: pstdint.h:143
signed char int8_t
Definition: pstdint.h:158
Usage: int_select_by_bytecount<N>::type var; allows defining var as a signed integer with,...
Usage: uint_select_by_bytecount<N>::type var; allows defining var as a unsigned integer with,...



Page generated by Doxygen 1.9.6 for MRPT 1.4.0 SVN: at Sat Jan 21 06:46:15 UTC 2023