Quantum++  v1.0.0-beta1
C++11 quantum computing library
idisplay.h
Go to the documentation of this file.
1 /*
2  * Quantum++
3  *
4  * Copyright (c) 2013 - 2016 Vlad Gheorghiu (vgheorgh@gmail.com)
5  *
6  * This file is part of Quantum++.
7  *
8  * Quantum++ is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * Quantum++ is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with Quantum++. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
27 #ifndef CLASSES_IDISPLAY_H_
28 #define CLASSES_IDISPLAY_H_
29 
30 namespace qpp
31 {
32 
43 class IDisplay
44 {
45 private:
54  virtual std::ostream& display(std::ostream& os) const = 0;
55 
56 public:
60  IDisplay() = default;
61 
65  IDisplay(const IDisplay&) = default;
66 
70  IDisplay(IDisplay&&) = default;
71 
75  IDisplay& operator=(const IDisplay&) = default;
76 
80  IDisplay& operator=(IDisplay&&) = default;
81 
85  virtual ~IDisplay() = default;
86 
92  friend inline
93  std::ostream& operator<<(std::ostream& os, const IDisplay& rhs)
94  {
95  return rhs.display(os);
96  }
97 }; /* class IDisplay */
98 
99 } /* namespace qpp */
100 
101 #endif /* CLASSES_IDISPLAY_H_ */
virtual std::ostream & display(std::ostream &os) const =0
Must be overridden by all derived classes.
Quantum++ main namespace.
Definition: codes.h:30
friend std::ostream & operator<<(std::ostream &os, const IDisplay &rhs)
Overloads the extraction operator.
Definition: idisplay.h:93
IDisplay & operator=(const IDisplay &)=default
Default copy assignment operator.
virtual ~IDisplay()=default
Default virtual destructor.
Abstract class (interface) that mandates the definition of virtual std::ostream& display(std::ostream...
Definition: idisplay.h:43
IDisplay()=default
Default constructor.