3 This file is part of libmspcore
4 Copyright © 2006-2008, 2011 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #ifndef MSP_CORE_APPLICATION_H_
9 #define MSP_CORE_APPLICATION_H_
14 Base class for applications. Inherit the main class from this and add a static
15 member of type RegApp<MainClass>.
23 virtual Application *create_app(int, char **)=0;
24 virtual void usage(const char *, const char *, bool)=0;
25 virtual ~RegBase() { }
31 class RegApp: public RegBase
34 Application *create_app(int argc, char **argv) { return new T(argc, argv); }
35 void usage(const char *r, const char *a, bool b) { T::usage(r, a, b); }
42 static RegBase *reg_app_;
43 static Application *app_;
49 virtual ~Application() { }
51 static int run(int, char **, void * =0);
52 static void usage(const char *, const char *, bool);
53 static void *get_data() { return data_; }
57 void catch_signal(int);
59 virtual void tick() { }
60 virtual void sighandler(int) { }
62 static void sighandler_(int);
64 Application(const Application &);
65 Application &operator=(const Application &);