ctkPlugin.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 CTKPLUGIN_H
00023 #define CTKPLUGIN_H
00024 
00025 #include "ctkPluginContext.h"
00026 
00027 #include "ctkVersion.h"
00028 
00029 class ctkPluginArchive;
00030 class ctkPluginFrameworkContext;
00031 class ctkPluginPrivate;
00032 
00074 class CTK_PLUGINFW_EXPORT ctkPlugin {
00075 
00076   Q_DECLARE_PRIVATE(ctkPlugin)
00077 
00078 public:
00079 
00080   enum State {
00090     UNINSTALLED,
00091 
00104     INSTALLED,
00105 
00122     RESOLVED,
00123 
00140     STARTING,
00141 
00152     STOPPING,
00153 
00161     ACTIVE
00162   };
00163 
00169   Q_DECLARE_FLAGS(States, State)
00170 
00171   enum StartOption {
00172 
00185     START_TRANSIENT,
00186 
00200     START_ACTIVATION_POLICY
00201 
00202   };
00203 
00209   Q_DECLARE_FLAGS(StartOptions, StartOption)
00210 
00211   enum StopOption {
00224     STOP_TRANSIENT
00225   };
00226 
00232   Q_DECLARE_FLAGS(StopOptions, StopOption)
00233 
00234   virtual ~ctkPlugin();
00235 
00246   State getState() const;
00247 
00351   virtual void start(const StartOptions& options = START_ACTIVATION_POLICY);
00352 
00425   virtual void stop(const StopOptions& options = 0);
00426 
00443   ctkPluginContext* getPluginContext() const;
00444 
00467   long getPluginId() const;
00468 
00484   QString getLocation() const;
00485 
00513   virtual QHash<QString, QString> getHeaders();
00514 
00529   QString getSymbolicName() const;
00530 
00552   virtual QStringList getResourceList(const QString& path) const;
00553 
00570   virtual QByteArray getResource(const QString& path) const;
00571 
00583   ctkVersion getVersion() const;
00584 
00585 protected:
00586 
00587   friend class ctkPluginFramework;
00588   friend class ctkPluginFrameworkContext;
00589   friend class ctkPlugins;
00590   friend class ctkServiceReferencePrivate;
00591 
00592   ctkPluginPrivate * const d_ptr;
00593 
00594   ctkPlugin(ctkPluginFrameworkContext* fw, ctkPluginArchive* ba);
00595   ctkPlugin(ctkPluginPrivate& dd);
00596 };
00597 
00598 
00599 Q_DECLARE_OPERATORS_FOR_FLAGS(ctkPlugin::States)
00600 
00601 #endif // CTKPLUGIN_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