File size: 553 Bytes
d1be154
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once

namespace tf {

/** @class Singleton

@brief class template to create a thread-safe singleton object

*/
template <typename T>
class Singleton {

  public:

  /**
  @brief get a reference to the singleton object
  */
  inline static T& get() {
    static T instance;
    return instance;
  }

  private:

    Singleton() = default;
    ~Singleton() = default;
    Singleton(const Singleton&)= delete;
    Singleton& operator=(const Singleton&)= delete;
};



}  // end of namespace tf -----------------------------------------------------