]> vaikene.ee Git - evaf/blob - src/libs/Common/globals.h
More work on the common library and the main GUI application.
[evaf] / src / libs / Common / globals.h
1 /**
2 * @file Common/globals.h
3 * @brief Global constants and macros for eVaf
4 * @author Enar Vaikene
5 *
6 * Copyright (c) 2011 Enar Vaikene
7 *
8 * This file is part of the eVaf C++ cross-platform application development framework.
9 *
10 * This file can be used under the terms of the GNU General Public License
11 * version 3.0 as published by the Free Software Foundation and appearing in
12 * the file LICENSE included in the packaging of this file. Please review the
13 * the following information to ensure the GNU General Public License version
14 * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
15 *
16 * Alternatively, this file may be used in accordance with the Commercial License
17 * Agreement provided with the Software.
18 */
19
20 #ifndef __COMMON_GLOBALS_H
21 # define __COMMON_GLOBALS_H
22
23 #include "libcommon.h"
24 #include "ilogger.h"
25
26 /**
27 * eVaf is a C++ cross-platform modular application development framework using Qt.
28 *
29 * The eVaf main executable is an empty container that needs to be filled with external modules to
30 * provide the required functionality. The eVaf main GUI executable, if run without external modules,
31 * shows just an empty window that can be closed to terminate the application. The eVaf main CLI
32 * executable runs until terminated with CTRL+C.
33 *
34 * eVaf modules are loadable libraries (.so or .dll files) that implement the features and
35 * functions of the application. By combining together different modules, an unique application can
36 * be made in very little time. Every module implements a specific function or feature and only when
37 * put together, the actual application is created.
38 *
39 * eVaf interfaces are the way how the functionality of eVaf modules is used. Every feature implemented
40 * by a module has an interface used to feed the module with data or request information from the module.
41 *
42 * eVaf events are used by modules to send out information that they have collected or processed.
43 * While interfaces are the way how to feed modules with data or requests, then events are mostly for
44 * spontaneous data.
45 *
46 * Events broadcast by modules can have data objects attached to them. To avoid unnecessary copying of
47 * data, these data objects are shared and reference-counted. When the data object is attached to the
48 * event, its internal reference counter is increased by one. When the eVaf event queue has delivered
49 * the event to all the subscribers, it destroys the event and decreases the reference-counter of the
50 * data object by one. If no other module kept the data object, then the data object's reference counter
51 * becomes zero and it is destroyed too.
52 */
53 namespace eVaf {
54
55 /**
56 * Common eVaf library.
57 *
58 * This library contains interfaces, classes and functions shared by all the eVaf applications
59 * and modules. This library is the required dependency for all the other libraries, modules and
60 * applications.
61 *
62 * The common eVaf library shall be initialized with the eVaf::Common::init() function.
63 */
64 namespace Common {
65
66 /**
67 * eVaf common library initialized
68 * @return True if ok; false if the initialization failed
69 *
70 * Call this function to initialize the common eVaf library after creating the Qt application
71 * object and before loading any of the modules.
72 */
73 extern bool COMMON_EXPORT init();
74
75 /**
76 * Internal implementation of the common eVaf library.
77 */
78 namespace Internal {
79 } // namespace eVaf::Common::Internal
80 } // namespace eVaf::Common
81 } // namespace eVaf
82
83 /**
84 * Tests that the condition is true.
85 *
86 * This macro tests for the condition and if not true, exits with a fatal error.
87 * Use this macro to test for conditions that must be met in order for the application
88 * to continue.
89 */
90 #define EVAF_TEST(cond) \
91 if (!cond) \
92 EVAF_FATAL(#cond);
93
94 /**
95 * Tests that the condition is true with a custom error message.
96 *
97 * This macro tests for the condition and if not true, exist with a custom fatal error message.
98 */
99 #define EVAF_TEST_X(const, msg) \
100 if (!cond) \
101 EVAF_FATAL(msg);
102
103 #endif // globals.h