mlpack
3.1.1
src
mlpack
core
util
prefixedoutstream.hpp
Go to the documentation of this file.
1
13
#ifndef MLPACK_CORE_UTIL_PREFIXEDOUTSTREAM_HPP
14
#define MLPACK_CORE_UTIL_PREFIXEDOUTSTREAM_HPP
15
16
#include <
mlpack/prereqs.hpp
>
17
18
namespace
mlpack
{
19
namespace
util {
20
46
class
PrefixedOutStream
47
{
48
public
:
60
PrefixedOutStream
(std::ostream&
destination
,
61
const
char
* prefix,
62
bool
ignoreInput
=
false
,
63
bool
fatal =
false
,
64
bool
backtrace
=
true
) :
65
destination
(
destination
),
66
ignoreInput
(
ignoreInput
),
67
backtrace
(
backtrace
),
68
prefix(prefix),
69
// We want the first call to operator<< to prefix the prefix so we set
70
// carriageReturned to true.
71
carriageReturned(true),
72
fatal(fatal)
73
{
/* nothing to do */
}
74
76
PrefixedOutStream
&
operator<<
(
bool
val);
78
PrefixedOutStream
&
operator<<
(
short
val);
80
PrefixedOutStream
&
operator<<
(
unsigned
short
val);
82
PrefixedOutStream
&
operator<<
(
int
val);
84
PrefixedOutStream
&
operator<<
(
unsigned
int
val);
86
PrefixedOutStream
&
operator<<
(
long
val);
88
PrefixedOutStream
&
operator<<
(
unsigned
long
val);
90
PrefixedOutStream
&
operator<<
(
float
val);
92
PrefixedOutStream
&
operator<<
(
double
val);
94
PrefixedOutStream
&
operator<<
(
long
double
val);
96
PrefixedOutStream
&
operator<<
(
void
* val);
98
PrefixedOutStream
&
operator<<
(
const
char
* str);
100
PrefixedOutStream
&
operator<<
(std::string& str);
102
PrefixedOutStream
&
operator<<
(std::streambuf* sb);
104
PrefixedOutStream
&
operator<<
(std::ostream& (*pf)(std::ostream&));
106
PrefixedOutStream
&
operator<<
(std::ios& (*pf)(std::ios&));
108
PrefixedOutStream
&
operator<<
(std::ios_base& (*pf)(std::ios_base&));
109
111
template
<
typename
T>
112
PrefixedOutStream
&
operator<<
(
const
T& s);
113
115
std::ostream&
destination
;
116
118
bool
ignoreInput
;
119
122
bool
backtrace
;
123
124
private
:
135
template
<
typename
T>
136
typename
std::enable_if<!arma::is_arma_type<T>::value>::type
137
BaseLogic(
const
T& val);
138
149
template
<
typename
T>
150
typename
std::enable_if<arma::is_arma_type<T>::value>::type
151
BaseLogic(
const
T& val);
152
156
inline
void
PrefixIfNeeded();
157
159
std::string prefix;
160
163
bool
carriageReturned;
164
167
bool
fatal;
168
};
169
170
}
// namespace util
171
}
// namespace mlpack
172
173
// Template definitions.
174
#include "prefixedoutstream_impl.hpp"
175
176
#endif
mlpack::util::PrefixedOutStream::PrefixedOutStream
PrefixedOutStream(std::ostream &destination, const char *prefix, bool ignoreInput=false, bool fatal=false, bool backtrace=true)
Set up the PrefixedOutStream.
Definition:
prefixedoutstream.hpp:60
prereqs.hpp
mlpack::util::PrefixedOutStream::destination
std::ostream & destination
The output stream that all data is to be sent to; example: std::cout.
Definition:
prefixedoutstream.hpp:115
mlpack::util::PrefixedOutStream::operator<<
PrefixedOutStream & operator<<(bool val)
Write a bool to the stream.
mlpack::util::PrefixedOutStream::ignoreInput
bool ignoreInput
Discards input, prints nothing if true.
Definition:
prefixedoutstream.hpp:118
mlpack
@serialization.hpp
Definition:
add_to_po.hpp:21
mlpack::util::PrefixedOutStream::backtrace
bool backtrace
If true, on a fatal error, a backtrace will be printed if HAS_BFD_DL is defined.
Definition:
prefixedoutstream.hpp:122
mlpack::util::PrefixedOutStream
Allows us to output to an ostream with a prefix at the beginning of each line, in the same way we wou...
Definition:
prefixedoutstream.hpp:46
Generated by
1.8.17