]> vaikene.ee Git - evaf/blobdiff - src/libs/Plugins/iplugin.h
Added more files to the project.
[evaf] / src / libs / Plugins / iplugin.h
diff --git a/src/libs/Plugins/iplugin.h b/src/libs/Plugins/iplugin.h
new file mode 100644 (file)
index 0000000..1cc2b8e
--- /dev/null
@@ -0,0 +1,94 @@
+/**
+ * @file plugins/iplugin.h
+ * @brief Common interface for all the eVaf modules
+ * @author Enar Vaikene
+ *
+ * Copyright (c) 2011 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 __PLUGINS_IPLUGIN_H
+#define __PLUGINS_IPLUGIN_H
+
+#include "libplugins.h"
+
+#include <QObject>
+#include <QString>
+
+namespace eVaf {
+namespace Plugins {
+
+/**
+ * Common interface for all the eVaf modules.
+ *
+ * @code#include <Plugins/iPlugin>@endcode
+ *
+ * The iPlugin interface is the common interface implemented by all the eVaf modules.
+ */
+class PLUGINS_EXPORT iPlugin : public QObject
+{
+    Q_OBJECT
+
+public:
+
+    /// Empty constructor
+    iPlugin() : QObject() {}
+
+    /// Empty virtual destructor
+    virtual ~iPlugin() {}
+
+    /**
+     * Initializes the module that implements the iPlugin interface
+     * @param args Arguments for the initialization
+     * @return True if ok; false if initialization failed
+     *
+     * The plugin manager calls the init() function for every eVaf module during the initialization
+     * of the application. Modules implementing the iPlugin interface shall allocate and initialize
+     * all the required resources in the init() function.
+     *
+     * Modules can assume that the init() function is always called once after loading the module
+     * and creating the interface object. Every init() function call is followed by a done()
+     * function call during the finalization of the application. Modules can be initialized
+     * multiple times without destroying the interface object, but init() function calls are
+     * always followed by a done() function call.
+     *
+     * When the init() function returns true, then the initialization of the module shall be completed
+     * and all the interfaces and other resources published by the module safe to use.
+     *
+     */
+    virtual bool init(const QString & args) = 0;
+
+    /**
+     * Finalizes the module.
+     *
+     * The plugin manager calls the done() function for every eVaf module during the finalization
+     * of the application. Modules implementing the iPlugin interface shall finalize and release
+     * all the resources in the done() function.
+     */
+    virtual void done() = 0;
+
+    /**
+     * Ready flag.
+     * @return True if the module is ready.
+     *
+     * The ready flag indicates that the module is initialized and all the published interfaces
+     * and resources safe to use.
+     */
+    virtual bool isReady() const = 0;
+
+};
+
+} // namespace eVaf::Plugins
+} // namespace eVaf
+
+#endif // iplugin.h