|
1 | | -/*============================================================================== |
2 | | -
|
3 | | - Library: CTK |
4 | | -
|
5 | | - Copyright (c) Pixel Medical Inc. 2021 |
6 | | -
|
7 | | - Licensed under the Apache License, Version 2.0 (the "License"); |
8 | | - you may not use this file except in compliance with the License. |
9 | | - You may obtain a copy of the License at |
10 | | -
|
11 | | - http://www.apache.org/licenses/LICENSE-2.0.txt |
12 | | -
|
13 | | - Unless required by applicable law or agreed to in writing, software |
14 | | - distributed under the License is distributed on an "AS IS" BASIS, |
15 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | | - See the License for the specific language governing permissions and |
17 | | - limitations under the License. |
18 | | -
|
19 | | - ==============================================================================*/ |
20 | | - |
21 | | -#ifndef __ctkDICOMDisplayedFieldGeneratorRuleFactory_h_ |
22 | | -#define __ctkDICOMDisplayedFieldGeneratorRuleFactory_h_ |
23 | | - |
24 | | -#include "ctkDICOMCoreExport.h" |
25 | | - |
26 | | -// Qt includes |
27 | | -#include <QObject> |
28 | | -#include <QList> |
29 | | - |
30 | | -class ctkDICOMDatabase; |
31 | | -class ctkDICOMDisplayedFieldGeneratorAbstractRule; |
32 | | -class ctkDICOMDisplayedFieldGeneratorRuleFactoryCleanup; |
33 | | - |
34 | | -/// \ingroup SlicerRt_QtModules_Segmentations |
35 | | -/// \class ctkDICOMDisplayedFieldGeneratorRuleFactory |
36 | | -/// \brief Singleton class managing displayed field generator rules |
37 | | -class CTK_DICOM_CORE_EXPORT ctkDICOMDisplayedFieldGeneratorRuleFactory : public QObject |
38 | | -{ |
39 | | - Q_OBJECT |
40 | | - |
41 | | -public: |
42 | | - /// Instance getter for the singleton class |
43 | | - /// \return Instance object |
44 | | - Q_INVOKABLE static ctkDICOMDisplayedFieldGeneratorRuleFactory* instance(); |
45 | | - |
46 | | -public: |
47 | | - /// Register a displayed field generator rule. The factory takes ownership of the object (caller must not delete it). |
48 | | - /// \return True if rule is registered successfully, false otherwise |
49 | | - Q_INVOKABLE bool registerDisplayedFieldGeneratorRule(ctkDICOMDisplayedFieldGeneratorAbstractRule* rule); |
50 | | - |
51 | | - /// Return the list of displayed field generator rules registered. |
52 | | - Q_INVOKABLE const QList<ctkDICOMDisplayedFieldGeneratorAbstractRule*>& displayedFieldGeneratorRules() |
53 | | - { return this->DisplayedFieldGeneratorRules; } |
54 | | - |
55 | | - /// Return a list with the copies of displayed field generator rules that are enabled according to the database. |
56 | | - /// \param database DICOM database in which the DisplayedFieldGeneratorRules table is used to decide if a rule is |
57 | | - /// enabled or not. If the table itself or an entry with a particular rule name is missing then the rule is treated as enabled. |
58 | | - Q_INVOKABLE QList<ctkDICOMDisplayedFieldGeneratorAbstractRule*> copyEnabledDisplayedFieldGeneratorRules(ctkDICOMDatabase* database); |
59 | | - |
60 | | -signals: |
61 | | - void displayedFieldGeneratorRuleRegistered(); |
62 | | - void displayedFieldGeneratorRuleUnregistered(); |
63 | | - |
64 | | -protected: |
65 | | - QList<ctkDICOMDisplayedFieldGeneratorAbstractRule*> DisplayedFieldGeneratorRules; |
66 | | - |
67 | | -private: |
68 | | - /// Allows cleanup of the singleton at application exit |
69 | | - static void cleanup(); |
70 | | - |
71 | | -private: |
72 | | - ctkDICOMDisplayedFieldGeneratorRuleFactory(QObject* parent=nullptr); |
73 | | - ~ctkDICOMDisplayedFieldGeneratorRuleFactory() override; |
74 | | - |
75 | | - Q_DISABLE_COPY(ctkDICOMDisplayedFieldGeneratorRuleFactory); |
76 | | - friend class ctkDICOMDisplayedFieldGeneratorRuleFactoryCleanup; |
77 | | - friend class PythonQtWrapper_ctkDICOMDisplayedFieldGeneratorRuleFactory; // Allow Python wrapping without enabling direct instantiation |
78 | | - |
79 | | -private: |
80 | | - /// Instance of the singleton |
81 | | - static ctkDICOMDisplayedFieldGeneratorRuleFactory* Instance; |
82 | | -}; |
83 | | - |
84 | | -#endif // __ctkDICOMDisplayedFieldGeneratorRuleFactory_h_ |
| 1 | +/*============================================================================== |
| 2 | +
|
| 3 | + Library: CTK |
| 4 | +
|
| 5 | + Copyright (c) Pixel Medical Inc. 2021 |
| 6 | +
|
| 7 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | + you may not use this file except in compliance with the License. |
| 9 | + You may obtain a copy of the License at |
| 10 | +
|
| 11 | + http://www.apache.org/licenses/LICENSE-2.0.txt |
| 12 | +
|
| 13 | + Unless required by applicable law or agreed to in writing, software |
| 14 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | + See the License for the specific language governing permissions and |
| 17 | + limitations under the License. |
| 18 | +
|
| 19 | + ==============================================================================*/ |
| 20 | + |
| 21 | +#ifndef __ctkDICOMDisplayedFieldGeneratorRuleFactory_h_ |
| 22 | +#define __ctkDICOMDisplayedFieldGeneratorRuleFactory_h_ |
| 23 | + |
| 24 | +#include "ctkDICOMCoreExport.h" |
| 25 | + |
| 26 | +// Qt includes |
| 27 | +#include <QObject> |
| 28 | +#include <QList> |
| 29 | + |
| 30 | +class ctkDICOMDatabase; |
| 31 | +class ctkDICOMDisplayedFieldGeneratorAbstractRule; |
| 32 | +class ctkDICOMDisplayedFieldGeneratorRuleFactoryCleanup; |
| 33 | + |
| 34 | +/// \ingroup SlicerRt_QtModules_Segmentations |
| 35 | +/// \class ctkDICOMDisplayedFieldGeneratorRuleFactory |
| 36 | +/// \brief Singleton class managing displayed field generator rules |
| 37 | +class CTK_DICOM_CORE_EXPORT ctkDICOMDisplayedFieldGeneratorRuleFactory : public QObject |
| 38 | +{ |
| 39 | + Q_OBJECT |
| 40 | + |
| 41 | +public: |
| 42 | + /// Instance getter for the singleton class |
| 43 | + /// \return Instance object |
| 44 | + Q_INVOKABLE static ctkDICOMDisplayedFieldGeneratorRuleFactory* instance(); |
| 45 | + |
| 46 | +public: |
| 47 | + /// Register a displayed field generator rule. The factory takes ownership of the object (caller must not delete it). |
| 48 | + /// \return True if rule is registered successfully, false otherwise |
| 49 | + Q_INVOKABLE bool registerDisplayedFieldGeneratorRule(ctkDICOMDisplayedFieldGeneratorAbstractRule* rule); |
| 50 | + |
| 51 | + /// Return the list of displayed field generator rules registered. |
| 52 | + Q_INVOKABLE const QList<ctkDICOMDisplayedFieldGeneratorAbstractRule*>& displayedFieldGeneratorRules() |
| 53 | + { return this->DisplayedFieldGeneratorRules; } |
| 54 | + |
| 55 | + /// Return a list with the copies of displayed field generator rules that are enabled according to the database. |
| 56 | + /// \param database DICOM database in which the DisplayedFieldGeneratorRules table is used to decide if a rule is |
| 57 | + /// enabled or not. If the table itself or an entry with a particular rule name is missing then the rule is treated as enabled. |
| 58 | + Q_INVOKABLE QList<ctkDICOMDisplayedFieldGeneratorAbstractRule*> copyEnabledDisplayedFieldGeneratorRules(ctkDICOMDatabase* database); |
| 59 | + |
| 60 | +signals: |
| 61 | + void displayedFieldGeneratorRuleRegistered(); |
| 62 | + void displayedFieldGeneratorRuleUnregistered(); |
| 63 | + |
| 64 | +protected: |
| 65 | + QList<ctkDICOMDisplayedFieldGeneratorAbstractRule*> DisplayedFieldGeneratorRules; |
| 66 | + |
| 67 | +private: |
| 68 | + /// Allows cleanup of the singleton at application exit |
| 69 | + static void cleanup(); |
| 70 | + |
| 71 | +private: |
| 72 | + ctkDICOMDisplayedFieldGeneratorRuleFactory(QObject* parent=nullptr); |
| 73 | + ~ctkDICOMDisplayedFieldGeneratorRuleFactory() override; |
| 74 | + |
| 75 | + Q_DISABLE_COPY(ctkDICOMDisplayedFieldGeneratorRuleFactory); |
| 76 | + friend class ctkDICOMDisplayedFieldGeneratorRuleFactoryCleanup; |
| 77 | + friend class PythonQtWrapper_ctkDICOMDisplayedFieldGeneratorRuleFactory; // Allow Python wrapping without enabling direct instantiation |
| 78 | + |
| 79 | +private: |
| 80 | + /// Instance of the singleton |
| 81 | + static ctkDICOMDisplayedFieldGeneratorRuleFactory* Instance; |
| 82 | +}; |
| 83 | + |
| 84 | +#endif // __ctkDICOMDisplayedFieldGeneratorRuleFactory_h_ |
0 commit comments