]> vaikene.ee Git - evaf/blobdiff - src/libs/Common/globals.h
Mac OS changes and switched to c++11.
[evaf] / src / libs / Common / globals.h
index e21aa867f13ebd049bef4c195a6f66098bc6034d..ca360505dae81e817e298928978212e0a0961134 100644 (file)
@@ -3,7 +3,7 @@
  * @brief Global constants and macros for eVaf
  * @author Enar Vaikene
  *
- * Copyright (c) 2011 Enar Vaikene
+ * Copyright (c) 2011-2019 Enar Vaikene
  *
  * This file is part of the eVaf C++ cross-platform application development framework.
  *
 #  define __COMMON_GLOBALS_H
 
 #include "libcommon.h"
+#include "ilogger.h"
 
 /**
- * Common namespace for eVaf.
+ * @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 {
 
 /**
@@ -39,16 +71,48 @@ namespace eVaf {
 namespace Common {
 
 /**
- * eVaf common library initialized
- * @param args List of arguments
+ * 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(QStringList const & args);
+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