ctkPlugins_p.h

Go to the documentation of this file.
00001 /*=============================================================================
00002 
00003   Library: CTK
00004 
00005   Copyright (c) 2010 German Cancer Research Center,
00006     Division of Medical and Biological Informatics
00007 
00008   Licensed under the Apache License, Version 2.0 (the "License");
00009   you may not use this file except in compliance with the License.
00010   You may obtain a copy of the License at
00011 
00012     http://www.apache.org/licenses/LICENSE-2.0
00013 
00014   Unless required by applicable law or agreed to in writing, software
00015   distributed under the License is distributed on an "AS IS" BASIS,
00016   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00017   See the License for the specific language governing permissions and
00018   limitations under the License.
00019 
00020 =============================================================================*/
00021 
00022 #ifndef CTKPLUGINS_H
00023 #define CTKPLUGINS_H
00024 
00025 #include <QUrl>
00026 #include <QHash>
00027 #include <QReadWriteLock>
00028 
00029 
00030 
00031   // CTK class forward declarations
00032   class ctkPlugin;
00033   class ctkPluginFrameworkContext;
00034   class ctkVersion;
00035   class ctkVersionRange;
00036 
00042   class ctkPlugins {
00043 
00044   private:
00045 
00050     QHash<QString, ctkPlugin*> plugins;
00051 
00055     ctkPluginFrameworkContext* fwCtx;
00056 
00060     mutable QReadWriteLock pluginsLock;
00061 
00062 
00063   public:
00064 
00068     ctkPlugins(ctkPluginFrameworkContext* fw);
00069 
00070 
00071     void clear();
00072 
00073 
00079     ctkPlugin* install(const QUrl& location, QIODevice* in);
00080 
00081 
00087     void remove(const QUrl& location);
00088 
00089 
00097     ctkPlugin* getPlugin(int id) const;
00098 
00099 
00107     ctkPlugin* getPlugin(const QString& location) const;
00108 
00109 
00117     ctkPlugin* getPlugin(const QString& name, const ctkVersion& version) const;
00118 
00119 
00125     QList<ctkPlugin*> getPlugins() const;
00126 
00127 
00134     QList<ctkPlugin*> getPlugins(const QString& name) const;
00135 
00136 
00145     QList<ctkPlugin*> getPlugins(const QString& name, const ctkVersionRange& range) const;
00146 
00147 
00153     QList<ctkPlugin*> getActivePlugins() const;
00154 
00155 
00163     void load();
00164 
00165 
00171     void startPlugins(const QList<ctkPlugin*>& slist) const;
00172 
00173 
00174   };
00175 
00176 
00177 #endif // CTKPLUGINS_H
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines