Macros
SingletonMacros.hpp File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define OPENFLUID_SINGLETON_DEFINITION(T)
 
#define OPENFLUID_SINGLETON_INITIALIZATION(T)
 

Detailed Description

Author
Jean-Christophe FABRE jean-.nosp@m.chri.nosp@m.stoph.nosp@m.e.fa.nosp@m.bre@s.nosp@m.upag.nosp@m.ro.in.nosp@m.ra.f.nosp@m.r

Macro Definition Documentation

#define OPENFLUID_SINGLETON_DEFINITION (   T)

Macro for definition of a dynamic singleton, providing instance() and kill() methods to the class in which it is defined. It must be put in the .hpp file, at the beginning of the class. This implementation is not thread safe.

Example of use to design an Example class as a dynamic singleton

1 // .hpp file
2 
3 class Example
4 {
5  OPENFLUID_SINGLETON_DEFINITION(Example)
6 
7  private:
8 
9  Example();
10 
11  ~Example();
12 
13 
14  public:
15 
16  // some public members
17 };
1 // .cpp file
2 
3 OPENFLUID_SINGLETON_INITIALIZATION(Example)
4 };
See also
OPENFLUID_SINGLETON_INITIALIZATION
#define OPENFLUID_SINGLETON_INITIALIZATION (   T)

Macro for initialization of a dynamic singleton, must be put in the .cpp file.

See also
OPENFLUID_SINGLETON_DEFINITION