Mercurial > hg > orthanc
annotate OrthancServer/Sources/Search/DatabaseConstraint.cpp @ 5853:4d932683049d get-scu tip
very first implementation of C-Get SCU
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Tue, 29 Oct 2024 17:25:49 +0100 |
parents | 68fc5af30c03 |
children | 77875b51cf95 |
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 | 40 #include <cassert> |
41 | |
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 | 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 | 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) : |
3029
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
156 level_(level), |
3073
0e9d1731b1b0
refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
157 tag_(tag), |
0e9d1731b1b0
refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
158 isIdentifier_(isIdentifier), |
0e9d1731b1b0
refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
159 constraintType_(type), |
0e9d1731b1b0
refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
160 values_(values), |
0e9d1731b1b0
refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
161 caseSensitive_(caseSensitive), |
0e9d1731b1b0
refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
162 mandatory_(mandatory) |
3029
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
163 { |
3073
0e9d1731b1b0
refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
164 if (type != ConstraintType_List && |
0e9d1731b1b0
refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
165 values_.size() != 1) |
3029
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
166 { |
3073
0e9d1731b1b0
refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
167 throw OrthancException(ErrorCode_ParameterOutOfRange); |
0e9d1731b1b0
refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
168 } |
0e9d1731b1b0
refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
169 } |
3029
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
170 |
3073
0e9d1731b1b0
refactoring to reuse DatabaseConstraint in separate projects
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3062
diff
changeset
|
171 |
3098 | 172 #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
|
173 DatabaseConstraint::DatabaseConstraint(const OrthancPluginDatabaseConstraint& constraint) : |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
174 level_(Plugins::Convert(constraint.level)), |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
175 tag_(constraint.tagGroup, constraint.tagElement), |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
176 isIdentifier_(constraint.isIdentifierTag), |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
177 constraintType_(Plugins::Convert(constraint.type)), |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
178 caseSensitive_(constraint.isCaseSensitive), |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
179 mandatory_(constraint.isMandatory) |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
180 { |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
181 if (constraintType_ != ConstraintType_List && |
3078 | 182 constraint.valuesCount != 1) |
3074
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
183 { |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
184 throw OrthancException(ErrorCode_ParameterOutOfRange); |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
185 } |
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 values_.resize(constraint.valuesCount); |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
188 |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
189 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
|
190 { |
3078 | 191 assert(constraint.values[i] != NULL); |
3074
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
192 values_[i].assign(constraint.values[i]); |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
193 } |
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 #endif |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
196 |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
197 |
3029
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
198 const std::string& DatabaseConstraint::GetValue(size_t index) const |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
199 { |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
200 if (index >= values_.size()) |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
201 { |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
202 throw OrthancException(ErrorCode_ParameterOutOfRange); |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
203 } |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
204 else |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
205 { |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
206 return values_[index]; |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
207 } |
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 const std::string& DatabaseConstraint::GetSingleValue() const |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
212 { |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
213 if (values_.size() != 1) |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
214 { |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
215 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
216 } |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
217 else |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
218 { |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
219 return values_[0]; |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
220 } |
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
221 } |
3074
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
222 |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
223 |
3098 | 224 #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
|
225 void DatabaseConstraint::EncodeForPlugins(OrthancPluginDatabaseConstraint& constraint, |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
226 std::vector<const char*>& tmpValues) const |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
227 { |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
228 memset(&constraint, 0, sizeof(constraint)); |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
229 |
3078 | 230 tmpValues.resize(values_.size()); |
231 | |
232 for (size_t i = 0; i < values_.size(); i++) | |
233 { | |
234 tmpValues[i] = values_[i].c_str(); | |
235 } | |
236 | |
3074
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
237 constraint.level = Plugins::Convert(level_); |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
238 constraint.tagGroup = tag_.GetGroup(); |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
239 constraint.tagElement = tag_.GetElement(); |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
240 constraint.isIdentifierTag = isIdentifier_; |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
241 constraint.isCaseSensitive = caseSensitive_; |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
242 constraint.isMandatory = mandatory_; |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
243 constraint.type = Plugins::Convert(constraintType_); |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
244 constraint.valuesCount = values_.size(); |
3078 | 245 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
|
246 } |
495c5edce708
new extension for database plugin SDK: lookupResources
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3073
diff
changeset
|
247 #endif |
5680
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
248 |
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 void DatabaseConstraints::Clear() |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
251 { |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
252 for (size_t i = 0; i < constraints_.size(); i++) |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
253 { |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
254 assert(constraints_[i] != NULL); |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
255 delete constraints_[i]; |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
256 } |
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 constraints_.clear(); |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
259 } |
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 void DatabaseConstraints::AddConstraint(DatabaseConstraint* constraint) |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
263 { |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
264 if (constraint == NULL) |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
265 { |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
266 throw OrthancException(ErrorCode_NullPointer); |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
267 } |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
268 else |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
269 { |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
270 constraints_.push_back(constraint); |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
271 } |
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 const DatabaseConstraint& DatabaseConstraints::GetConstraint(size_t index) const |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
276 { |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
277 if (index >= constraints_.size()) |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
278 { |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
279 throw OrthancException(ErrorCode_ParameterOutOfRange); |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
280 } |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
281 else |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
282 { |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
283 assert(constraints_[index] != NULL); |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
284 return *constraints_[index]; |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
285 } |
68fc5af30c03
added container class DatabaseConstraints
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5640
diff
changeset
|
286 } |
3029
ea653ec47f31
new class: DatabaseConstraint
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
287 } |