Psi4
PsiInStream.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 program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License along
22  * with this program; if not, write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  *
25  * @END LICENSE
26  */
27 
28 #include "StreamBase.h"
29 
30 namespace psi{
31 
40 class PsiInStream:public PsiStreamBase<std::istream>{
41  protected:
43  void ReadFromStream();
44  public:
45  PsiInStream(const PsiInStream& other):BaseType(other){}
46  const PsiInStream& operator=(const PsiInStream& other){
47  BaseType::operator=(other);
48  return *this;
49  }
50  virtual ~PsiInStream(){}
51 
53 
54  template<typename T>
55  std::istream& operator>>(T& thing){
56  Buffer_>>thing;
57  return Buffer_;
58  }
59 
61  operator bool(){return (bool)Buffer_;}
62 
63 };
64 }
Specialization of PsiStream to input streams (I doubt this class will ever be used by itself...
Definition: PsiInStream.h:40
std::istream & operator>>(T &thing)
Definition: PsiInStream.h:55
PsiInStream(const PsiInStream &other)
Definition: PsiInStream.h:45
const PsiInStream & operator=(const PsiInStream &other)
Definition: PsiInStream.h:46
std::shared_ptr< std::istream > SharedInStream
A shared input stream.
Definition: StreamBase.h:41
std::stringstream Buffer_
This is where each MPI task ultimately writes from or to.
Definition: StreamBase.h:71
virtual ~PsiInStream()
Definition: PsiInStream.h:50
PsiStreamBase< std::istream > BaseType
Definition: PsiInStream.h:42
const MyType & operator=(const MyType &other)
Calls Clone for assignment iff this!=&amp;other, returns *this.
Definition: StreamBase.h:88
The base class for Psi4&#39;s new parallel safe printing system.
Definition: StreamBase.h:58
Definition: PsiFileImpl.h:39
void ReadFromStream()
Definition: PsiInStream.cc:41