ctkServices_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 
00023 #ifndef CTKSERVICES_P_H
00024 #define CTKSERVICES_P_H
00025 
00026 #include <QHash>
00027 #include <QObject>
00028 #include <QMutex>
00029 #include <QStringList>
00030 #include <QServiceManager>
00031 
00032 #include "ctkServiceRegistration.h"
00033 #include "ctkPluginPrivate_p.h"
00034 
00035 
00040 class ctkServices {
00041 
00042 public:
00043 
00044   mutable QMutex mutex;
00045 
00046   QtMobility::QServiceManager qServiceManager;
00047 
00057   static ServiceProperties createServiceProperties(const ServiceProperties& in,
00058                                  const QStringList& classes = QStringList(),
00059                                  long sid = -1);
00060 
00066   QHash<ctkServiceRegistration*, QStringList> services;
00067 
00073   QHash<QString, QList<ctkServiceRegistration*> > classServices;
00074 
00075 
00076   ctkPluginFrameworkContext* framework;
00077 
00078   ctkServices(ctkPluginFrameworkContext* fwCtx);
00079 
00080   ~ctkServices();
00081 
00082   void clear();
00083 
00099   ctkServiceRegistration* registerService(ctkPluginPrivate* plugin,
00100                                const QStringList& classes,
00101                                QObject* service,
00102                                const ServiceProperties& properties);
00103 
00104   void registerService(ctkPluginPrivate* plugin, QByteArray serviceDescription);
00105 
00106 
00114   void updateServiceRegistrationOrder(ctkServiceRegistration* sr,
00115                                       const QStringList& classes);
00116 
00117 
00125   bool checkServiceClass(QObject* service, const QString& cls) const;
00126 
00127 
00135   QList<ctkServiceRegistration*> get(const QString& clazz) const;
00136 
00137 
00145   ctkServiceReference* get(ctkPluginPrivate* plugin, const QString& clazz) const;
00146 
00147 
00157   QList<ctkServiceReference*> get(const QString& clazz, const QString& filter) const;
00158 
00159 
00165   void removeServiceRegistration(ctkServiceRegistration* sr) ;
00166 
00167 
00174   QList<ctkServiceRegistration*> getRegisteredByPlugin(ctkPluginPrivate* p) const;
00175 
00176 
00183   QList<ctkServiceRegistration*> getUsedByPlugin(ctkPlugin* p) const;
00184 
00185   QString getQServiceManagerErrorString(QtMobility::QServiceManager::Error error);
00186 
00187 };
00188 
00189 
00190 
00191 #endif // CTKSERVICES_P_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated on 21 May 2010 for CTK by  doxygen 1.6.1