Mercurial > hg > orthanc
annotate OrthancServer/Sources/Search/DatabaseConstraint.h @ 5681:77875b51cf95 find-refactoring
integration mainline->find-refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 09 Jul 2024 10:15:15 +0200 |
parents | 3f13db27b399 68fc5af30c03 |
children | fd4c5e064cbe |
rev | line source |
---|---|
3029
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
5640
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
5485
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
3029
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * This program is free software: you can redistribute it and/or |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * modify it under the terms of the GNU General Public License as |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * published by the Free Software Foundation, either version 3 of the |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * License, or (at your option) any later version. |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * This program is distributed in the hope that it will be useful, but |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * WITHOUT ANY WARRANTY; without even the implied warranty of |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * General Public License for more details. |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * You should have received a copy of the GNU General Public License |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 **/ |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #pragma once |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 |
4096
d633e5bb7ba3
reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
26 #if !defined(ORTHANC_BUILDING_SERVER_LIBRARY) |
d633e5bb7ba3
reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
27 # error Macro ORTHANC_BUILDING_SERVER_LIBRARY must be defined |
d633e5bb7ba3
reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
28 #endif |
d633e5bb7ba3
reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
29 |
d633e5bb7ba3
reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
30 #if ORTHANC_BUILDING_SERVER_LIBRARY == 1 |
d633e5bb7ba3
reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
31 # include "../../../OrthancFramework/Sources/DicomFormat/DicomMap.h" |
d633e5bb7ba3
reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
32 #else |
d633e5bb7ba3
reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
33 // This is for the "orthanc-databases" project to reuse this file |
d633e5bb7ba3
reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
34 # include <DicomFormat/DicomMap.h> |
d633e5bb7ba3
reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
35 #endif |
3029
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 |
3098 | 37 #define ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT 0 |
3077
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
38 |
3074
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
39 #if ORTHANC_ENABLE_PLUGINS == 1 |
3077
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
40 # include <orthanc/OrthancCDatabasePlugin.h> |
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
41 # if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in 1.3.1 |
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
42 # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 2) |
3098 | 43 # undef ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT |
44 # define ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT 1 | |
3077
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
45 # endif |
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
46 # endif |
3074
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
47 #endif |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
48 |
5680
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
49 #include <deque> |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
50 |
3029
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
51 namespace Orthanc |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
52 { |
4096
d633e5bb7ba3
reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
53 enum ConstraintType |
d633e5bb7ba3
reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
54 { |
d633e5bb7ba3
reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
55 ConstraintType_Equal, |
d633e5bb7ba3
reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
56 ConstraintType_SmallerOrEqual, |
d633e5bb7ba3
reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
57 ConstraintType_GreaterOrEqual, |
d633e5bb7ba3
reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
58 ConstraintType_Wildcard, |
d633e5bb7ba3
reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
59 ConstraintType_List |
d633e5bb7ba3
reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
60 }; |
d633e5bb7ba3
reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4045
diff
changeset
|
61 |
3077
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
62 namespace Plugins |
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
63 { |
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
64 #if ORTHANC_ENABLE_PLUGINS == 1 |
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
65 OrthancPluginResourceType Convert(ResourceType type); |
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
66 #endif |
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
67 |
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
68 #if ORTHANC_ENABLE_PLUGINS == 1 |
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
69 ResourceType Convert(OrthancPluginResourceType type); |
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
70 #endif |
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
71 |
3098 | 72 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1 |
3077
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
73 OrthancPluginConstraintType Convert(ConstraintType constraint); |
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
74 #endif |
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
75 |
3098 | 76 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1 |
3077
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
77 ConstraintType Convert(OrthancPluginConstraintType constraint); |
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
78 #endif |
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
79 } |
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
80 |
aae1d6d31fef
compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3074
diff
changeset
|
81 |
3073
0e9d1731b1b0
refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
82 // This class is also used by the "orthanc-databases" project |
5680
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
83 class DatabaseConstraint : public boost::noncopyable |
3029
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 { |
5568
b0b5546f1b9f
find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents:
5485
diff
changeset
|
85 public: |
b0b5546f1b9f
find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents:
5485
diff
changeset
|
86 enum KeyType // used for ordering and filters |
b0b5546f1b9f
find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents:
5485
diff
changeset
|
87 { |
b0b5546f1b9f
find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents:
5485
diff
changeset
|
88 KeyType_DicomTag, |
b0b5546f1b9f
find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents:
5485
diff
changeset
|
89 KeyType_Metadata |
b0b5546f1b9f
find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents:
5485
diff
changeset
|
90 }; |
b0b5546f1b9f
find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents:
5485
diff
changeset
|
91 |
3029
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
92 private: |
5568
b0b5546f1b9f
find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents:
5485
diff
changeset
|
93 KeyType keyType_; |
3029
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 ResourceType level_; |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 DicomTag tag_; |
5568
b0b5546f1b9f
find refactor: re-use existing code. /studies?expand is almost fully implemented with new code
Alain Mazy <am@orthanc.team>
parents:
5485
diff
changeset
|
96 uint32_t metadataType_; // TODO: implement |
3029
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
97 bool isIdentifier_; |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
98 ConstraintType constraintType_; |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
99 std::vector<std::string> values_; |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
100 bool caseSensitive_; |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
101 bool mandatory_; |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
102 |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
103 public: |
3073
0e9d1731b1b0
refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
104 DatabaseConstraint(ResourceType level, |
0e9d1731b1b0
refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
105 const DicomTag& tag, |
0e9d1731b1b0
refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
106 bool isIdentifier, |
0e9d1731b1b0
refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
107 ConstraintType type, |
0e9d1731b1b0
refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
108 const std::vector<std::string>& values, |
0e9d1731b1b0
refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
109 bool caseSensitive, |
0e9d1731b1b0
refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
110 bool mandatory); |
3074
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
111 |
3098 | 112 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1 |
4204 | 113 explicit DatabaseConstraint(const OrthancPluginDatabaseConstraint& constraint); |
3074
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
114 #endif |
3073
0e9d1731b1b0
refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
115 |
3029
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
116 ResourceType GetLevel() const |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
117 { |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
118 return level_; |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
119 } |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
120 |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
121 const DicomTag& GetTag() const |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 { |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 return tag_; |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
124 } |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
125 |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
126 bool IsIdentifier() const |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
127 { |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
128 return isIdentifier_; |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
129 } |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
130 |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
131 ConstraintType GetConstraintType() const |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
132 { |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
133 return constraintType_; |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
134 } |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
135 |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
136 size_t GetValuesCount() const |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
137 { |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
138 return values_.size(); |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
139 } |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
140 |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
141 const std::string& GetValue(size_t index) const; |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
142 |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
143 const std::string& GetSingleValue() const; |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
144 |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
145 bool IsCaseSensitive() const |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
146 { |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 return caseSensitive_; |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 } |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
150 bool IsMandatory() const |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
151 { |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
152 return mandatory_; |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
153 } |
3055
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3029
diff
changeset
|
154 |
71ac4f28176f
compatibility layer seems to be working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3029
diff
changeset
|
155 bool IsMatch(const DicomMap& dicom) const; |
3074
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
156 |
3098 | 157 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1 |
3074
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
158 void EncodeForPlugins(OrthancPluginDatabaseConstraint& constraint, |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
159 std::vector<const char*>& tmpValues) const; |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
160 #endif |
3029
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
161 }; |
5680
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
162 |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
163 |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
164 class DatabaseConstraints : public boost::noncopyable |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
165 { |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
166 private: |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
167 std::deque<DatabaseConstraint*> constraints_; |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
168 |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
169 public: |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
170 ~DatabaseConstraints() |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
171 { |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
172 Clear(); |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
173 } |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
174 |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
175 void Clear(); |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
176 |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
177 void AddConstraint(DatabaseConstraint* constraint); // Takes ownership |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
178 |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
179 bool IsEmpty() const |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
180 { |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
181 return constraints_.empty(); |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
182 } |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
183 |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
184 size_t GetSize() const |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
185 { |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
186 return constraints_.size(); |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
187 } |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
188 |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
189 const DatabaseConstraint& GetConstraint(size_t index) const; |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
190 }; |
3029
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
191 } |