MNE-CPP  beta 1.0
pluginmanager.h
Go to the documentation of this file.
1 //=============================================================================================================
36 #ifndef PLUGINMANAGER_H
37 #define PLUGINMANAGER_H
38 
39 //*************************************************************************************************************
40 //=============================================================================================================
41 // INCLUDES
42 //=============================================================================================================
43 
44 #include "../mne_x_global.h"
45 
46 
47 //*************************************************************************************************************
48 //=============================================================================================================
49 // QT INCLUDES
50 //=============================================================================================================
51 
52 #include <QVector>
53 #include <QPluginLoader>
54 
55 
56 //*************************************************************************************************************
57 //=============================================================================================================
58 // DEFINE NAMESPACE MNEX
59 //=============================================================================================================
60 
61 namespace MNEX
62 {
63 
64 
65 //*************************************************************************************************************
66 //=============================================================================================================
67 // FORWARD DECLARATIONS
68 //=============================================================================================================
69 
70 class IPlugin;
71 class ISensor;
72 class IAlgorithm;
73 class IIO;
74 
75 
76 //=============================================================================================================
82 class MNE_X_SHARED_EXPORT PluginManager : public QPluginLoader
83 {
84  Q_OBJECT
85 
86  friend class MainWindow;
87  friend class PluginDockWidget;
88 
89 public:
90  typedef QSharedPointer<PluginManager> SPtr;
91  typedef QSharedPointer<const PluginManager> ConstSPtr;
93  //=========================================================================================================
99  PluginManager(QObject* parent = 0);
100 
101  //=========================================================================================================
105  virtual ~PluginManager();
106 
107  //=========================================================================================================
113  void loadPlugins(const QString& dir);
114 
115  //=========================================================================================================
122  int findByName(const QString& name);
123 
124  //=========================================================================================================
130  inline const QVector<IPlugin*>& getPlugins();
131 
132  //=========================================================================================================
138  inline const QVector<ISensor*>& getSensorPlugins();
139 
140  //=========================================================================================================
146  inline const QVector<IAlgorithm*>& getAlgorithmPlugins();
147 
148  //=========================================================================================================
154  inline const QVector<IIO*>& getIOPlugins();
155 
156 
157 private:
158  QVector<IPlugin*> m_qVecPlugins;
160  QVector<ISensor*> m_qVecSensorPlugins;
161  QVector<IAlgorithm*> m_qVecAlgorithmPlugins;
162  QVector<IIO*> m_qVecIOPlugins;
164 };
165 
166 
167 //*************************************************************************************************************
168 //=============================================================================================================
169 // INLINE DEFINITIONS
170 //=============================================================================================================
171 
172 inline const QVector<IPlugin*>& PluginManager::getPlugins()
173 {
174  return m_qVecPlugins;
175 }
176 
177 
178 //*************************************************************************************************************
179 
180 inline const QVector<ISensor*>& PluginManager::getSensorPlugins()
181 {
182  return m_qVecSensorPlugins;
183 }
184 
185 
186 //*************************************************************************************************************
187 
188 inline const QVector<IAlgorithm*>& PluginManager::getAlgorithmPlugins()
189 {
190  return m_qVecAlgorithmPlugins;
191 }
192 
193 
194 //*************************************************************************************************************
195 
196 inline const QVector<IIO*>& PluginManager::getIOPlugins()
197 {
198  return m_qVecIOPlugins;
199 }
200 
201 } // NAMESPACE
202 
203 #endif // PLUGINMANAGER_H
const QVector< IAlgorithm * > & getAlgorithmPlugins()
const QVector< IPlugin * > & getPlugins()
The PluginManager class provides a dynamic plugin loader. As well as the handling of the loaded plugi...
Definition: pluginmanager.h:82
QSharedPointer< const PluginManager > ConstSPtr
Definition: pluginmanager.h:91
QSharedPointer< PluginManager > SPtr
Definition: pluginmanager.h:90
#define MNE_X_SHARED_EXPORT
Definition: mne_x_global.h:55
Definition: arrow.h:75
The MainWindow class provides the main application user interface.
Definition: mainwindow.h:119
const QVector< IIO * > & getIOPlugins()
const QVector< ISensor * > & getSensorPlugins()