libs
libuavcan
libuavcan
include
uavcan
std.hpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
3
*/
4
5
#ifndef UAVCAN_STD_HPP_INCLUDED
6
#define UAVCAN_STD_HPP_INCLUDED
7
8
#include <
uavcan/build_config.hpp
>
9
#include <cstdarg>
10
#include <cstddef>
11
12
#if !defined(UAVCAN_CPP_VERSION) || !defined(UAVCAN_CPP11)
13
# error UAVCAN_CPP_VERSION
14
#endif
15
16
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
17
18
# include <cstdint>
19
# include <cstdio>
20
21
namespace
uavcan
22
{
23
24
typedef
std::uint8_t
uint8_t
;
25
typedef
std::uint16_t
uint16_t
;
26
typedef
std::uint32_t
uint32_t
;
27
typedef
std::uint64_t
uint64_t
;
28
29
typedef
std::int8_t
int8_t
;
30
typedef
std::int16_t
int16_t
;
31
typedef
std::int32_t
int32_t
;
32
typedef
std::int64_t
int64_t
;
33
34
}
35
36
#else
37
38
# include <stdint.h>
// Standard integer types from C library
39
# include <stdio.h>
// vsnprintf() from the C library
40
41
namespace
uavcan
42
{
43
44
typedef ::uint8_t
uint8_t
;
45
typedef ::uint16_t
uint16_t
;
46
typedef ::uint32_t
uint32_t
;
47
typedef ::uint64_t
uint64_t
;
48
49
typedef ::int8_t
int8_t
;
50
typedef ::int16_t
int16_t
;
51
typedef ::int32_t
int32_t
;
52
typedef ::int64_t
int64_t
;
53
54
}
55
56
#endif
57
58
namespace
uavcan
59
{
67
#if __GNUC__
68
__attribute__
((
format
(printf, 3, 4)))
69
#endif
70
extern
int
snprintf
(
char
* out,
std::size_t
maxlen,
const
char
*
format
, ...);
71
72
#if !UAVCAN_USE_EXTERNAL_SNPRINTF
73
inline
int
snprintf
(
char
* out,
std::size_t
maxlen,
const
char
*
format
, ...)
74
{
75
using namespace
std
;
// This way we can pull vsnprintf() either from std:: or from ::.
76
va_list
args
;
77
va_start(
args
,
format
);
78
const
int
return_value = vsnprintf(out, maxlen,
format
,
args
);
79
va_end(
args
);
80
return
return_value;
81
}
82
#endif
83
84
}
85
86
#endif // UAVCAN_STD_HPP_INCLUDED
uavcan::uint64_t
std::uint64_t uint64_t
Definition:
std.hpp:27
std::size_t
unsigned long size_t
Definition:
coverity_scan_model.cpp:19
uavcan::uint32_t
std::uint32_t uint32_t
Definition:
std.hpp:26
uavcan::int64_t
std::int64_t int64_t
Definition:
std.hpp:32
uavcan::uint16_t
std::uint16_t uint16_t
Definition:
std.hpp:25
uavcan::int16_t
std::int16_t int16_t
Definition:
std.hpp:30
uavcan::int32_t
std::int32_t int32_t
Definition:
std.hpp:31
uavcan::uint8_t
std::uint8_t uint8_t
Definition:
std.hpp:24
uavcan::snprintf
int snprintf(char *out, std::size_t maxlen, const char *format,...)
Definition:
std.hpp:73
setup.args
args
Definition:
pyuavcan/setup.py:22
build_config.hpp
uavcan::int8_t
std::int8_t int8_t
Definition:
std.hpp:29
std
__attribute__
__attribute__((gnu_inline)) inline void spi_start(uint8_t data)
Definition:
spi.h:74
uavcan
Definition:
libuavcan/libuavcan/include/uavcan/build_config.hpp:204
test.format
format
Definition:
dsdl/test.py:6
uavcan_communicator
Author(s):
autogenerated on Fri Dec 13 2024 03:10:03