File: MenuSingleton.h

package info (click to toggle)
moagg 0.18-6
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 1,924 kB
  • ctags: 4,059
  • sloc: cpp: 23,814; sh: 2,652; makefile: 283
file content (26 lines) | stat: -rw-r--r-- 636 bytes parent folder | download | duplicates (3)
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
#ifndef MENU_SINGLETON_H
#define MENU_SINGLETON_H

// agranig: we'll need this definitions for each
// new menu, so this will make life easier ;o)

#define MENU_SINGLETON(t) \
  public: \
    virtual ~t##Menu(); \
    static t##Menu* getInstance() { \
      if(sm_instance == NULL) \
        sm_instance = new t##Menu(); \
      return sm_instance; \
    } \
    static void destroy() { \
      ZAP_POINTER(sm_instance); \
    }\
  protected: \
    t##Menu(); \
    t##Menu(t##Menu &c); \
    static t##Menu *sm_instance

#define MENU_SINGLETON_INIT(t)             \
    t##Menu* t##Menu::sm_instance = NULL

#endif // MENU_SINGLETON_H