Mercurial > hg > orthanc
annotate OrthancServer/IDatabaseWrapper.h @ 2057:54417b0831c4
cont
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 29 Jun 2016 13:40:24 +0200 |
parents | b1291df2f780 |
children | a3a65de1840f |
rev | line source |
---|---|
1247 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1286
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
1247 | 5 * |
6 * This program is free software: you can redistribute it and/or | |
7 * modify it under the terms of the GNU General Public License as | |
8 * published by the Free Software Foundation, either version 3 of the | |
9 * License, or (at your option) any later version. | |
10 * | |
11 * In addition, as a special exception, the copyright holders of this | |
12 * program give permission to link the code of its release with the | |
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
14 * that use the same license as the "OpenSSL" library), and distribute | |
15 * the linked executables. You must obey the GNU General Public License | |
16 * in all respects for all of the code used other than "OpenSSL". If you | |
17 * modify file(s) with this exception, you may extend this exception to | |
18 * your version of the file(s), but you are not obligated to do so. If | |
19 * you do not wish to do so, delete this exception statement from your | |
20 * version. If you delete this exception statement from all source files | |
21 * in the program, then also delete it here. | |
22 * | |
23 * This program is distributed in the hope that it will be useful, but | |
24 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
26 * General Public License for more details. | |
27 * | |
28 * You should have received a copy of the GNU General Public License | |
29 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
30 **/ | |
31 | |
32 | |
33 #pragma once | |
34 | |
35 #include "../Core/DicomFormat/DicomMap.h" | |
36 #include "../Core/SQLite/ITransaction.h" | |
1615
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1509
diff
changeset
|
37 #include "../Core/FileStorage/IStorageArea.h" |
1247 | 38 #include "../Core/FileStorage/FileInfo.h" |
1432
0ac74fa21db8
rename IServerIndexListener as IDatabaseListener
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1306
diff
changeset
|
39 #include "IDatabaseListener.h" |
1247 | 40 #include "ExportedResource.h" |
41 | |
42 #include <list> | |
43 #include <boost/noncopyable.hpp> | |
44 | |
45 namespace Orthanc | |
46 { | |
47 class IDatabaseWrapper : public boost::noncopyable | |
48 { | |
49 public: | |
50 virtual ~IDatabaseWrapper() | |
51 { | |
52 } | |
53 | |
1672
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
54 virtual void Open() = 0; |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
55 |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
56 virtual void Close() = 0; |
4c5a85c3ff43
sample database plugin now working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1668
diff
changeset
|
57 |
1247 | 58 virtual void AddAttachment(int64_t id, |
59 const FileInfo& attachment) = 0; | |
60 | |
61 virtual void AttachChild(int64_t parent, | |
62 int64_t child) = 0; | |
63 | |
1286 | 64 virtual void ClearChanges() = 0; |
65 | |
66 virtual void ClearExportedResources() = 0; | |
1247 | 67 |
68 virtual int64_t CreateResource(const std::string& publicId, | |
69 ResourceType type) = 0; | |
70 | |
71 virtual void DeleteAttachment(int64_t id, | |
72 FileContentType attachment) = 0; | |
73 | |
74 virtual void DeleteMetadata(int64_t id, | |
75 MetadataType type) = 0; | |
76 | |
77 virtual void DeleteResource(int64_t id) = 0; | |
78 | |
79 virtual void FlushToDisk() = 0; | |
80 | |
1306
8cd5784a6d80
IDatabaseWrapper::HasFlushToDisk()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1302
diff
changeset
|
81 virtual bool HasFlushToDisk() const = 0; |
8cd5784a6d80
IDatabaseWrapper::HasFlushToDisk()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1302
diff
changeset
|
82 |
1301 | 83 virtual void GetAllMetadata(std::map<MetadataType, std::string>& target, |
1247 | 84 int64_t id) = 0; |
85 | |
1750
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1746
diff
changeset
|
86 virtual void GetAllInternalIds(std::list<int64_t>& target, |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1746
diff
changeset
|
87 ResourceType resourceType) = 0; |
55d52567bebb
LookupResource implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1746
diff
changeset
|
88 |
1247 | 89 virtual void GetAllPublicIds(std::list<std::string>& target, |
90 ResourceType resourceType) = 0; | |
91 | |
1509
0586ed8897f1
limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1432
diff
changeset
|
92 virtual void GetAllPublicIds(std::list<std::string>& target, |
0586ed8897f1
limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1432
diff
changeset
|
93 ResourceType resourceType, |
0586ed8897f1
limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1432
diff
changeset
|
94 size_t since, |
0586ed8897f1
limit and since arguments while retrieving DICOM resources in the REST API
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1432
diff
changeset
|
95 size_t limit) = 0; |
1247 | 96 |
97 virtual void GetChanges(std::list<ServerIndexChange>& target /*out*/, | |
98 bool& done /*out*/, | |
99 int64_t since, | |
1302 | 100 uint32_t maxResults) = 0; |
1247 | 101 |
1301 | 102 virtual void GetChildrenInternalId(std::list<int64_t>& target, |
1247 | 103 int64_t id) = 0; |
104 | |
1301 | 105 virtual void GetChildrenPublicId(std::list<std::string>& target, |
1247 | 106 int64_t id) = 0; |
107 | |
108 virtual void GetExportedResources(std::list<ExportedResource>& target /*out*/, | |
109 bool& done /*out*/, | |
110 int64_t since, | |
1302 | 111 uint32_t maxResults) = 0; |
1247 | 112 |
113 virtual void GetLastChange(std::list<ServerIndexChange>& target /*out*/) = 0; | |
114 | |
115 virtual void GetLastExportedResource(std::list<ExportedResource>& target /*out*/) = 0; | |
116 | |
117 virtual void GetMainDicomTags(DicomMap& map, | |
118 int64_t id) = 0; | |
119 | |
120 virtual std::string GetPublicId(int64_t resourceId) = 0; | |
121 | |
122 virtual uint64_t GetResourceCount(ResourceType resourceType) = 0; | |
123 | |
124 virtual ResourceType GetResourceType(int64_t resourceId) = 0; | |
125 | |
126 virtual uint64_t GetTotalCompressedSize() = 0; | |
127 | |
128 virtual uint64_t GetTotalUncompressedSize() = 0; | |
129 | |
130 virtual bool IsExistingResource(int64_t internalId) = 0; | |
131 | |
132 virtual bool IsProtectedPatient(int64_t internalId) = 0; | |
133 | |
134 virtual void ListAvailableMetadata(std::list<MetadataType>& target, | |
135 int64_t id) = 0; | |
136 | |
1301 | 137 virtual void ListAvailableAttachments(std::list<FileContentType>& target, |
1247 | 138 int64_t id) = 0; |
139 | |
140 virtual void LogChange(int64_t internalId, | |
141 const ServerIndexChange& change) = 0; | |
142 | |
143 virtual void LogExportedResource(const ExportedResource& resource) = 0; | |
144 | |
145 virtual bool LookupAttachment(FileInfo& attachment, | |
146 int64_t id, | |
147 FileContentType contentType) = 0; | |
148 | |
149 virtual bool LookupGlobalProperty(std::string& target, | |
150 GlobalProperty property) = 0; | |
151 | |
1746 | 152 virtual void LookupIdentifier(std::list<int64_t>& result, |
153 ResourceType level, | |
154 const DicomTag& tag, | |
155 IdentifierConstraintType type, | |
156 const std::string& value) = 0; | |
1729 | 157 |
1247 | 158 virtual bool LookupMetadata(std::string& target, |
159 int64_t id, | |
160 MetadataType type) = 0; | |
161 | |
162 virtual bool LookupParent(int64_t& parentId, | |
163 int64_t resourceId) = 0; | |
164 | |
1294 | 165 virtual bool LookupResource(int64_t& id, |
166 ResourceType& type, | |
167 const std::string& publicId) = 0; | |
1247 | 168 |
169 virtual bool SelectPatientToRecycle(int64_t& internalId) = 0; | |
170 | |
171 virtual bool SelectPatientToRecycle(int64_t& internalId, | |
172 int64_t patientIdToAvoid) = 0; | |
173 | |
174 virtual void SetGlobalProperty(GlobalProperty property, | |
175 const std::string& value) = 0; | |
176 | |
1668
de1413733c97
reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1615
diff
changeset
|
177 virtual void ClearMainDicomTags(int64_t id) = 0; |
de1413733c97
reconstructing main dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1615
diff
changeset
|
178 |
1286 | 179 virtual void SetMainDicomTag(int64_t id, |
180 const DicomTag& tag, | |
181 const std::string& value) = 0; | |
1247 | 182 |
1713 | 183 virtual void SetIdentifierTag(int64_t id, |
184 const DicomTag& tag, | |
185 const std::string& value) = 0; | |
186 | |
1247 | 187 virtual void SetMetadata(int64_t id, |
188 MetadataType type, | |
189 const std::string& value) = 0; | |
190 | |
191 virtual void SetProtectedPatient(int64_t internalId, | |
192 bool isProtected) = 0; | |
193 | |
194 virtual SQLite::ITransaction* StartTransaction() = 0; | |
195 | |
1432
0ac74fa21db8
rename IServerIndexListener as IDatabaseListener
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1306
diff
changeset
|
196 virtual void SetListener(IDatabaseListener& listener) = 0; |
1615
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1509
diff
changeset
|
197 |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1509
diff
changeset
|
198 virtual unsigned int GetDatabaseVersion() = 0; |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1509
diff
changeset
|
199 |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1509
diff
changeset
|
200 virtual void Upgrade(unsigned int targetVersion, |
c40fe92a68e7
Primitives to upgrade the database version in plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1509
diff
changeset
|
201 IStorageArea& storageArea) = 0; |
1247 | 202 }; |
203 } |