Line data Source code
1 : // SPDX-FileCopyrightText: 2024 PairInteraction Developers 2 : // SPDX-License-Identifier: LGPL-3.0-or-later 3 : 4 : #pragma once 5 : 6 : #include <memory> 7 : #include <string> 8 : #include <type_traits> 9 : 10 : namespace pairinteraction { 11 : 12 : /** 13 : * @class Ket 14 : * 15 : * @brief Base class for a ket. 16 : * 17 : * This base class represents a ket. It is a base class for specific ket implementations. Its 18 : * constructor is protected to indicate that derived classes should not allow direct instantiation. 19 : * Instead, a factory class should be provided that is a friend of the derived class and can create 20 : * instances of it. 21 : */ 22 : 23 : class Ket { 24 : public: 25 : Ket() = delete; 26 3008959 : virtual ~Ket() = default; 27 : 28 : double get_energy() const; 29 : 30 : protected: 31 : explicit Ket(double energy); 32 : 33 : bool operator==(const Ket &other) const; 34 : 35 : struct hash { 36 : std::size_t operator()(const Ket &k) const; 37 : }; 38 : 39 : double energy; 40 : }; 41 : } // namespace pairinteraction