annotate OrthancServer/Sources/Database/ResourcesContent.h @ 5131:e107ff622e6d

merge
author Alain Mazy <am@osimis.io>
date Thu, 05 Jan 2023 17:25:21 +0100
parents 6eff25f70121
children 0ea402b4d901
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
4870
43e613a7756b upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
5 * Copyright (C) 2017-2022 Osimis S.A., Belgium
43e613a7756b upgrade to year 2022
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4831
diff changeset
6 * Copyright (C) 2021-2022 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
3094
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * This program is free software: you can redistribute it and/or
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * modify it under the terms of the GNU General Public License as
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * published by the Free Software Foundation, either version 3 of the
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * License, or (at your option) any later version.
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * 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
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * General Public License for more details.
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 *
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 **/
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 #pragma once
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
4045
05b8fd21089c fix path
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
25 #include "../../../OrthancFramework/Sources/DicomFormat/DicomMap.h"
3094
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include "../ServerEnumerations.h"
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 #include <boost/noncopyable.hpp>
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 #include <list>
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
3099
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
31
3094
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 namespace Orthanc
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 namespace Compatibility
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 {
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 class ISetResourcesContent;
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 }
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 class ResourcesContent : public boost::noncopyable
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 {
3099
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
41 public:
3094
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 struct TagValue
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 {
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 int64_t resourceId_;
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 bool isIdentifier_;
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 DicomTag tag_;
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 std::string value_;
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 TagValue(int64_t resourceId,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 bool isIdentifier,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 const DicomTag& tag,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 const std::string& value) :
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 resourceId_(resourceId),
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 isIdentifier_(isIdentifier),
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 tag_(tag),
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 value_(value)
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 {
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 }
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
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 struct Metadata
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 {
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 int64_t resourceId_;
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 MetadataType metadata_;
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 std::string value_;
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 Metadata(int64_t resourceId,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 MetadataType metadata,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 const std::string& value) :
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 resourceId_(resourceId),
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 metadata_(metadata),
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 value_(value)
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 }
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 };
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76
3099
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
77 typedef std::list<TagValue> ListTags;
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
78 typedef std::list<Metadata> ListMetadata;
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
79
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
80 private:
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
81 bool isNewResource_;
3099
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
82 ListTags tags_;
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
83 ListMetadata metadata_;
3094
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 public:
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
86 explicit ResourcesContent(bool isNewResource) :
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
87 isNewResource_(isNewResource)
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
88 {
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
89 }
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
90
3094
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 void AddMainDicomTag(int64_t resourceId,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 const DicomTag& tag,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 const std::string& value)
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 {
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95 tags_.push_back(TagValue(resourceId, false, tag, value));
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 }
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 void AddIdentifierTag(int64_t resourceId,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 const DicomTag& tag,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 const std::string& value)
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 {
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 tags_.push_back(TagValue(resourceId, true, tag, value));
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 }
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 void AddMetadata(int64_t resourceId,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 MetadataType metadata,
4623
95ffe3b6ef7c handling of revisions for metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
107 const std::string& value);
3094
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 AddResource(int64_t resource,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 ResourceType level,
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 const DicomMap& dicomSummary);
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 // WARNING: The database should be locked with a transaction!
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 void Store(Compatibility::ISetResourcesContent& target) const;
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115
3099
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
116 const ListTags& GetListTags() const
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
117 {
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
118 return tags_;
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
119 }
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
120
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
121 const ListMetadata& GetListMetadata() const
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
122 {
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
123 return metadata_;
9c71abbff70f removing build dependency on plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3094
diff changeset
124 }
3094
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 };
61da3c9b4121 cont reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 }