annotate OrthancServer/Sources/Database/ResourcesContent.h @ 4798:96ab170294fd storage-cache

typo
author Alain Mazy <am@osimis.io>
date Thu, 07 Oct 2021 13:45:36 +0200
parents 95ffe3b6ef7c
children f0038043fb97 7053502fbf97
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3094
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
4437
d9473bd5ed43 upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4045
diff changeset
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium
3094
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * In addition, as a special exception, the copyright holders of this
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * program give permission to link the code of its release with the
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * that use the same license as the "OpenSSL" library), and distribute
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * the linked executables. You must obey the GNU General Public License
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * in all respects for all of the code used other than "OpenSSL". If you
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * modify file(s) with this exception, you may extend this exception to
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * your version of the file(s), but you are not obligated to do so. If
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * you do not wish to do so, delete this exception statement from your
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * version. If you delete this exception statement from all source files
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * in the program, then also delete it here.
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 *
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * This program is distributed in the hope that it will be useful, but
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * General Public License for more details.
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 *
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * You should have received a copy of the GNU General Public License
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 **/
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #pragma once
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
4045
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
36 #include "../../../OrthancFramework/Sources/DicomFormat/DicomMap.h"
3094
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 #include "../ServerEnumerations.h"
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 #include <boost/noncopyable.hpp>
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 #include <list>
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41
3099
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
42
3094
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 namespace Orthanc
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 {
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 namespace Compatibility
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 {
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 class ISetResourcesContent;
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 }
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 class ResourcesContent : public boost::noncopyable
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 {
3099
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
52 public:
3094
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 struct TagValue
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 {
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 int64_t resourceId_;
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 bool isIdentifier_;
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 DicomTag tag_;
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 std::string value_;
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 TagValue(int64_t resourceId,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 bool isIdentifier,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 const DicomTag& tag,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 const std::string& value) :
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 resourceId_(resourceId),
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 isIdentifier_(isIdentifier),
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 tag_(tag),
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 value_(value)
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 {
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 }
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 };
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 struct Metadata
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 {
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 int64_t resourceId_;
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 MetadataType metadata_;
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 std::string value_;
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 Metadata(int64_t resourceId,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 MetadataType metadata,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 const std::string& value) :
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 resourceId_(resourceId),
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 metadata_(metadata),
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 value_(value)
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 {
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 }
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 };
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87
3099
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
88 typedef std::list<TagValue> ListTags;
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
89 typedef std::list<Metadata> ListMetadata;
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
90
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
91 private:
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
92 bool isNewResource_;
3099
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
93 ListTags tags_;
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
94 ListMetadata metadata_;
3094
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 public:
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
97 explicit ResourcesContent(bool isNewResource) :
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
98 isNewResource_(isNewResource)
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
99 {
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
100 }
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
101
3094
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 void AddMainDicomTag(int64_t resourceId,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 const DicomTag& tag,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 const std::string& value)
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 {
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 tags_.push_back(TagValue(resourceId, false, tag, value));
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 }
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 void AddIdentifierTag(int64_t resourceId,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 const DicomTag& tag,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 const std::string& value)
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 {
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 tags_.push_back(TagValue(resourceId, true, tag, value));
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 }
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 void AddMetadata(int64_t resourceId,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 MetadataType metadata,
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
118 const std::string& value);
3094
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 void AddResource(int64_t resource,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 ResourceType level,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 const DicomMap& dicomSummary);
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 // WARNING: The database should be locked with a transaction!
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 void Store(Compatibility::ISetResourcesContent& target) const;
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126
3099
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
127 const ListTags& GetListTags() const
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
128 {
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
129 return tags_;
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
130 }
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
131
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
132 const ListMetadata& GetListMetadata() const
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
133 {
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
134 return metadata_;
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
135 }
3094
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 };
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 }