Quantum++  v1.0-rc2
A modern C++11 quantum computing library
idisplay.h
Go to the documentation of this file.
1 /*
2  * Quantum++
3  *
4  * Copyright (c) 2013 - 2017 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 {
42 class IDisplay
43 {
44 private:
53  virtual std::ostream& display(std::ostream& os) const = 0;
54 
55 public:
59  IDisplay() = default;
60 
64  IDisplay(const IDisplay&) = default;
65 
69  IDisplay(IDisplay&&) = default;
70 
74  IDisplay& operator=(const IDisplay&) = default;
75 
79  IDisplay& operator=(IDisplay&&) = default;
80 
84  virtual ~IDisplay() = default;
85 
91  friend inline
92  std::ostream& operator<<(std::ostream& os, const IDisplay& rhs)
93  {
94  return rhs.display(os);
95  }
96 }; /* class IDisplay */
97 
98 } /* namespace qpp */
99 
100 #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:92
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:42
IDisplay()=default
Default constructor.