Skip to content
Snippets Groups Projects
ISingleton.h 1.17 KiB
Newer Older
  • Learn to ignore specific revisions
  • //  ************************************************************************************************
    
    //  BornAgain: simulate and fit reflection and scattering
    
    //! @file      GUI/Models/ISingleton.h
    
    //! @brief     Defines the standard mix-in ISingleton.
    
    //! @homepage  http://www.bornagainproject.org
    
    //! @license   GNU General Public License v3 or higher (see COPYING)
    
    //! @copyright Forschungszentrum Jülich GmbH 2018
    //! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
    
    //  ************************************************************************************************
    
    #ifndef BORNAGAIN_GUI_MODELS_ISINGLETON_H
    #define BORNAGAIN_GUI_MODELS_ISINGLETON_H
    
    //! Base class for singletons.
    
    //! @ingroup tools_internal
    
    
    template <class T> class ISingleton {
    
    Wuttke, Joachim's avatar
    Wuttke, Joachim committed
            static T m_instance;
            return m_instance;
    
    Wuttke, Joachim's avatar
    Wuttke, Joachim committed
        ISingleton(const ISingleton&) = delete;
        ISingleton& operator=(const ISingleton&) = delete;
    
    Wuttke, Joachim's avatar
    Wuttke, Joachim committed
        ISingleton(ISingleton&&) = delete;
        ISingleton& operator=(ISingleton&&) = delete;
    
        
    protected:
        ISingleton() = default;
        ~ISingleton() = default;
    
    #endif // BORNAGAIN_GUI_MODELS_ISINGLETON_H