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:
Pavel Kirienko 2014-03-17 21:15:20 +04:00
parent 81a03b4d5e
commit 41eeae8200
20 changed files with 69 additions and 19 deletions

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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>

View File

@ -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

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View 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

View File

@ -5,7 +5,7 @@
#pragma once
#include <stdint.h>
#include <uavcan/stdint.hpp>
#include <uavcan/impl_constants.hpp>
#include <uavcan/time.hpp>

View File

@ -4,7 +4,7 @@
#pragma once
#include <stdint.h>
#include <uavcan/stdint.hpp>
#include <algorithm>
#include <limits>
#include <sstream>

View File

@ -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>

View File

@ -5,7 +5,7 @@
#pragma once
#include <cassert>
#include <stdint.h>
#include <uavcan/stdint.hpp>
namespace uavcan
{

View File

@ -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>

View File

@ -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>

View File

@ -5,7 +5,7 @@
#pragma once
#include <cassert>
#include <stdint.h>
#include <uavcan/stdint.hpp>
namespace uavcan
{

View File

@ -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>

View File

@ -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>