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-2018 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 "psi4/pragma.h"
33 #include <vector>
34 #include <string>
35 #include <iostream>
36 #include <ostream>
37 
38 namespace psi {
39 
41  private:
42  std::ostream* stream_;
43  bool is_cout_;
44  std::vector<char> buffer_;
45 
46  public:
47  PsiOutStream(std::string fname = "", std::ios_base::openmode mode = std::ostream::trunc);
48  ~PsiOutStream();
49 
50  void Printf(const char* fmt, ...);
51  void Printf(std::string fp);
52  void MakeBanner(std::string header);
53 
54  std::ostream* stream() { return stream_; }
55 
56  // Incase we want to overload << again
57  // template <class T>
58  // PsiOutStream& operator<<(T&& x) {
59  // *stream_ << std::forward<T>(x);
60  // return (*this);
61  // }
62 
63  // PsiOutStream& operator<<(std::ostream& (*oper)(std::ostream&)) {
64  // *stream_ << oper;
65  // return (*this);
66  // }
67 };
68 
69 } // End Psi namespace
70 #endif
std::ostream * stream_
Definition: PsiOutStream.h:42
bool is_cout_
Definition: PsiOutStream.h:43
std::vector< char > buffer_
Definition: PsiOutStream.h:44
Definition: PsiOutStream.h:40
#define PSI_API
Definition: pragma.h:128
std::ostream * stream()
Definition: PsiOutStream.h:54