Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
cetlib
cetlib
detail
ostream_handle_impl.h
Go to the documentation of this file.
1
#ifndef cetlib_detail_ostream_handle_impl_h
2
#define cetlib_detail_ostream_handle_impl_h
3
4
#include <fstream>
5
#include <ostream>
6
#include <string>
7
8
namespace
cet::detail
{
9
10
// Interface
11
class
ostream_handle_base
{
12
public
:
13
virtual
~ostream_handle_base
() =
default
;
14
std::ostream&
15
stream
()
16
{
17
return
get_stream
();
18
}
19
20
private
:
21
virtual
std::ostream&
get_stream
() = 0;
22
};
23
24
// Concrete types below
25
class
ostream_observer
:
public
ostream_handle_base
{
26
public
:
27
ostream_observer
(std::ostream& os) : os_{os} {}
28
29
private
:
30
std::ostream&
os_
;
31
std::ostream&
32
get_stream
()
override
33
{
34
return
os_;
35
}
36
};
37
38
template
<
typename
OSTREAM,
39
typename
=
40
std::enable_if_t<std::is_base_of_v<std::ostream, OSTREAM>>>
41
class
ostream_owner
:
public
ostream_handle_base
{
42
public
:
43
ostream_owner
(OSTREAM&& os) : os_(
std
::
move
(os)) {}
44
45
private
:
46
OSTREAM
os_
;
47
std::ostream&
48
get_stream
()
override
49
{
50
return
os_;
51
}
52
};
53
}
54
55
#endif
/* cetlib_detail_ostream_handle_impl_h */
56
57
// Local variables:
58
// mode: c++
59
// End:
cet::detail::ostream_owner
Definition:
ostream_handle_impl.h:41
std
STL namespace.
cet::detail::ostream_observer::ostream_observer
ostream_observer(std::ostream &os)
Definition:
ostream_handle_impl.h:27
cet::detail::ostream_handle_base::stream
std::ostream & stream()
Definition:
ostream_handle_impl.h:15
cet::detail::ostream_handle_base
Definition:
ostream_handle_impl.h:11
cet::detail::ostream_observer::get_stream
std::ostream & get_stream() override
Definition:
ostream_handle_impl.h:32
cet::detail::ostream_observer
Definition:
ostream_handle_impl.h:25
wirecell.gen.depos.move
def move(depos, offset)
Definition:
depos.py:107
cet::detail
Definition:
canonical_string.h:33
cet::detail::ostream_observer::os_
std::ostream & os_
Definition:
ostream_handle_impl.h:30
cet::detail::ostream_handle_base::get_stream
virtual std::ostream & get_stream()=0
cet::detail::ostream_owner::os_
OSTREAM os_
Definition:
ostream_handle_impl.h:46
cet::detail::ostream_owner::ostream_owner
ostream_owner(OSTREAM &&os)
Definition:
ostream_handle_impl.h:43
cet::detail::ostream_handle_base::~ostream_handle_base
virtual ~ostream_handle_base()=default
cet::detail::ostream_owner::get_stream
std::ostream & get_stream() override
Definition:
ostream_handle_impl.h:48
Generated by
1.8.11