MRPT  1.9.9
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-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 
10 #pragma once
11 
12 #include <cstdint>
13 
14 namespace mrpt
15 {
16 /** \addtogroup mrpt_int_select Templates to declare integers by byte count (in
17  * #include <mrpt/core/integer_select.h>)
18  * \ingroup mrpt_core_grp
19  * @{ */
20 
21 /** Usage: `int_select_by_bytecount<N>::type var;` allows defining var as a
22  * signed integer with, at least, N bytes. */
23 template <unsigned int num_bytes>
25 template <>
27 {
28  using type = int8_t;
29 };
30 template <>
32 {
33  using type = int16_t;
34 };
35 template <>
37 {
38  using type = int32_t;
39 };
40 template <>
42 {
43  using type = int32_t;
44 };
45 template <>
47 {
48  using type = int64_t;
49 };
50 
51 /** Usage: `uint_select_by_bytecount<N>::type var;` allows defining var as a
52  * unsigned integer with, at least, N bytes. */
53 template <unsigned int num_bytes>
55 template <>
57 {
58  using type = uint8_t;
59 };
60 template <>
62 {
63  using type = uint16_t;
64 };
65 template <>
67 {
68  using type = uint32_t;
69 };
70 template <>
72 {
73  using type = uint32_t;
74 };
75 template <>
77 {
78  using type = uint64_t;
79 };
80 
81 /** @} */
82 } // end of namespace
unsigned __int16 uint16_t
Definition: rptypes.h:44
signed char int8_t
Definition: rptypes.h:40
Usage: uint_select_by_bytecount<N>type var; allows defining var as a unsigned integer with...
unsigned char uint8_t
Definition: rptypes.h:41
Usage: int_select_by_bytecount<N>type var; allows defining var as a signed integer with...
__int16 int16_t
Definition: rptypes.h:43
__int64 int64_t
Definition: rptypes.h:49
__int32 int32_t
Definition: rptypes.h:46
unsigned __int64 uint64_t
Definition: rptypes.h:50
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
unsigned __int32 uint32_t
Definition: rptypes.h:47



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020