libs
libuavcan
libuavcan
include
uavcan
helpers
ostream.hpp
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
3
*/
4
5
#ifndef UAVCAN_HELPERS_OSTREAM_HPP_INCLUDED
6
#define UAVCAN_HELPERS_OSTREAM_HPP_INCLUDED
7
8
#include <
uavcan/util/templates.hpp
>
9
#include <cstdio>
10
11
namespace
uavcan
12
{
22
class
UAVCAN_EXPORT
OStream
:
uavcan::Noncopyable
23
{
24
OStream
() { }
25
26
public
:
27
static
OStream
&
instance
()
28
{
29
static
OStream
s
;
30
return
s
;
31
}
32
33
static
OStream
&
endl
(
OStream
&
stream
)
34
{
35
std::printf(
"\n"
);
36
return
stream
;
37
}
38
};
39
40
inline
OStream
&
operator<<
(
OStream
&
s
,
long
long
x
) { std::printf(
"%lld"
,
x
);
return
s
; }
41
inline
OStream
&
operator<<
(
OStream
&
s
,
unsigned
long
long
x
) { std::printf(
"%llu"
,
x
);
return
s
; }
42
43
inline
OStream
&
operator<<
(
OStream
&
s
,
long
x
) { std::printf(
"%ld"
,
x
);
return
s
; }
44
inline
OStream
&
operator<<
(
OStream
&
s
,
unsigned
long
x
) { std::printf(
"%lu"
,
x
);
return
s
; }
45
46
inline
OStream
&
operator<<
(
OStream
&
s
,
int
x
) { std::printf(
"%d"
,
x
);
return
s
; }
47
inline
OStream
&
operator<<
(
OStream
&
s
,
unsigned
int
x
) { std::printf(
"%u"
,
x
);
return
s
; }
48
49
inline
OStream
&
operator<<
(
OStream
&
s
,
short
x
) {
return
operator<<(s, static_cast<int>(
x
)); }
50
inline
OStream
&
operator<<
(
OStream
&
s
,
unsigned
short
x
) {
return
operator<<(s, static_cast<unsigned>(
x
)); }
51
52
inline
OStream
&
operator<<
(
OStream
&
s
,
long
double
x
) { std::printf(
"%Lg"
,
x
);
return
s
; }
53
inline
OStream
&
operator<<
(
OStream
&
s
,
double
x
) { std::printf(
"%g"
,
x
);
return
s
; }
54
inline
OStream
&
operator<<
(
OStream
&
s
,
float
x
) {
return
operator<<(s, static_cast<double>(
x
)); }
55
56
inline
OStream
&
operator<<
(
OStream
&
s
,
char
x
) { std::printf(
"%c"
,
x
);
return
s
; }
57
inline
OStream
&
operator<<
(
OStream
&
s
,
const
char
*
x
) { std::printf(
"%s"
,
x
);
return
s
; }
58
59
inline
OStream
&
operator<<
(
OStream
&
s
,
OStream
&(*manip)(
OStream
&)) {
return
manip(
s
); }
60
61
}
62
63
#endif // UAVCAN_HELPERS_OSTREAM_HPP_INCLUDED
uavcan::OStream
Definition:
ostream.hpp:22
uavcan::Noncopyable
Definition:
templates.hpp:46
templates.hpp
uavcan::OStream::instance
static OStream & instance()
Definition:
ostream.hpp:27
uavcan::operator<<
OStream & operator<<(OStream &s, long long x)
Definition:
ostream.hpp:40
uavcan::OStream::endl
static OStream & endl(OStream &stream)
Definition:
ostream.hpp:33
UAVCAN_EXPORT
#define UAVCAN_EXPORT
Definition:
libuavcan/libuavcan/include/uavcan/build_config.hpp:108
test.stream
stream
Definition:
dsdl/test.py:6
pyuavcan_v0.dsdl.signature.s
s
Definition:
signature.py:73
uavcan::OStream::OStream
OStream()
Definition:
ostream.hpp:24
uavcan
Definition:
libuavcan/libuavcan/include/uavcan/build_config.hpp:204
pyuavcan_v0.driver.timestamp_estimator.x
x
Definition:
timestamp_estimator.py:221
uavcan_communicator
Author(s):
autogenerated on Fri Dec 13 2024 03:10:02