mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-30 19:34:07 +08:00
Automatic selection between <stdint.h> and <cstdint> depending on the C++ standard. This improvement made the library completely independent from the standard C headers in C++11 mode. In C++03 mode, though, some C headers are still needed: <stdint.h>, <math.h>
This commit is contained in:
parent
81a03b4d5e
commit
41eeae8200
@ -6,9 +6,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <stdint.h>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/impl_constants.hpp>
|
||||
#include <uavcan/system_clock.hpp>
|
||||
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
#include <algorithm>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/transport/transfer.hpp>
|
||||
|
||||
namespace uavcan
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
#include <cstring>
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include <stdint.h>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/util/compile_time.hpp>
|
||||
|
||||
namespace uavcan
|
||||
|
||||
@ -6,7 +6,6 @@
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <stdint.h>
|
||||
#include <uavcan/linked_list.hpp>
|
||||
#include <uavcan/impl_constants.hpp>
|
||||
#include <uavcan/dynamic_memory.hpp>
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/util/compile_time.hpp>
|
||||
|
||||
namespace uavcan
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <limits>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/data_type.hpp>
|
||||
#include <uavcan/util/compile_time.hpp>
|
||||
#include <uavcan/impl_constants.hpp>
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <limits>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/data_type.hpp>
|
||||
#include <uavcan/util/compile_time.hpp>
|
||||
#include <uavcan/marshal/scalar_codec.hpp>
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <stdint.h>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/util/compile_time.hpp>
|
||||
#include <uavcan/marshal/bit_stream.hpp>
|
||||
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
|
||||
#include <cassert>
|
||||
#include <bitset>
|
||||
#include <stdint.h>
|
||||
#include <algorithm>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/data_type.hpp>
|
||||
#include <uavcan/util/compile_time.hpp>
|
||||
#include <uavcan/fatal_error.hpp>
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/node/scheduler.hpp>
|
||||
#include <uavcan/util/compile_time.hpp>
|
||||
#include <uavcan/node/abstract_node.hpp>
|
||||
|
||||
51
libuavcan/include/uavcan/stdint.hpp
Normal file
51
libuavcan/include/uavcan/stdint.hpp
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <uavcan/impl_constants.hpp>
|
||||
|
||||
#if !defined(UAVCAN_CPP_VERSION) || !defined(UAVCAN_CPP11)
|
||||
# error UAVCAN_CPP_VERSION
|
||||
#endif
|
||||
|
||||
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
|
||||
|
||||
# include <cstdint>
|
||||
|
||||
namespace uavcan
|
||||
{
|
||||
|
||||
using std::uint8_t;
|
||||
using std::uint16_t;
|
||||
using std::uint32_t;
|
||||
using std::uint64_t;
|
||||
|
||||
using std::int8_t;
|
||||
using std::int16_t;
|
||||
using std::int32_t;
|
||||
using std::int64_t;
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
# include <stdint.h>
|
||||
|
||||
namespace uavcan
|
||||
{
|
||||
|
||||
typedef ::uint8_t uint8_t;
|
||||
typedef ::uint16_t uint16_t;
|
||||
typedef ::uint32_t uint32_t;
|
||||
typedef ::uint64_t uint64_t;
|
||||
|
||||
typedef ::int8_t int8_t;
|
||||
typedef ::int16_t int16_t;
|
||||
typedef ::int32_t int32_t;
|
||||
typedef ::int64_t int64_t;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/impl_constants.hpp>
|
||||
#include <uavcan/time.hpp>
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <stdint.h>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/linked_list.hpp>
|
||||
#include <uavcan/dynamic_memory.hpp>
|
||||
#include <uavcan/impl_constants.hpp>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <stdint.h>
|
||||
#include <uavcan/stdint.hpp>
|
||||
|
||||
namespace uavcan
|
||||
{
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <stdint.h>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/transport/transfer_listener.hpp>
|
||||
#include <uavcan/transport/outgoing_transfer_registry.hpp>
|
||||
#include <uavcan/transport/can_io.hpp>
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <stdint.h>
|
||||
#include <sstream>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/impl_constants.hpp>
|
||||
#include <uavcan/map.hpp>
|
||||
#include <uavcan/debug.hpp>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <stdint.h>
|
||||
#include <uavcan/stdint.hpp>
|
||||
|
||||
namespace uavcan
|
||||
{
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/transport/frame.hpp>
|
||||
#include <uavcan/linked_list.hpp>
|
||||
#include <uavcan/dynamic_memory.hpp>
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
#include <cassert>
|
||||
#include <algorithm>
|
||||
#include <stdint.h>
|
||||
#include <uavcan/stdint.hpp>
|
||||
#include <uavcan/transport/transfer_receiver.hpp>
|
||||
#include <uavcan/linked_list.hpp>
|
||||
#include <uavcan/map.hpp>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user