/** * @file Common/globals.h * @brief Global constants and macros for eVaf * @author Enar Vaikene * * Copyright (c) 2011-2019 Enar Vaikene * * This file is part of the eVaf C++ cross-platform application development framework. * * This file can be used under the terms of the GNU General Public License * version 3.0 as published by the Free Software Foundation and appearing in * the file LICENSE included in the packaging of this file. Please review the * the following information to ensure the GNU General Public License version * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html. * * Alternatively, this file may be used in accordance with the Commercial License * Agreement provided with the Software. */ #ifndef __COMMON_GLOBALS_H # define __COMMON_GLOBALS_H #include "libcommon.h" #include "ilogger.h" /** * @mainpage * eVaf is a C++ cross-platform modular application development framework using Qt. * * The eVaf main executable is an empty container that needs to be filled with external modules to * provide the required functionality. The eVaf main GUI executable, if run without external modules, * shows just an empty window that can be closed to terminate the application. The eVaf main CLI * executable runs until terminated with CTRL+C. * * eVaf modules are loadable libraries (.so or .dll files) that implement the features and * functions of the application. By combining together different modules, an unique application can * be made in very little time. Every module implements a specific function or feature and only when * put together, the actual application is created. * * eVaf interfaces are the way how the functionality of eVaf modules is used. Every feature implemented * by a module has an interface used to feed the module with data or request information from the module. * * eVaf events are used by modules to send out information that they have collected or processed. * While interfaces are the way how to feed modules with data or requests, then events are mostly for * spontaneous data. * * Events broadcast by modules can have data objects attached to them. To avoid unnecessary copying of * data, these data objects are shared and reference-counted. When the data object is attached to the * event, its internal reference counter is increased by one. When the eVaf event queue has delivered * the event to all the subscribers, it destroys the event and decreases the reference-counter of the * data object by one. If no other module kept the data object, then the data object's reference counter * becomes zero and it is destroyed too. */ /** * Global eVaf namespace. * * eVaf is a C++ cross-platform modular application development framework using Qt. */ namespace eVaf { /** * Common eVaf library. * * This library contains interfaces, classes and functions shared by all the eVaf applications * and modules. This library is the required dependency for all the other libraries, modules and * applications. * * The common eVaf library shall be initialized with the eVaf::Common::init() function. */ namespace Common { /** * eVaf common library initializer * @return True if ok; false if the initialization failed * * Call this function to initialize the common eVaf library after creating the Qt application * object and before loading any of the modules. */ extern bool COMMON_EXPORT init(); /** * eVaf common library finalizer * * Call this function to finalize the common eVaf library after destroying the Qt application * object and unloading all the modules. */ extern void COMMON_EXPORT done(); /** * Internal implementation of the common eVaf library. */ namespace Internal { } // namespace eVaf::Common::Internal } // namespace eVaf::Common } // namespace eVaf /** * Tests that the condition is true. * * This macro tests for the condition and if not true, exits with a fatal error. * Use this macro to test for conditions that must be met in order for the application * to continue. */ #define EVAF_TEST(cond) \ if (!cond) \ EVAF_FATAL_ERROR(#cond); /** * Tests that the condition is true with a custom error message. * * This macro tests for the condition and if not true, exist with a custom fatal error message. */ #define EVAF_TEST_X(cond, msg) \ if (!cond) \ EVAF_FATAL_ERROR(msg); #endif // globals.h