Public Member Functions | Private Attributes | List of all members
cet::ostream_handle Class Reference

#include <ostream_handle.h>

Public Member Functions

 ostream_handle ()=default
 
 ostream_handle (std::ostream &os)
 
 ostream_handle (std::string const &fn, std::ios_base::openmode const mode=std::ios_base::out)
 
template<typename OSTREAM , typename = std::enable_if_t<std::is_base_of_v<std::ostream, OSTREAM>>>
 ostream_handle (OSTREAM &&os)
 
ostream_handleoperator<< (char const msg[])
 
template<typename T >
ostream_handleoperator<< (T const &t)
 
void flush ()
 
 operator bool () const
 
 operator std::ostream & ()
 

Private Attributes

std::unique_ptr< detail::ostream_handle_baseosh_
 

Detailed Description

Definition at line 37 of file ostream_handle.h.

Constructor & Destructor Documentation

cet::ostream_handle::ostream_handle ( )
default
cet::ostream_handle::ostream_handle ( std::ostream &  os)
inline

Definition at line 42 of file ostream_handle.h.

43  : osh_{std::make_unique<detail::ostream_observer>(os)}
44  {}
std::unique_ptr< detail::ostream_handle_base > osh_
cet::ostream_handle::ostream_handle ( std::string const &  fn,
std::ios_base::openmode const  mode = std::ios_base::out 
)
inline

Definition at line 47 of file ostream_handle.h.

49  : osh_{std::make_unique<detail::ostream_owner<std::ofstream>>(
50  std::ofstream(fn, mode))}
51  {}
std::unique_ptr< detail::ostream_handle_base > osh_
QAsciiDict< Entry > fn
template<typename OSTREAM , typename = std::enable_if_t<std::is_base_of_v<std::ostream, OSTREAM>>>
cet::ostream_handle::ostream_handle ( OSTREAM &&  os)
inline

Definition at line 57 of file ostream_handle.h.

58  : osh_{std::make_unique<detail::ostream_owner<OSTREAM>>(std::move(os))}
59  {}
std::unique_ptr< detail::ostream_handle_base > osh_
def move(depos, offset)
Definition: depos.py:107

Member Function Documentation

void cet::ostream_handle::flush ( )
inline

Definition at line 77 of file ostream_handle.h.

78  {
79  osh_->stream().flush();
80  }
std::unique_ptr< detail::ostream_handle_base > osh_
cet::ostream_handle::operator bool ( ) const
inlineexplicit

Definition at line 81 of file ostream_handle.h.

81 { return static_cast<bool>(osh_->stream()); }
std::unique_ptr< detail::ostream_handle_base > osh_
cet::ostream_handle::operator std::ostream & ( )
inline

Definition at line 82 of file ostream_handle.h.

82 { return osh_->stream(); }
std::unique_ptr< detail::ostream_handle_base > osh_
ostream_handle& cet::ostream_handle::operator<< ( char const  msg[])
inline

Definition at line 62 of file ostream_handle.h.

63  {
64  osh_->stream() << msg;
65  return *this;
66  }
std::unique_ptr< detail::ostream_handle_base > osh_
void msg(const char *fmt,...)
Definition: message.cpp:107
template<typename T >
ostream_handle& cet::ostream_handle::operator<< ( T const &  t)
inline

Definition at line 70 of file ostream_handle.h.

71  {
72  osh_->stream() << t;
73  return *this;
74  }
std::unique_ptr< detail::ostream_handle_base > osh_

Member Data Documentation

std::unique_ptr<detail::ostream_handle_base> cet::ostream_handle::osh_
private

Definition at line 85 of file ostream_handle.h.


The documentation for this class was generated from the following file: