Psi4
PsiOutStream.h
Go to the documentation of this file.
1 /*
2  * @BEGIN LICENSE
3  *
4  * Psi4: an open-source quantum chemistry software package
5  *
6  * Copyright (c) 2007-2017 The Psi4 Developers.
7  *
8  * The copyrights for code used from other parties are included in
9  * the corresponding files.
10  *
11  * This file is part of Psi4.
12  *
13  * Psi4 is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU Lesser General Public License as published by
15  * the Free Software Foundation, version 3.
16  *
17  * Psi4 is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License along
23  * with Psi4; if not, write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25  *
26  * @END LICENSE
27  */
28 
29 #ifndef _psi_src_lib_libpsi4util_psioutstream_h_
30 #define _psi_src_lib_libpsi4util_psioutstream_h_
31 
32 #include <vector>
33 #include <string>
34 #include <iostream>
35 #include <ostream>
36 
37 namespace psi {
38 
39 class PsiOutStream {
40  private:
41  std::ostream* stream_;
42  bool is_cout_;
43  std::vector<char> buffer_;
44 
45  public:
46  PsiOutStream(std::string fname = "", std::ios_base::openmode mode = std::ostream::trunc);
47  ~PsiOutStream();
48 
49  void Printf(const char* fmt, ...);
50  void Printf(std::string fp);
51  void MakeBanner(std::string header);
52 
53  std::ostream* stream() { return stream_; }
54 
55  // Incase we want to overload << again
56  // template <class T>
57  // PsiOutStream& operator<<(T&& x) {
58  // *stream_ << std::forward<T>(x);
59  // return (*this);
60  // }
61 
62  // PsiOutStream& operator<<(std::ostream& (*oper)(std::ostream&)) {
63  // *stream_ << oper;
64  // return (*this);
65  // }
66 };
67 
68 } // End Psi namespace
69 #endif
std::ostream * stream_
Definition: PsiOutStream.h:41
bool is_cout_
Definition: PsiOutStream.h:42
~PsiOutStream()
Definition: PsiOutStream.cc:59
std::vector< char > buffer_
Definition: PsiOutStream.h:43
PsiOutStream(std::string fname="", std::ios_base::openmode mode=std::ostream::trunc)
Definition: PsiOutStream.cc:40
Definition: PsiOutStream.h:39
void MakeBanner(std::string header)
std::ostream * stream()
Definition: PsiOutStream.h:53
void Printf(const char *fmt,...)
Definition: PsiOutStream.cc:65