ROL
src
zoo
ROL_Stream.hpp
Go to the documentation of this file.
1
// @HEADER
2
// *****************************************************************************
3
// Rapid Optimization Library (ROL) Package
4
//
5
// Copyright 2014 NTESS and the ROL contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#pragma once
11
#ifndef ROL_STREAM_HPP
12
#define ROL_STREAM_HPP
13
14
#include <ostream>
15
#include <string>
16
#include "ROL_Ptr.hpp"
17
26
namespace
ROL
{
27
28
namespace
details
{
29
30
template
<
typename
_CharT,
typename
_Traits>
31
class
basic_nullstream
:
virtual
public
std::basic_ostream<_CharT, _Traits> {
32
public
:
33
explicit
basic_nullstream
() : std::basic_ostream<_CharT, _Traits>(NULL) {}
34
};
35
36
using
nullstream
=
basic_nullstream<char, std::char_traits<char>
>;
37
38
inline
39
Ptr<std::ostream>
makeStreamPtr
( std::ostream& os,
bool
noSuppressOutput=
true
) {
40
Ptr<std::ostream> retstream;
41
if
( noSuppressOutput ) retstream = makePtrFromRef<std::ostream>(os);
42
else
retstream = makePtr<nullstream>();
43
return
retstream;
// noSuppressOutput ? makePtrFromRef( os ) : makePtr<nullstream>();
44
}
45
46
inline
47
Ptr<std::ostream>
makeStreamPtr
( Ptr<std::ostream> os,
bool
noSuppressOutput=
true
) {
48
Ptr<std::ostream> retstream;
49
if
( noSuppressOutput ) retstream = os;
50
else
retstream = makePtr<nullstream>();
51
return
retstream;
// noSuppressOutput ? makePtrFromRef( os ) : makePtr<nullstream>();
52
// return noSuppressOutput ? os : makePtr<nullstream>();
53
}
54
55
}
// details
56
57
using
details::nullstream
;
58
using
details::makeStreamPtr;
59
60
}
// namespace ROL
61
62
63
#endif
ROL::details::basic_nullstream
Definition
ROL_Stream.hpp:31
ROL::details::basic_nullstream::basic_nullstream
basic_nullstream()
Definition
ROL_Stream.hpp:33
ROL::details::makeStreamPtr
Ptr< std::ostream > makeStreamPtr(std::ostream &os, bool noSuppressOutput=true)
Definition
ROL_Stream.hpp:39
ROL::details::nullstream
basic_nullstream< char, std::char_traits< char > > nullstream
Definition
ROL_Stream.hpp:36
ROL
Definition
ROL_ElementwiseVector.hpp:27
details
Definition
vector/test_10.cpp:25
Generated by
1.9.8