frameNumber
69 | * or NULL
if there is no corresponding stack frame.
70 | */
71 | void* returnAddress(unsigned frameNumber) const;
72 |
73 | /**
74 | * @brief Get a textual representation for a given stack frame.
75 | * @param frameNumber The stack frame number.
76 | * @return A string describing the stack frame with number frameNumber
77 | * or a null QString if there is no corresponding stack frame.
78 | */
79 | QString stackFrame(unsigned frameNumber) const;
80 |
81 | /**
82 | * @brief Provides programmatic access to the stack trace information.
83 | *
84 | * The zeroth element of the returned list (assuming the list's size is non-zero)
85 | * represents the top of the stack, which is the last method invocation in the sequence.
86 | *
87 | * @return A list of string representations for each stack frame.
88 | */
89 | QList35 | * Clients may implement this interface. 36 | *
37 | */ 38 | struct CTK_PLUGINFW_EXPORT ctkApplicationRunnable 39 | { 40 | 41 | virtual ~ctkApplicationRunnable(); 42 | 43 | /** 44 | * Executes the block of code encapsulated by this runnable in the context of 45 | * the given object and returns the result. The result may be an invalid QVariant. 46 | * 47 | * @param context the context for evaluating the runnable 48 | * @return the result of evaluating the runnable in the given context 49 | * @throws std::exception if there is a problem running this runnable 50 | */ 51 | virtual QVariant run(const QVariant& context) = 0; 52 | 53 | /** 54 | * Forces this runnable to stop. 55 | */ 56 | virtual void stop() = 0; 57 | 58 | }; 59 | 60 | #endif // CTKAPPLICATIONRUNNABLE_H 61 | -------------------------------------------------------------------------------- /includes/pluginFramework/ctkBasicLocation_p.h: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | 3 | Library: CTK 4 | 5 | Copyright (c) German Cancer Research Center, 6 | Division of Medical and Biological Informatics 7 | 8 | Licensed under the Apache License, Version 2.0 (the "License"); 9 | you may not use this file except in compliance with the License. 10 | You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, software 15 | distributed under the License is distributed on an "AS IS" BASIS, 16 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | See the License for the specific language governing permissions and 18 | limitations under the License. 19 | 20 | =============================================================================*/ 21 | 22 | #ifndef CTKBASICLOCATION_H 23 | #define CTKBASICLOCATION_H 24 | 25 | #include32 | * Clients may not extend this class. 33 | *
34 | * @noextend This class is not intended to be subclassed by clients. 35 | */ 36 | class ctkLocationManager 37 | { 38 | 39 | public: 40 | 41 | static const QString READ_ONLY_AREA_SUFFIX; // = ".readOnly"; 42 | 43 | // configuration area file/dir names 44 | static const QString CONFIG_FILE; // = "config.ini"; 45 | static const QString CTK_PROPERTIES; // = "ctk.properties"; 46 | 47 | /** 48 | * Initializes the QFileInfo objects for the ctkLocationManager. 49 | */ 50 | static void initializeLocations(); 51 | 52 | /** 53 | * Returns the user ctkLocation object 54 | * @return the user ctkLocation object 55 | */ 56 | static ctkBasicLocation* getUserLocation(); 57 | 58 | /** 59 | * Returns the configuration ctkLocation object 60 | * @return the configuration ctkLocation object 61 | */ 62 | static ctkBasicLocation* getConfigurationLocation(); 63 | 64 | /** 65 | * Returns the install ctkLocation object 66 | * @return the install ctkLocation object 67 | */ 68 | static ctkBasicLocation* getInstallLocation(); 69 | 70 | /** 71 | * Returns the instance ctkLocation object 72 | * @return the instance ctkLocation object 73 | */ 74 | static ctkBasicLocation* getInstanceLocation(); 75 | 76 | static ctkBasicLocation* getCTKHomeLocation(); 77 | 78 | }; 79 | 80 | #endif // CTKLOCATIONMANAGER_H 81 | -------------------------------------------------------------------------------- /includes/pluginFramework/ctkPluginArchive.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | 3 | Library: CTK 4 | 5 | Copyright (c) German Cancer Research Center, 6 | Division of Medical and Biological Informatics 7 | 8 | Licensed under the Apache License, Version 2.0 (the "License"); 9 | you may not use this file except in compliance with the License. 10 | You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, software 15 | distributed under the License is distributed on an "AS IS" BASIS, 16 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | See the License for the specific language governing permissions and 18 | limitations under the License. 19 | 20 | =============================================================================*/ 21 | 22 | #include "ctkPluginArchive_p.h" 23 | 24 | #include "ctkPluginException.h" 25 | #include "ctkPluginStorage_p.h" 26 | 27 | #include%ctkPluginFrameworkFactory
instance.
48 | *
49 | * 50 | * The ctkProperties map is used to configure the ctkPluginFramework. The 51 | * plugin framework instance created with #getFramework() must interpret 52 | * the following properties: 53 | * 54 | *
55 | *
ctkPlugin::getPluginLocalization()
.
44 | *
45 | * @see ctkPlugin::getPluginLocalization()
46 | */
47 | class CTK_PLUGINFW_EXPORT ctkPluginLocalization
48 | {
49 | public:
50 |
51 | /**
52 | * Creates a default ctkPluginLocalization instance, using
53 | * the default locale.
54 | *
55 | * Note that getLocalized() will always return a null QString
56 | * for a default constructed ctkPluginLocalization object.
57 | * Use ctkPlugin::getPluginLocalization()
to create
58 | * a valid instance.
59 | */
60 | ctkPluginLocalization();
61 |
62 | ctkPluginLocalization(const ctkPluginLocalization& pl);
63 | ~ctkPluginLocalization();
64 |
65 | ctkPluginLocalization& operator=(const ctkPluginLocalization& other);
66 |
67 | /**
68 | * Translate str
to a specific locale, using the
69 | * specified context
.
70 | *
71 | * @return The translation or a null QString, if no translation
72 | * was found.
73 | */
74 | QString getLocalized(const QString& context, const QString& str) const;
75 |
76 | /**
77 | * Get the locale for which this ctkPluginLocalization
78 | * object was constructed.
79 | *
80 | * @return The locale for this object.
81 | */
82 | QLocale getLocale() const;
83 |
84 | private:
85 |
86 | friend class ctkPlugin;
87 |
88 | ctkPluginLocalization(const QString& msgFileName,
89 | const QLocale& locale, const QSharedPointerctkPluginTracker
.
58 | */
59 | ctkPluginContext* const context;
60 |
61 | /**
62 | * The ctkPluginTrackerCustomizer
object for this tracker.
63 | */
64 | ctkPluginTrackerCustomizerctkPlugin
object -> customized Object and
68 | * plugin listener slot.
69 | */
70 | QSharedPointerctkPluginTracker
46 | * class. This method must NOT be synchronized to avoid deadlock
47 | * potential.
48 | *
49 | * @param event ctkPluginEvent
object from the framework.
50 | */
51 | virtual void pluginChanged(const ctkPluginEvent& event) = 0;
52 |
53 | };
54 |
55 | #endif // CTKTRACKEDPLUGINLISTENER_P_H
56 |
--------------------------------------------------------------------------------
/includes/pluginFramework/ctkTrackedServiceListener_p.h:
--------------------------------------------------------------------------------
1 | /*=============================================================================
2 |
3 | Library: CTK
4 |
5 | Copyright (c) German Cancer Research Center,
6 | Division of Medical and Biological Informatics
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License");
9 | you may not use this file except in compliance with the License.
10 | You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing, software
15 | distributed under the License is distributed on an "AS IS" BASIS,
16 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | See the License for the specific language governing permissions and
18 | limitations under the License.
19 |
20 | =============================================================================*/
21 |
22 |
23 | #ifndef CTKTRACKEDSERVICELISTENER_P_H
24 | #define CTKTRACKEDSERVICELISTENER_P_H
25 |
26 | #include ctkServiceTracker
class. This method must NOT be
47 | * synchronized to avoid deadlock potential.
48 | *
49 | * @param event ctkServiceEvent
object from the framework.
50 | */
51 | virtual void serviceChanged(const ctkServiceEvent& event) = 0;
52 |
53 | };
54 |
55 | #endif // CTKTRACKEDSERVICELISTENER_P_H
56 |
--------------------------------------------------------------------------------
/includes/pluginFramework/ctkVersionRange_p.h:
--------------------------------------------------------------------------------
1 | /*=============================================================================
2 |
3 | Library: CTK
4 |
5 | Copyright (c) German Cancer Research Center,
6 | Division of Medical and Biological Informatics
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License");
9 | you may not use this file except in compliance with the License.
10 | You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing, software
15 | distributed under the License is distributed on an "AS IS" BASIS,
16 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | See the License for the specific language governing permissions and
18 | limitations under the License.
19 |
20 | =============================================================================*/
21 |
22 | #ifndef CTKVERSIONRANGE_H
23 | #define CTKVERSIONRANGE_H
24 |
25 | #include "ctkVersion.h"
26 |
27 |
28 | /**
29 | * \ingroup PluginFramework
30 | *
31 | * Class representing CTK version ranges.
32 | */
33 | class ctkVersionRange
34 | {
35 |
36 | private:
37 |
38 | ctkVersion low;
39 | ctkVersion high;
40 | bool lowIncluded;
41 | bool highIncluded;
42 |
43 | public:
44 |
45 | /**
46 | * The empty version range "[0.0.0,inf)".
47 | */
48 | static ctkVersionRange defaultVersionRange();
49 |
50 | /**
51 | * Construct a ctkVersionRange object.
52 | * Format for a range:
53 | * ( "(" | "[" ) LOW_VERSION "," HIGH_VERSION ( ")" | "]" )
54 | * Format for at least a version:
55 | * VERSION
56 | *
57 | * @param vr Input string.
58 | */
59 | ctkVersionRange(const QString& vr);
60 |
61 |
62 | /**
63 | * Construct the default ctkVersionRange object.
64 | *
65 | */
66 | ctkVersionRange();
67 |
68 | ~ctkVersionRange();
69 |
70 |
71 | bool isSpecified() const;
72 |
73 |
74 | /**
75 | * Check if specified version is within our range.
76 | *
77 | * @param ver ctkVersion to compare to.
78 | * @return Return true if within range, otherwise false.
79 | */
80 | bool withinRange(const ctkVersion& ver) const;
81 |
82 |
83 | /**
84 | * Check if objects range is within another ctkVersionRange.
85 | *
86 | * @param range ctkVersionRange to compare to.
87 | * @return Return true if within range, otherwise false.
88 | */
89 | bool withinRange(const ctkVersionRange& range) const;
90 |
91 |
92 | /**
93 | * Compare object to another ctkVersionRange. VersionRanges are compared on the
94 | * lower bound.
95 | *
96 | * @param obj ctkVersionRange to compare to.
97 | * @return Return 0 if equals, negative if this object is less than obj
98 | * and positive if this object is larger then obj.
99 | * @exception ClassCastException if object is not a ctkVersionRange object.
100 | */
101 | int compare(const ctkVersionRange& obj) const;
102 |
103 |
104 | /**
105 | * String with version number. If version is not specified return
106 | * an empty string.
107 | *
108 | * @return QString.
109 | */
110 | QString toString() const;
111 |
112 |
113 | /**
114 | * Check if object is equal to this object.
115 | *
116 | * @param obj Package entry to compare to.
117 | * @return true if equal, otherwise false.
118 | */
119 | bool operator==(const ctkVersionRange& r) const;
120 |
121 | };
122 |
123 |
124 | #endif // CTKVERSIONRANGE_H
125 |
--------------------------------------------------------------------------------
/includes/pluginFramework/service/application/ctkApplicationDescriptor.cpp:
--------------------------------------------------------------------------------
1 | /*=============================================================================
2 |
3 | Library: CTK
4 |
5 | Copyright (c) German Cancer Research Center,
6 | Division of Medical and Biological Informatics
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License");
9 | you may not use this file except in compliance with the License.
10 | You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing, software
15 | distributed under the License is distributed on an "AS IS" BASIS,
16 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | See the License for the specific language governing permissions and
18 | limitations under the License.
19 |
20 | =============================================================================*/
21 |
22 | #include "ctkApplicationDescriptor.h"
23 |
24 | #include 35 | * This class is for use by platform-related plug-ins which implement application containers. 36 | * Clients outside of the base platform should not reference or subclass this class. 37 | *
38 | */ 39 | struct ctkApplicationLauncher 40 | { 41 | virtual ~ctkApplicationLauncher() {} 42 | 43 | /** 44 | * Launches the specified runnable using the main thread. 45 | * @param runnable a ParameterizedRunnalbe to run on the main thread. 46 | * @param context the context to launch the runnable with 47 | */ 48 | virtual void launch(ctkApplicationRunnable* app, const QVariant& applicationContext) = 0; 49 | 50 | /** 51 | * Forces the current runnable which is running to be stopped. 52 | * This method will return after the currently running ctkApplicationRunnable 53 | * has completely stopped. 54 | *
55 | * After this method returns this ctkApplicationLauncher will no longer allow
56 | * applications to be launched.
57 | */
58 | virtual void shutdown() = 0;
59 |
60 | };
61 |
62 | Q_DECLARE_INTERFACE(ctkApplicationLauncher, "org.commontk.service.application.ApplicationLauncher")
63 |
64 | #endif // CTKAPPLICATIONLAUNCHER_H
65 |
--------------------------------------------------------------------------------
/includes/pluginFramework/service/cm/ctkConfiguration.cpp:
--------------------------------------------------------------------------------
1 | /*=============================================================================
2 |
3 | Library: CTK
4 |
5 | Copyright (c) German Cancer Research Center,
6 | Division of Medical and Biological Informatics
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License");
9 | you may not use this file except in compliance with the License.
10 | You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing, software
15 | distributed under the License is distributed on an "AS IS" BASIS,
16 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | See the License for the specific language governing permissions and
18 | limitations under the License.
19 |
20 | =============================================================================*/
21 |
22 |
23 | #include "ctkConfiguration.h"
24 |
25 | //----------------------------------------------------------------------------
26 | ctkConfiguration::~ctkConfiguration()
27 | {
28 | }
29 |
30 | //----------------------------------------------------------------------------
31 | bool ctkConfiguration::operator==(const ctkConfiguration& other) const
32 | {
33 | return this->getPid() == other.getPid();
34 | }
35 |
36 | //----------------------------------------------------------------------------
37 | uint qHash(ctkConfigurationPtr configuration)
38 | {
39 | return qHash(configuration->getPid());
40 | }
41 |
42 | //----------------------------------------------------------------------------
43 | bool operator==(const ctkConfigurationPtr& c1, const ctkConfigurationPtr c2)
44 | {
45 | return (*c1.data()) == (*c2.data());
46 | }
47 |
--------------------------------------------------------------------------------
/includes/pluginFramework/service/cm/ctkConfigurationAdmin.cpp:
--------------------------------------------------------------------------------
1 | /*=============================================================================
2 |
3 | Library: CTK
4 |
5 | Copyright (c) 2010 German Cancer Research Center,
6 | Division of Medical and Biological Informatics
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License");
9 | you may not use this file except in compliance with the License.
10 | You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing, software
15 | distributed under the License is distributed on an "AS IS" BASIS,
16 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | See the License for the specific language governing permissions and
18 | limitations under the License.
19 |
20 | =============================================================================*/
21 |
22 |
23 | #include "ctkConfigurationAdmin.h"
24 |
25 | const QString ctkConfigurationAdmin::SERVICE_FACTORYPID = "service.factoryPid";
26 | const QString ctkConfigurationAdmin::SERVICE_PLUGINLOCATION = "service.pluginLocation";
27 |
28 |
--------------------------------------------------------------------------------
/includes/pluginFramework/service/cm/ctkConfigurationException.h:
--------------------------------------------------------------------------------
1 | /*=============================================================================
2 |
3 | Library: CTK
4 |
5 | Copyright (c) German Cancer Research Center,
6 | Division of Medical and Biological Informatics
7 |
8 | Licensed under the Apache License, Version 2.0 (the "License");
9 | you may not use this file except in compliance with the License.
10 | You may obtain a copy of the License at
11 |
12 | http://www.apache.org/licenses/LICENSE-2.0
13 |
14 | Unless required by applicable law or agreed to in writing, software
15 | distributed under the License is distributed on an "AS IS" BASIS,
16 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | See the License for the specific language governing permissions and
18 | limitations under the License.
19 |
20 | =============================================================================*/
21 |
22 |
23 | #ifndef CTKCONFIGURATIONEXCEPTION_H
24 | #define CTKCONFIGURATIONEXCEPTION_H
25 |
26 | #include "ctkException.h"
27 |
28 | #include