/***************************************************************************

    source::worx xtree
    Copyright © 2024-2025 c.holzheuer
    christoph.holzheuer@gmail.com

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

***************************************************************************/


#ifndef XSINGLETON_H
#define XSINGLETON_H

/**
 * @brief The classic singleton template interface.
 */

template <typename T>
class xsingleton
{

public:

  //! Get the singleton instance.
  static T& instance()
  {
    static T Instance;
    return Instance;
  }

protected:

  xsingleton() {}
  virtual ~xsingleton() {}

private:

  xsingleton(xsingleton const &) = delete;
  xsingleton& operator=(xsingleton const &) = delete;

};

#endif // XSINGLETON_H

