Main MRPT website > C++ reference for MRPT 1.5.7
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 <mrpt/utils/mrpt_stdint.h>
13 
14 namespace 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
unsigned __int16 uint16_t
Definition: rptypes.h:46
Usage: uint_select_by_bytecount<N>type var; allows defining var as a unsigned integer with...
signed char int8_t
Definition: rptypes.h:42
unsigned char uint8_t
Definition: rptypes.h:43
__int16 int16_t
Definition: rptypes.h:45
__int64 int64_t
Definition: rptypes.h:51
Usage: int_select_by_bytecount<N>type var; allows defining var as a signed integer with...
__int32 int32_t
Definition: rptypes.h:48
unsigned __int64 uint64_t
Definition: rptypes.h:52
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
unsigned __int32 uint32_t
Definition: rptypes.h:49



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