annotate OrthancServer/Resources/Graveyard/DatabasePluginSample/Database.h @ 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 f7adfb22e20e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1671
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1761
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1671
2f2e2ec17bc4 sample database plugin
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
1671
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 *
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * This program is free software: you can redistribute it and/or
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * modify it under the terms of the GNU General Public License as
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * published by the Free Software Foundation, either version 3 of the
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * License, or (at your option) any later version.
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 *
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful, but
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * General Public License for more details.
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 *
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 **/
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #pragma once
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
4050
cd363608551a fix paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
26 #include "OrthancCppDatabasePlugin.h"
1671
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
4050
cd363608551a fix paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
28 #include "../../../../OrthancFramework/Sources/SQLite/Connection.h"
cd363608551a fix paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
29 #include "../../../../OrthancFramework/Sources/SQLite/Transaction.h"
cd363608551a fix paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
30 #include "../../../Plugins/Engine/PluginsEnumerations.h"
cd363608551a fix paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
31 #include "DatabaseWrapperBase.h"
1671
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 #include <memory>
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 class Database : public OrthancPlugins::IDatabaseBackend
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 private:
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 class SignalRemainingAncestor;
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 std::string path_;
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 Orthanc::SQLite::Connection db_;
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 Orthanc::DatabaseWrapperBase base_;
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 SignalRemainingAncestor* signalRemainingAncestor_;
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 std::auto_ptr<Orthanc::SQLite::Transaction> transaction_;
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 public:
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 Database(const std::string& path);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 virtual void Open();
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 virtual void Close();
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 virtual void AddAttachment(int64_t id,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 const OrthancPluginAttachment& attachment);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 virtual void AttachChild(int64_t parent,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 int64_t child)
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 base_.AttachChild(parent, child);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 virtual void ClearChanges()
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 db_.Execute("DELETE FROM Changes");
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 virtual void ClearExportedResources()
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 db_.Execute("DELETE FROM ExportedResources");
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 virtual int64_t CreateResource(const char* publicId,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 OrthancPluginResourceType type)
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 return base_.CreateResource(publicId, Orthanc::Plugins::Convert(type));
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 virtual void DeleteAttachment(int64_t id,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 int32_t attachment)
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 base_.DeleteAttachment(id, static_cast<Orthanc::FileContentType>(attachment));
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 virtual void DeleteMetadata(int64_t id,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 int32_t metadataType)
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 base_.DeleteMetadata(id, static_cast<Orthanc::MetadataType>(metadataType));
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 virtual void DeleteResource(int64_t id);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92
1761
f4286d99ee0a fix sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1728
diff changeset
93 virtual void GetAllInternalIds(std::list<int64_t>& target,
f4286d99ee0a fix sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1728
diff changeset
94 OrthancPluginResourceType resourceType)
f4286d99ee0a fix sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1728
diff changeset
95 {
f4286d99ee0a fix sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1728
diff changeset
96 base_.GetAllInternalIds(target, Orthanc::Plugins::Convert(resourceType));
f4286d99ee0a fix sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1728
diff changeset
97 }
f4286d99ee0a fix sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1728
diff changeset
98
1671
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 virtual void GetAllPublicIds(std::list<std::string>& target,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 OrthancPluginResourceType resourceType)
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 base_.GetAllPublicIds(target, Orthanc::Plugins::Convert(resourceType));
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 virtual void GetAllPublicIds(std::list<std::string>& target,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 OrthancPluginResourceType resourceType,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 uint64_t since,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 uint64_t limit)
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110 base_.GetAllPublicIds(target, Orthanc::Plugins::Convert(resourceType), since, limit);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 virtual void GetChanges(bool& done /*out*/,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 int64_t since,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 uint32_t maxResults);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 virtual void GetChildrenInternalId(std::list<int64_t>& target /*out*/,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 int64_t id)
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 base_.GetChildrenInternalId(target, id);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 virtual void GetChildrenPublicId(std::list<std::string>& target /*out*/,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 int64_t id)
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 base_.GetChildrenPublicId(target, id);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 virtual void GetExportedResources(bool& done /*out*/,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 int64_t since,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 uint32_t maxResults);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 virtual void GetLastChange();
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 virtual void GetLastExportedResource();
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 virtual void GetMainDicomTags(int64_t id);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 virtual std::string GetPublicId(int64_t resourceId);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 virtual uint64_t GetResourceCount(OrthancPluginResourceType resourceType)
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 return base_.GetResourceCount(Orthanc::Plugins::Convert(resourceType));
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 virtual OrthancPluginResourceType GetResourceType(int64_t resourceId);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 virtual uint64_t GetTotalCompressedSize()
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 return base_.GetTotalCompressedSize();
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 virtual uint64_t GetTotalUncompressedSize()
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 return base_.GetTotalUncompressedSize();
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 virtual bool IsExistingResource(int64_t internalId)
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 return base_.IsExistingResource(internalId);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 virtual bool IsProtectedPatient(int64_t internalId)
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 return base_.IsProtectedPatient(internalId);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 virtual void ListAvailableMetadata(std::list<int32_t>& target /*out*/,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 int64_t id);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 virtual void ListAvailableAttachments(std::list<int32_t>& target /*out*/,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 int64_t id);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 virtual void LogChange(const OrthancPluginChange& change);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 virtual void LogExportedResource(const OrthancPluginExportedResource& resource);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 virtual bool LookupAttachment(int64_t id,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 int32_t contentType);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 virtual bool LookupGlobalProperty(std::string& target /*out*/,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 int32_t property)
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 return base_.LookupGlobalProperty(target, static_cast<Orthanc::GlobalProperty>(property));
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186
1761
f4286d99ee0a fix sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1728
diff changeset
187 virtual void LookupIdentifier(std::list<int64_t>& target /*out*/,
f4286d99ee0a fix sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1728
diff changeset
188 OrthancPluginResourceType level,
f4286d99ee0a fix sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1728
diff changeset
189 uint16_t group,
f4286d99ee0a fix sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1728
diff changeset
190 uint16_t element,
f4286d99ee0a fix sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1728
diff changeset
191 OrthancPluginIdentifierConstraint constraint,
f4286d99ee0a fix sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1728
diff changeset
192 const char* value)
1671
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 {
1761
f4286d99ee0a fix sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1728
diff changeset
194 base_.LookupIdentifier(target, Orthanc::Plugins::Convert(level),
f4286d99ee0a fix sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1728
diff changeset
195 Orthanc::DicomTag(group, element),
f4286d99ee0a fix sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1728
diff changeset
196 Orthanc::Plugins::Convert(constraint), value);
1671
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 virtual bool LookupMetadata(std::string& target /*out*/,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 int64_t id,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 int32_t metadataType)
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 return base_.LookupMetadata(target, id, static_cast<Orthanc::MetadataType>(metadataType));
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 virtual bool LookupParent(int64_t& parentId /*out*/,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 int64_t resourceId);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 virtual bool LookupResource(int64_t& id /*out*/,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 OrthancPluginResourceType& type /*out*/,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 const char* publicId);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 virtual bool SelectPatientToRecycle(int64_t& internalId /*out*/)
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 return base_.SelectPatientToRecycle(internalId);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 virtual bool SelectPatientToRecycle(int64_t& internalId /*out*/,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 int64_t patientIdToAvoid)
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 return base_.SelectPatientToRecycle(internalId, patientIdToAvoid);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 virtual void SetGlobalProperty(int32_t property,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 const char* value)
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 base_.SetGlobalProperty(static_cast<Orthanc::GlobalProperty>(property), value);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 virtual void SetMainDicomTag(int64_t id,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 uint16_t group,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 uint16_t element,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 const char* value)
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 base_.SetMainDicomTag(id, Orthanc::DicomTag(group, element), value);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 virtual void SetIdentifierTag(int64_t id,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 uint16_t group,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 uint16_t element,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 const char* value)
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 {
1714
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1671
diff changeset
244 base_.SetIdentifierTag(id, Orthanc::DicomTag(group, element), value);
1671
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 virtual void SetMetadata(int64_t id,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 int32_t metadataType,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 const char* value)
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 base_.SetMetadata(id, static_cast<Orthanc::MetadataType>(metadataType), value);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 virtual void SetProtectedPatient(int64_t internalId,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 bool isProtected)
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 base_.SetProtectedPatient(internalId, isProtected);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 virtual void StartTransaction();
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 virtual void RollbackTransaction();
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 virtual void CommitTransaction();
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 virtual uint32_t GetDatabaseVersion();
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 virtual void UpgradeDatabase(uint32_t targetVersion,
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 OrthancPluginStorageArea* storageArea);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 virtual void ClearMainDicomTags(int64_t internalId)
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272 {
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 base_.ClearMainDicomTags(internalId);
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 }
2f2e2ec17bc4 sample database plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 };