TBTK
Need a break? Support the development by playing Polarity Puzzles
Streamable.h
Go to the documentation of this file.
1 /* Copyright 2019 Kristofer Bj√∂rnson
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
23 #ifndef COM_DAFER45_TBTK_STREAMABLE
24 #define COM_DAFER45_TBTK_STREAMABLE
25 
26 #include <string>
27 
28 namespace TBTK{
29 
30 class Streamable{
31 public:
37  virtual std::string toString() const = 0;
38 
43  friend std::ostream& operator<<(
44  std::ostream &stream,
45  const Streamable &streamable
46  );
47 };
48 
49 inline std::ostream& operator<<(
50  std::ostream &stream,
51  const Streamable &streamable
52 ){
53  stream << streamable.toString();
54 
55  return stream;
56 }
57 
58 }; //End of namespace TBTK
59 
60 #endif
TBTK::Streamable
Definition: Streamable.h:30
TBTK::Streamable::operator<<
friend std::ostream & operator<<(std::ostream &stream, const Streamable &streamable)
Definition: Streamable.h:49
TBTK::operator<<
std::ostream & operator<<(std::ostream &stream, const HoppingAmplitude &hoppingAmplitude)
Definition: HoppingAmplitude.h:315
TBTK::Streamable::toString
virtual std::string toString() const =0