farsaplugin.h
1 /********************************************************************************
2  * FARSA Experiments Library *
3  * Copyright (C) 2007-2012 *
4  * Gianluca Massera <emmegian@yahoo.it> *
5  * Stefano Nolfi <stefano.nolfi@istc.cnr.it> *
6  * Tomassino Ferrauto <tomassino.ferrauto@istc.cnr.it> *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the Free Software *
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
21  ********************************************************************************/
22 
23 #ifndef FARSAPLUGIN_H
24 #define FARSAPLUGIN_H
25 
26 #include "experimentsconfig.h"
27 #include <QObject>
28 #include <QMap>
29 #include <QMetaObject>
30 #include <QString>
31 #include <QStringList>
32 
33 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
34  #include <QtPlugin>
35 #endif
36 
37 // Tomassino: I think we should change the IID to something like:
38 // "it.cnr.istc.laral.farsa.plugin/1.0"
39 #define FarsaPlugin_IID "com.farsa.plugin/1.0"
40 
47 class FARSA_EXPERIMENTS_TEMPLATE FarsaPlugin {
48 public:
50  virtual ~FarsaPlugin() {
51  /* empty - nothing to do */
52  };
54  virtual void registerTypesOnFactory() = 0;
56  virtual QStringList getDependencies() { return QStringList(); }
57 };
58 
59 Q_DECLARE_INTERFACE( FarsaPlugin, FarsaPlugin_IID );
60 
61 // Declaring some helper macros
62 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
63  #define FARSA_EXPORT_PLUGIN(...)
64  #define FARSA_PLUGIN_METADATA(...) Q_PLUGIN_METADATA(__VA_ARGS__)
65 #else
66  #define FARSA_EXPORT_PLUGIN(PluginName, ClassName) Q_EXPORT_PLUGIN2(PluginName, ClassName);
67  #define FARSA_PLUGIN_METADATA(...)
68 #endif
69 
70 // More macros for the new structure of plugins
71 #ifdef WIN32
72  #define FARSA_PLUGIN_API __declspec(dllexport)
73  #define FARSA_PLUGIN_TEMPLATE __declspec(dllexport)
74  #define FARSA_PLUGIN_INTERNAL
75 
76  #define FARSA_PLUGIN_API_IMPORT __declspec(dllimport)
77  #define FARSA_PLUGIN_TEMPLATE_IMPORT
78  #define FARSA_PLUGIN_INTERNAL_IMPORT
79 #else
80  #define FARSA_PLUGIN_API
81  #define FARSA_PLUGIN_TEMPLATE
82  #define FARSA_PLUGIN_INTERNAL __attribute__ ((visibility ("hidden")))
83 
84  #define FARSA_PLUGIN_API_IMPORT
85  #define FARSA_PLUGIN_TEMPLATE_IMPORT
86  #define FARSA_PLUGIN_INTERNAL_IMPORT __attribute__ ((visibility ("hidden")))
87 #endif
88 
89 // The next macros are empty because they are only needed by the farsapluginhelper preprocessor
90 #define FARSA_REGISTER_CLASS(...)
91 #define FARSA_PRE_REGISTRATION_FUNCTION(...)
92 #define FARSA_POST_REGISTRATION_FUNCTION(...)
93 
94 #endif
the interface for implement a plugin for adding new feature to FARSA
Definition: farsaplugin.h:47
This file contains the common type defitions used on the whole framework.
virtual ~FarsaPlugin()
Virtual Destructor.
Definition: farsaplugin.h:50
virtual QStringList getDependencies()
returns the list of dependencies
Definition: farsaplugin.h:56