1 #ifndef MSP_CORE_APPLICATION_H_
2 #define MSP_CORE_APPLICATION_H_
7 Base class for applications. See also RegisteredApplication.
17 virtual ~Starter() { }
19 virtual Application *create_app(int, char **) = 0;
26 static Starter *starter_;
27 static Application *app_;
30 Application(const Application &);
31 Application &operator=(const Application &);
35 virtual ~Application() { }
37 static int run(int, char **, void * =0);
38 static void *get_data() { return data_; }
42 void catch_signal(int);
44 virtual void tick() { }
45 virtual void sighandler(int) { }
47 static void sighandler_(int);
52 Registers the class to be used for program startup. The main application class
53 should be derived from this.
56 class RegisteredApplication: public Application
59 class Starter: public Application::Starter
62 Application *create_app(int argc, char **argv) { return new T(argc, argv); }
65 static Starter starter_;
68 // Force the starter into existence
69 RegisteredApplication() { (void)starter_; }
73 typename RegisteredApplication<T>::Starter RegisteredApplication<T>::starter_;