1 #ifndef MSP_CORE_APPLICATION_H_
2 #define MSP_CORE_APPLICATION_H_
9 Base class for applications. See also RegisteredApplication.
19 virtual ~Starter() { }
21 virtual Application *create_app(int, char **) = 0;
28 static Starter *starter_;
29 static Application *app_;
32 Application(const Application &);
33 Application &operator=(const Application &);
37 virtual ~Application() { }
39 static int run(int, char **, void * =0);
40 static void *get_data() { return data_; }
44 void catch_signal(int);
46 virtual void tick() { }
47 virtual void sighandler(int) { }
49 static void sighandler_(int);
51 static void display_exception(const std::exception &);
56 Registers the class to be used for program startup. The main application class
57 should be derived from this.
60 class RegisteredApplication: public Application
63 class Starter: public Application::Starter
66 Application *create_app(int argc, char **argv) { return new T(argc, argv); }
69 static Starter starter_;
72 // Force the starter into existence
73 RegisteredApplication() { (void)starter_; }
77 typename RegisteredApplication<T>::Starter RegisteredApplication<T>::starter_;