1 #ifndef MSP_CORE_APPLICATION_H_
2 #define MSP_CORE_APPLICATION_H_
7 Base class for applications. Inherit the main class from this and add a static
8 member of type RegApp<MainClass>.
18 virtual ~Starter() { }
20 virtual Application *create_app(int, char **) = 0;
27 static Starter *starter_;
28 static Application *app_;
31 Application(const Application &);
32 Application &operator=(const Application &);
36 virtual ~Application() { }
38 static int run(int, char **, void * =0);
39 static void *get_data() { return data_; }
43 void catch_signal(int);
45 virtual void tick() { }
46 virtual void sighandler(int) { }
48 static void sighandler_(int);
53 class RegisteredApplication: public Application
56 class Starter: public Application::Starter
59 Application *create_app(int argc, char **argv) { return new T(argc, argv); }
62 static Starter starter_;
65 // Force the starter into existence
66 RegisteredApplication() { (void)starter_; }
70 typename RegisteredApplication<T>::Starter RegisteredApplication<T>::starter_;