3 * Application and Runtime classes
5 * Copyright (C) 2008-2009 Pawel Dziepak
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 #define hydra_app_class(x) \
29 void __hydra_start() { \
30 hydra::application *app = new x(); \
31 hydra::runtime::get()->start_app(app); \
36 * @brief Base for main class of each Hydra program.
37 * @details Each Hydra program has to define its main class which inherits
38 * from this base. There is one instance of such class for each process
39 * executing the same Hydra program. Subclass has to provide at least
40 * method init() which is called at the program startup.
45 * User interface used by the program.
51 * Entry point of each Hydra program.
52 * After initialization Hydra runtime calls this function which has
53 * to be provided by subclass of application. The main task of
54 * this method is to prepare ui used by program.
56 virtual void init() = 0;
57 //virtual void release() = 0;
59 void set_ui(ui::ui_type
);
66 * @brief Runtime support for Hydra applications.
67 * @details When Hydra program is run, functions provided by this class
68 * are to be first to execute. This class manages execution flow for
69 * whole lifetime of the process. Runtime class is a singleton, hence
70 * there is only one instance for all processes running the same program.
74 //list<application *> apps;
77 static runtime
*instance
;
82 static runtime
*get();
85 * Start application and manages execution flow.
86 * This function initializes Hydra framework, executes
87 * method hydra::init() and then takes responsibility of
88 * providing user interface and reacting on events.
89 * @param app An instance of main class of Hydra program.
91 void start_app(application
*app
);