annotate OrthancServer/Sources/Search/DatabaseConstraint.cpp @ 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
4096
d633e5bb7ba3 reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
24 #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
25 # 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
26 #endif
d633e5bb7ba3 reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
27
d633e5bb7ba3 reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
28 #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
29 # include "../PrecompiledHeadersServer.h"
d633e5bb7ba3 reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
30 #endif
d633e5bb7ba3 reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
31
3029
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 #include "DatabaseConstraint.h"
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
4096
d633e5bb7ba3 reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
34 #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
35 # include "../../../OrthancFramework/Sources/OrthancException.h"
d633e5bb7ba3 reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
36 #else
d633e5bb7ba3 reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
37 # include <OrthancException.h>
d633e5bb7ba3 reusing of ISqlLookupFormatter and DatabaseConstraint in orthanc-databases project
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
38 #endif
3077
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
39
4304
50b0c69b653a continued abi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4096
diff changeset
40 #include <cassert>
50b0c69b653a continued abi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4096
diff changeset
41
50b0c69b653a continued abi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4096
diff changeset
42
3077
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
43 namespace Orthanc
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
44 {
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
45 namespace Plugins
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
46 {
3074
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
47 #if ORTHANC_ENABLE_PLUGINS == 1
3077
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
48 OrthancPluginResourceType Convert(ResourceType type)
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
49 {
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
50 switch (type)
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
51 {
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
52 case ResourceType_Patient:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
53 return OrthancPluginResourceType_Patient;
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
54
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
55 case ResourceType_Study:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
56 return OrthancPluginResourceType_Study;
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
57
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
58 case ResourceType_Series:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
59 return OrthancPluginResourceType_Series;
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
60
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
61 case ResourceType_Instance:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
62 return OrthancPluginResourceType_Instance;
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 default:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
65 throw OrthancException(ErrorCode_ParameterOutOfRange);
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
66 }
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 #endif
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
69
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
70
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
71 #if ORTHANC_ENABLE_PLUGINS == 1
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
72 ResourceType Convert(OrthancPluginResourceType type)
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
73 {
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
74 switch (type)
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
75 {
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
76 case OrthancPluginResourceType_Patient:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
77 return ResourceType_Patient;
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
78
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
79 case OrthancPluginResourceType_Study:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
80 return ResourceType_Study;
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
81
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
82 case OrthancPluginResourceType_Series:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
83 return ResourceType_Series;
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
84
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
85 case OrthancPluginResourceType_Instance:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
86 return ResourceType_Instance;
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
87
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
88 default:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
89 throw OrthancException(ErrorCode_ParameterOutOfRange);
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
90 }
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
91 }
3074
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
92 #endif
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
93
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
94
3098
717efd0989f9 renamed macro
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3087
diff changeset
95 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1
3077
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
96 OrthancPluginConstraintType Convert(ConstraintType constraint)
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
97 {
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
98 switch (constraint)
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
99 {
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
100 case ConstraintType_Equal:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
101 return OrthancPluginConstraintType_Equal;
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
102
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
103 case ConstraintType_GreaterOrEqual:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
104 return OrthancPluginConstraintType_GreaterOrEqual;
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
105
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
106 case ConstraintType_SmallerOrEqual:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
107 return OrthancPluginConstraintType_SmallerOrEqual;
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
108
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
109 case ConstraintType_Wildcard:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
110 return OrthancPluginConstraintType_Wildcard;
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
111
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
112 case ConstraintType_List:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
113 return OrthancPluginConstraintType_List;
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
114
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
115 default:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
116 throw OrthancException(ErrorCode_ParameterOutOfRange);
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
117 }
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
118 }
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
119 #endif
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
120
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
121
3098
717efd0989f9 renamed macro
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3087
diff changeset
122 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1
3077
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
123 ConstraintType Convert(OrthancPluginConstraintType constraint)
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
124 {
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
125 switch (constraint)
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
126 {
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
127 case OrthancPluginConstraintType_Equal:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
128 return ConstraintType_Equal;
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
129
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
130 case OrthancPluginConstraintType_GreaterOrEqual:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
131 return ConstraintType_GreaterOrEqual;
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
132
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
133 case OrthancPluginConstraintType_SmallerOrEqual:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
134 return ConstraintType_SmallerOrEqual;
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
135
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
136 case OrthancPluginConstraintType_Wildcard:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
137 return ConstraintType_Wildcard;
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
138
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
139 case OrthancPluginConstraintType_List:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
140 return ConstraintType_List;
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
141
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
142 default:
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
143 throw OrthancException(ErrorCode_ParameterOutOfRange);
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
144 }
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
145 }
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
146 #endif
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
147 }
aae1d6d31fef compatibility with orthanc-databases
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3074
diff changeset
148
3073
0e9d1731b1b0 refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3062
diff changeset
149 DatabaseConstraint::DatabaseConstraint(ResourceType level,
0e9d1731b1b0 refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3062
diff changeset
150 const DicomTag& tag,
0e9d1731b1b0 refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3062
diff changeset
151 bool isIdentifier,
0e9d1731b1b0 refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3062
diff changeset
152 ConstraintType type,
0e9d1731b1b0 refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3062
diff changeset
153 const std::vector<std::string>& values,
0e9d1731b1b0 refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3062
diff changeset
154 bool caseSensitive,
0e9d1731b1b0 refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3062
diff changeset
155 bool mandatory) :
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
156 keyType_(DatabaseConstraint::KeyType_DicomTag),
3029
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 level_(level),
3073
0e9d1731b1b0 refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3062
diff changeset
158 tag_(tag),
0e9d1731b1b0 refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3062
diff changeset
159 isIdentifier_(isIdentifier),
0e9d1731b1b0 refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3062
diff changeset
160 constraintType_(type),
0e9d1731b1b0 refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3062
diff changeset
161 values_(values),
0e9d1731b1b0 refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3062
diff changeset
162 caseSensitive_(caseSensitive),
0e9d1731b1b0 refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3062
diff changeset
163 mandatory_(mandatory)
3029
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 {
3073
0e9d1731b1b0 refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3062
diff changeset
165 if (type != ConstraintType_List &&
0e9d1731b1b0 refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3062
diff changeset
166 values_.size() != 1)
3029
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 {
3073
0e9d1731b1b0 refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3062
diff changeset
168 throw OrthancException(ErrorCode_ParameterOutOfRange);
0e9d1731b1b0 refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3062
diff changeset
169 }
0e9d1731b1b0 refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3062
diff changeset
170 }
3029
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171
3073
0e9d1731b1b0 refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3062
diff changeset
172
3098
717efd0989f9 renamed macro
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3087
diff changeset
173 #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
174 DatabaseConstraint::DatabaseConstraint(const OrthancPluginDatabaseConstraint& constraint) :
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
175 level_(Plugins::Convert(constraint.level)),
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
176 tag_(constraint.tagGroup, constraint.tagElement),
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
177 isIdentifier_(constraint.isIdentifierTag),
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
178 constraintType_(Plugins::Convert(constraint.type)),
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
179 caseSensitive_(constraint.isCaseSensitive),
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
180 mandatory_(constraint.isMandatory)
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
181 {
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
182 if (constraintType_ != ConstraintType_List &&
3078
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3077
diff changeset
183 constraint.valuesCount != 1)
3074
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
184 {
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
185 throw OrthancException(ErrorCode_ParameterOutOfRange);
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
186 }
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
187
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
188 values_.resize(constraint.valuesCount);
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
189
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
190 for (uint32_t i = 0; i < constraint.valuesCount; i++)
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
191 {
3078
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3077
diff changeset
192 assert(constraint.values[i] != NULL);
3074
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
193 values_[i].assign(constraint.values[i]);
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
194 }
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
195 }
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
196 #endif
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
197
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
198
3029
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 const std::string& DatabaseConstraint::GetValue(size_t index) const
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 {
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 if (index >= values_.size())
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 {
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 throw OrthancException(ErrorCode_ParameterOutOfRange);
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 }
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 else
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 {
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 return values_[index];
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 }
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 }
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 const std::string& DatabaseConstraint::GetSingleValue() const
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 {
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 if (values_.size() != 1)
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 {
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 throw OrthancException(ErrorCode_BadSequenceOfCalls);
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 }
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 else
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 {
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 return values_[0];
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 }
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 }
3074
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
223
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
224
3098
717efd0989f9 renamed macro
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3087
diff changeset
225 #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
226 void DatabaseConstraint::EncodeForPlugins(OrthancPluginDatabaseConstraint& constraint,
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
227 std::vector<const char*>& tmpValues) const
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
228 {
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
229 memset(&constraint, 0, sizeof(constraint));
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
230
3078
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3077
diff changeset
231 tmpValues.resize(values_.size());
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3077
diff changeset
232
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3077
diff changeset
233 for (size_t i = 0; i < values_.size(); i++)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3077
diff changeset
234 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3077
diff changeset
235 tmpValues[i] = values_[i].c_str();
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3077
diff changeset
236 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3077
diff changeset
237
3074
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
238 constraint.level = Plugins::Convert(level_);
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
239 constraint.tagGroup = tag_.GetGroup();
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
240 constraint.tagElement = tag_.GetElement();
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
241 constraint.isIdentifierTag = isIdentifier_;
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
242 constraint.isCaseSensitive = caseSensitive_;
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
243 constraint.isMandatory = mandatory_;
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
244 constraint.type = Plugins::Convert(constraintType_);
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
245 constraint.valuesCount = values_.size();
3078
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3077
diff changeset
246 constraint.values = (tmpValues.empty() ? NULL : &tmpValues[0]);
3074
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
247 }
495c5edce708 new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3073
diff changeset
248 #endif
5680
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
249
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
250
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
251 void DatabaseConstraints::Clear()
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
252 {
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
253 for (size_t i = 0; i < constraints_.size(); i++)
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
254 {
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
255 assert(constraints_[i] != NULL);
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
256 delete constraints_[i];
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
257 }
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
258
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
259 constraints_.clear();
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
260 }
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
261
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
262
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
263 void DatabaseConstraints::AddConstraint(DatabaseConstraint* constraint)
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
264 {
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
265 if (constraint == NULL)
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
266 {
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
267 throw OrthancException(ErrorCode_NullPointer);
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
268 }
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
269 else
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
270 {
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
271 constraints_.push_back(constraint);
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
272 }
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
273 }
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
274
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
275
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
276 const DatabaseConstraint& DatabaseConstraints::GetConstraint(size_t index) const
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
277 {
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
278 if (index >= constraints_.size())
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
279 {
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
280 throw OrthancException(ErrorCode_ParameterOutOfRange);
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
281 }
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
282 else
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
283 {
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
284 assert(constraints_[index] != NULL);
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
285 return *constraints_[index];
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
286 }
68fc5af30c03 added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5640
diff changeset
287 }
3029
ea653ec47f31 new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 }