]>
vaikene.ee Git - evaf/blob - src/libs/Plugins/iplugin.h
2 * @file plugins/iplugin.h
3 * @brief Common interface for all the eVaf modules
6 * Copyright (c) 2011 Enar Vaikene
8 * This file is part of the eVaf C++ cross-platform application development framework.
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.
16 * Alternatively, this file may be used in accordance with the Commercial License
17 * Agreement provided with the Software.
20 #ifndef __PLUGINS_IPLUGIN_H
21 #define __PLUGINS_IPLUGIN_H
23 #include "libplugins.h"
32 * Common interface for all the eVaf modules.
34 * @code#include <Plugins/iPlugin>@endcode
36 * The iPlugin interface is the common interface implemented by all the eVaf modules.
38 class PLUGINS_EXPORT iPlugin
: public QObject
45 iPlugin() : QObject() {}
47 /// Empty virtual destructor
51 * Initializes the module that implements the iPlugin interface
52 * @param args Arguments for the initialization
53 * @return True if ok; false if initialization failed
55 * The plugin manager calls the init() function for every eVaf module during the initialization
56 * of the application. Modules implementing the iPlugin interface shall allocate and initialize
57 * all the required resources in the init() function.
59 * Modules can assume that the init() function is always called once after loading the module
60 * and creating the interface object. Every init() function call is followed by a done()
61 * function call during the finalization of the application. Modules can be initialized
62 * multiple times without destroying the interface object, but init() function calls are
63 * always followed by a done() function call.
65 * When the init() function returns true, then the initialization of the module shall be completed
66 * and all the interfaces and other resources published by the module safe to use.
69 virtual bool init(const QString
& args
) = 0;
72 * Finalizes the module.
74 * The plugin manager calls the done() function for every eVaf module during the finalization
75 * of the application. Modules implementing the iPlugin interface shall finalize and release
76 * all the resources in the done() function.
78 virtual void done() = 0;
82 * @return True if the module is ready.
84 * The ready flag indicates that the module is initialized and all the published interfaces
85 * and resources safe to use.
87 virtual bool isReady() const = 0;
91 } // namespace eVaf::Plugins