Main MRPT website > C++ reference for 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-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 
10 #pragma once
11 
12 #include <cstdint>
13 
14 namespace mrpt
15 {
16 namespace utils
17 {
18 /** \addtogroup mrpt_int_select Templates to declare integers by byte count (in
19  * #include <mrpt/utils/integer_select.h>)
20  * \ingroup mrpt_base_grp
21  * @{ */
22 
23 /** Usage: `int_select_by_bytecount<N>::type var;` allows defining var as a
24  * signed integer with, at least, N bytes. */
25 template <unsigned int num_bytes>
27 template <>
29 {
30  typedef int8_t type;
31 };
32 template <>
34 {
35  typedef int16_t type;
36 };
37 template <>
39 {
40  typedef int32_t type;
41 };
42 template <>
44 {
45  typedef int32_t type;
46 };
47 template <>
49 {
50  typedef int64_t type;
51 };
52 
53 /** Usage: `uint_select_by_bytecount<N>::type var;` allows defining var as a
54  * unsigned integer with, at least, N bytes. */
55 template <unsigned int num_bytes>
57 template <>
59 {
60  typedef uint8_t type;
61 };
62 template <>
64 {
65  typedef uint16_t type;
66 };
67 template <>
69 {
70  typedef uint32_t type;
71 };
72 template <>
74 {
75  typedef uint32_t type;
76 };
77 template <>
79 {
80  typedef uint64_t type;
81 };
82 
83 /** @} */
84 } // End of namespace
85 } // end of namespace
unsigned __int16 uint16_t
Definition: rptypes.h:44
Usage: uint_select_by_bytecount<N>type var; allows defining var as a unsigned integer with...
signed char int8_t
Definition: rptypes.h:40
unsigned char uint8_t
Definition: rptypes.h:41
__int16 int16_t
Definition: rptypes.h:43
__int64 int64_t
Definition: rptypes.h:49
Usage: int_select_by_bytecount<N>type var; allows defining var as a signed integer with...
__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: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019