annotate Framework/Plugins/DatabaseBackendAdapterV2.cpp @ 395:a7a029043670 db-protobuf

integration mainline->db-protobuf
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 05 Apr 2023 14:53:57 +0200
parents d14e6ff04a5c
children a8774581adfc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
389
3d6886f3e5b3 upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 378
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
3d6886f3e5b3 upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 378
diff changeset
6 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * This program is free software: you can redistribute it and/or
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * modify it under the terms of the GNU Affero General Public License
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * as published by the Free Software Foundation, either version 3 of
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * the License, or (at your option) any later version.
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful, but
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * Affero General Public License for more details.
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 *
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU Affero General Public License
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 **/
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include "DatabaseBackendAdapterV2.h"
221
73cc85f3d9c1 implementation of the "serverIdentifier" information for global properties
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 212
diff changeset
25 #include "GlobalProperties.h"
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
226
a4918d57435c DatabaseManager doesn't IDatabaseFactory anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 225
diff changeset
27 #include "IndexBackend.h"
a4918d57435c DatabaseManager doesn't IDatabaseFactory anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 225
diff changeset
28
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 #include <OrthancException.h>
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
31 #include <boost/thread/mutex.hpp>
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
32 #include <list>
212
821d4ba83dc3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 209
diff changeset
33 #include <stdexcept>
821d4ba83dc3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 209
diff changeset
34 #include <string>
821d4ba83dc3 reorganization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 209
diff changeset
35
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 #define ORTHANC_PLUGINS_DATABASE_CATCH \
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 catch (::Orthanc::OrthancException& e) \
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 { \
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 return static_cast<OrthancPluginErrorCode>(e.GetErrorCode()); \
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 } \
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 catch (::std::runtime_error& e) \
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 { \
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
44 LogError(adapter->GetBackend(), e); \
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 return OrthancPluginErrorCode_DatabasePlugin; \
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 } \
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 catch (...) \
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 { \
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
49 OrthancPluginLogError(adapter->GetBackend().GetContext(), "Native exception"); \
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 return OrthancPluginErrorCode_DatabasePlugin; \
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 namespace OrthancDatabases
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
55 {
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
56 class DatabaseBackendAdapterV2::Adapter : public boost::noncopyable
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
57 {
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
58 private:
229
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
59 /**
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
60 * The "managerMutex_" should not be necessary, as it is redundant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
61 * with with "Orthanc::ServerIndex::mutex_" (the global mutex) in
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
62 * Orthanc <= 1.9.1, or with
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
63 * "Orthanc::OrthancPluginDatabase::mutex_" in Orthanc >= 1.9.2
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
64 * (the global mutex limited to backward compatibility with older
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
65 * plugins). It is left here for additional safety.
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
66 **/
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 226
diff changeset
67
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
68 std::unique_ptr<IDatabaseBackend> backend_;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
69 boost::mutex managerMutex_;
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
70 std::unique_ptr<DatabaseManager> manager_;
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
71
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
72 public:
252
33fa478c119a cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 229
diff changeset
73 explicit Adapter(IDatabaseBackend* backend) :
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
74 backend_(backend)
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
75 {
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
76 if (backend == NULL)
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
77 {
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
78 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
79 }
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
80 }
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
81
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
82 IDatabaseBackend& GetBackend() const
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
83 {
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
84 return *backend_;
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
85 }
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
86
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
87 void OpenConnection()
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
88 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
89 boost::mutex::scoped_lock lock(managerMutex_);
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
90
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
91 if (manager_.get() == NULL)
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
92 {
226
a4918d57435c DatabaseManager doesn't IDatabaseFactory anymore
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 225
diff changeset
93 manager_.reset(IndexBackend::CreateSingleDatabaseManager(*backend_));
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
94 }
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
95 else
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
96 {
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
97 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
98 }
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
99 }
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
100
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
101 void CloseConnection()
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
102 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
103 boost::mutex::scoped_lock lock(managerMutex_);
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
104
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
105 if (manager_.get() == NULL)
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
106 {
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
107 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
108 }
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
109 else
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
110 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
111 manager_->Close();
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
112 manager_.reset(NULL);
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
113 }
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
114 }
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
115
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
116 class DatabaseAccessor : public boost::noncopyable
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
117 {
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
118 private:
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
119 boost::mutex::scoped_lock lock_;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
120 DatabaseManager* manager_;
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
121
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
122 public:
252
33fa478c119a cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 229
diff changeset
123 explicit DatabaseAccessor(Adapter& adapter) :
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
124 lock_(adapter.managerMutex_),
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
125 manager_(adapter.manager_.get())
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
126 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
127 if (manager_ == NULL)
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
128 {
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
129 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
130 }
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
131 }
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
132
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
133 DatabaseManager& GetManager() const
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
134 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
135 assert(manager_ != NULL);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
136 return *manager_;
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
137 }
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
138 };
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
139 };
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
140
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
141
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 class DatabaseBackendAdapterV2::Output : public IDatabaseBackendOutput
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 public:
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 enum AllowedAnswers
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 AllowedAnswers_All,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 AllowedAnswers_None,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 AllowedAnswers_Attachment,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 AllowedAnswers_Change,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 AllowedAnswers_DicomTag,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 AllowedAnswers_ExportedResource,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 AllowedAnswers_MatchingResource,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 AllowedAnswers_String,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 AllowedAnswers_Metadata
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 };
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 private:
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 OrthancPluginContext* context_;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 OrthancPluginDatabaseContext* database_;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 AllowedAnswers allowedAnswers_;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 public:
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 Output(OrthancPluginContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 OrthancPluginDatabaseContext* database) :
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 context_(context),
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 database_(database),
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 allowedAnswers_(AllowedAnswers_All /* for unit tests */)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 void SetAllowedAnswers(AllowedAnswers allowed)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 allowedAnswers_ = allowed;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 OrthancPluginDatabaseContext* GetDatabase() const
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 return database_;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 virtual void SignalDeletedAttachment(const std::string& uuid,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 int32_t contentType,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 uint64_t uncompressedSize,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 const std::string& uncompressedHash,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 int32_t compressionType,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 uint64_t compressedSize,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 const std::string& compressedHash) ORTHANC_OVERRIDE
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 OrthancPluginAttachment attachment;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 attachment.uuid = uuid.c_str();
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 attachment.contentType = contentType;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 attachment.uncompressedSize = uncompressedSize;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 attachment.uncompressedHash = uncompressedHash.c_str();
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 attachment.compressionType = compressionType;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 attachment.compressedSize = compressedSize;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 attachment.compressedHash = compressedHash.c_str();
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 OrthancPluginDatabaseSignalDeletedAttachment(context_, database_, &attachment);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 virtual void SignalDeletedResource(const std::string& publicId,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 OrthancPluginResourceType resourceType) ORTHANC_OVERRIDE
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 OrthancPluginDatabaseSignalDeletedResource(context_, database_, publicId.c_str(), resourceType);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 virtual void SignalRemainingAncestor(const std::string& ancestorId,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 OrthancPluginResourceType ancestorType) ORTHANC_OVERRIDE
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 OrthancPluginDatabaseSignalRemainingAncestor(context_, database_, ancestorId.c_str(), ancestorType);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 virtual void AnswerAttachment(const std::string& uuid,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 int32_t contentType,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 uint64_t uncompressedSize,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 const std::string& uncompressedHash,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 int32_t compressionType,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 uint64_t compressedSize,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 const std::string& compressedHash) ORTHANC_OVERRIDE
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 if (allowedAnswers_ != AllowedAnswers_All &&
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 allowedAnswers_ != AllowedAnswers_Attachment)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 throw std::runtime_error("Cannot answer with an attachment in the current state");
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 OrthancPluginAttachment attachment;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 attachment.uuid = uuid.c_str();
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230 attachment.contentType = contentType;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 attachment.uncompressedSize = uncompressedSize;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 attachment.uncompressedHash = uncompressedHash.c_str();
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 attachment.compressionType = compressionType;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 attachment.compressedSize = compressedSize;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 attachment.compressedHash = compressedHash.c_str();
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 OrthancPluginDatabaseAnswerAttachment(context_, database_, &attachment);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 virtual void AnswerChange(int64_t seq,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 int32_t changeType,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 OrthancPluginResourceType resourceType,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 const std::string& publicId,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 const std::string& date) ORTHANC_OVERRIDE
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 if (allowedAnswers_ != AllowedAnswers_All &&
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 allowedAnswers_ != AllowedAnswers_Change)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 throw std::runtime_error("Cannot answer with a change in the current state");
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 OrthancPluginChange change;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 change.seq = seq;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 change.changeType = changeType;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 change.resourceType = resourceType;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 change.publicId = publicId.c_str();
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 change.date = date.c_str();
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 OrthancPluginDatabaseAnswerChange(context_, database_, &change);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 virtual void AnswerDicomTag(uint16_t group,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 uint16_t element,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 const std::string& value) ORTHANC_OVERRIDE
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 if (allowedAnswers_ != AllowedAnswers_All &&
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 allowedAnswers_ != AllowedAnswers_DicomTag)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 throw std::runtime_error("Cannot answer with a DICOM tag in the current state");
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272 OrthancPluginDicomTag tag;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 tag.group = group;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 tag.element = element;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 tag.value = value.c_str();
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 OrthancPluginDatabaseAnswerDicomTag(context_, database_, &tag);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 virtual void AnswerExportedResource(int64_t seq,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 OrthancPluginResourceType resourceType,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282 const std::string& publicId,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 const std::string& modality,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284 const std::string& date,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 const std::string& patientId,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286 const std::string& studyInstanceUid,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 const std::string& seriesInstanceUid,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 const std::string& sopInstanceUid) ORTHANC_OVERRIDE
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290 if (allowedAnswers_ != AllowedAnswers_All &&
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291 allowedAnswers_ != AllowedAnswers_ExportedResource)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 throw std::runtime_error("Cannot answer with an exported resource in the current state");
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296 OrthancPluginExportedResource exported;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297 exported.seq = seq;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298 exported.resourceType = resourceType;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 exported.publicId = publicId.c_str();
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300 exported.modality = modality.c_str();
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 exported.date = date.c_str();
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302 exported.patientId = patientId.c_str();
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303 exported.studyInstanceUid = studyInstanceUid.c_str();
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304 exported.seriesInstanceUid = seriesInstanceUid.c_str();
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305 exported.sopInstanceUid = sopInstanceUid.c_str();
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 OrthancPluginDatabaseAnswerExportedResource(context_, database_, &exported);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
310
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312 virtual void AnswerMatchingResource(const std::string& resourceId) ORTHANC_OVERRIDE
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
314 if (allowedAnswers_ != AllowedAnswers_All &&
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
315 allowedAnswers_ != AllowedAnswers_MatchingResource)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317 throw std::runtime_error("Cannot answer with an exported resource in the current state");
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
320 OrthancPluginMatchingResource match;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321 match.resourceId = resourceId.c_str();
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
322 match.someInstanceId = NULL;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
323
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
324 OrthancPluginDatabaseAnswerMatchingResource(context_, database_, &match);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326 #endif
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330 virtual void AnswerMatchingResource(const std::string& resourceId,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331 const std::string& someInstanceId) ORTHANC_OVERRIDE
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
332 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
333 if (allowedAnswers_ != AllowedAnswers_All &&
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334 allowedAnswers_ != AllowedAnswers_MatchingResource)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
335 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
336 throw std::runtime_error("Cannot answer with an exported resource in the current state");
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
339 OrthancPluginMatchingResource match;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
340 match.resourceId = resourceId.c_str();
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
341 match.someInstanceId = someInstanceId.c_str();
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
342
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
343 OrthancPluginDatabaseAnswerMatchingResource(context_, database_, &match);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
344 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
345 #endif
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346 };
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
347
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
348
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
349 static void LogError(IDatabaseBackend& backend,
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
350 const std::runtime_error& e)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
351 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352 const std::string message = "Exception in database back-end: " + std::string(e.what());
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
353 OrthancPluginLogError(backend.GetContext(), message.c_str());
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357 static OrthancPluginErrorCode AddAttachment(void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358 int64_t id,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359 const OrthancPluginAttachment* attachment)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
361 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
362
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
365 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
261
34e2b93a7ac1 implementing interface for revisions in attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 256
diff changeset
366 adapter->GetBackend().AddAttachment(accessor.GetManager(), id, *attachment,
34e2b93a7ac1 implementing interface for revisions in attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 256
diff changeset
367 0 /* revision number, unused in old API */);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
370 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
373
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374 static OrthancPluginErrorCode AttachChild(void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375 int64_t parent,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376 int64_t child)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
378 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
382 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
383 adapter->GetBackend().AttachChild(accessor.GetManager(), parent, child);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
386 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390 static OrthancPluginErrorCode ClearChanges(void* payload)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
392 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
393
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
396 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
397 adapter->GetBackend().ClearChanges(accessor.GetManager());
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
400 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
402
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
404 static OrthancPluginErrorCode ClearExportedResources(void* payload)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
405 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
406 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
407
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
408 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
409 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
410 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
411 adapter->GetBackend().ClearExportedResources(accessor.GetManager());
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
412 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
413 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
414 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
415 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
416
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
417
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
418 static OrthancPluginErrorCode CreateResource(int64_t* id,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
419 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
420 const char* publicId,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
421 OrthancPluginResourceType resourceType)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
422 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
423 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
424
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
425 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
426 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
427 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
428
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
429 *id = adapter->GetBackend().CreateResource(accessor.GetManager(), publicId, resourceType);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
430 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
431 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
432 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
433 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
434
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
435
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
436 static OrthancPluginErrorCode DeleteAttachment(void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
437 int64_t id,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
438 int32_t contentType)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
439 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
440 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
441 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
442 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_None);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
443
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
444 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
445 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
446 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
447 adapter->GetBackend().DeleteAttachment(*output, accessor.GetManager(), id, contentType);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
448 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
449 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
450 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
451 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
452
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
453
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
454 static OrthancPluginErrorCode DeleteMetadata(void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
455 int64_t id,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
456 int32_t metadataType)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
457 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
458 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
459
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
460 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
461 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
462 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
463 adapter->GetBackend().DeleteMetadata(accessor.GetManager(), id, metadataType);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
464 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
465 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
466 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
467 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
468
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
469
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
470 static OrthancPluginErrorCode DeleteResource(void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
471 int64_t id)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
472 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
473 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
474 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
475 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_None);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
476
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
477 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
478 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
479 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
480 adapter->GetBackend().DeleteResource(*output, accessor.GetManager(), id);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
481 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
482 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
483 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
484 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
485
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
486
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
487 static OrthancPluginErrorCode GetAllInternalIds(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
488 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
489 OrthancPluginResourceType resourceType)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
490 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
491 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
492 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
493 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_None);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
494
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
495 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
496 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
497 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
498
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
499 std::list<int64_t> target;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
500 adapter->GetBackend().GetAllInternalIds(target, accessor.GetManager(), resourceType);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
501
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
502 for (std::list<int64_t>::const_iterator
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
503 it = target.begin(); it != target.end(); ++it)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
504 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
505 OrthancPluginDatabaseAnswerInt64(adapter->GetBackend().GetContext(),
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
506 output->GetDatabase(), *it);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
507 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
508
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
509 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
510 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
511 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
512 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
513
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
514
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
515 static OrthancPluginErrorCode GetAllPublicIds(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
516 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
517 OrthancPluginResourceType resourceType)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
518 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
519 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
520 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
521 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_None);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
522
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
523 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
524 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
525 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
526
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
527 std::list<std::string> ids;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
528 adapter->GetBackend().GetAllPublicIds(ids, accessor.GetManager(), resourceType);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
529
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
530 for (std::list<std::string>::const_iterator
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
531 it = ids.begin(); it != ids.end(); ++it)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
532 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
533 OrthancPluginDatabaseAnswerString(adapter->GetBackend().GetContext(),
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
534 output->GetDatabase(),
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
535 it->c_str());
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
536 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
537
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
538 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
539 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
540 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
541 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
542
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
543
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
544 static OrthancPluginErrorCode GetAllPublicIdsWithLimit(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
545 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
546 OrthancPluginResourceType resourceType,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
547 uint64_t since,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
548 uint64_t limit)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
549 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
550 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
551 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
552 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_None);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
553
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
554 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
555 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
556 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
557
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
558 std::list<std::string> ids;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
559 adapter->GetBackend().GetAllPublicIds(ids, accessor.GetManager(), resourceType, since, limit);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
560
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
561 for (std::list<std::string>::const_iterator
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
562 it = ids.begin(); it != ids.end(); ++it)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
563 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
564 OrthancPluginDatabaseAnswerString(adapter->GetBackend().GetContext(),
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
565 output->GetDatabase(),
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
566 it->c_str());
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
567 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
568
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
569 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
570 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
571 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
572 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
573
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
574
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
575 static OrthancPluginErrorCode GetChanges(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
576 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
577 int64_t since,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
578 uint32_t maxResult)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
579 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
580 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
581 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
582 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_Change);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
583
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
584 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
585 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
586 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
587
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
588 bool done;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
589 adapter->GetBackend().GetChanges(*output, done, accessor.GetManager(), since, maxResult);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
590
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
591 if (done)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
592 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
593 OrthancPluginDatabaseAnswerChangesDone(adapter->GetBackend().GetContext(),
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
594 output->GetDatabase());
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
595 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
596
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
597 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
598 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
599 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
600 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
601
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
602
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
603 static OrthancPluginErrorCode GetChildrenInternalId(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
604 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
605 int64_t id)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
606 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
607 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
608 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
609 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_None);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
610
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
611 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
612 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
613 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
614
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
615 std::list<int64_t> target;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
616 adapter->GetBackend().GetChildrenInternalId(target, accessor.GetManager(), id);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
617
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
618 for (std::list<int64_t>::const_iterator
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
619 it = target.begin(); it != target.end(); ++it)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
620 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
621 OrthancPluginDatabaseAnswerInt64(adapter->GetBackend().GetContext(),
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
622 output->GetDatabase(), *it);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
623 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
624
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
625 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
626 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
627 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
628 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
629
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
630
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
631 static OrthancPluginErrorCode GetChildrenPublicId(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
632 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
633 int64_t id)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
634 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
635 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
636 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
637 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_None);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
638
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
639 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
640 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
641 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
642
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
643 std::list<std::string> ids;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
644 adapter->GetBackend().GetChildrenPublicId(ids, accessor.GetManager(), id);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
645
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
646 for (std::list<std::string>::const_iterator
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
647 it = ids.begin(); it != ids.end(); ++it)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
648 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
649 OrthancPluginDatabaseAnswerString(adapter->GetBackend().GetContext(),
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
650 output->GetDatabase(),
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
651 it->c_str());
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
652 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
653
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
654 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
655 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
656 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
657 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
658
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
659
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
660 static OrthancPluginErrorCode GetExportedResources(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
661 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
662 int64_t since,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
663 uint32_t maxResult)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
664 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
665 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
666 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
667 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_ExportedResource);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
668
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
669 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
670 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
671 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
672
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
673 bool done;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
674 adapter->GetBackend().GetExportedResources(*output, done, accessor.GetManager(), since, maxResult);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
675
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
676 if (done)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
677 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
678 OrthancPluginDatabaseAnswerExportedResourcesDone(adapter->GetBackend().GetContext(),
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
679 output->GetDatabase());
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
680 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
681 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
682 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
683 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
684 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
685
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
686
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
687 static OrthancPluginErrorCode GetLastChange(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
688 void* payload)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
689 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
690 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
691 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
692 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_Change);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
693
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
694 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
695 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
696 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
697 adapter->GetBackend().GetLastChange(*output, accessor.GetManager());
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
698 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
699 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
700 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
701 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
702
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
703
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
704 static OrthancPluginErrorCode GetLastExportedResource(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
705 void* payload)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
706 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
707 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
708 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
709 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_ExportedResource);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
710
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
711 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
712 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
713 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
714 adapter->GetBackend().GetLastExportedResource(*output, accessor.GetManager());
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
715 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
716 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
717 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
718 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
719
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
720
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
721 static OrthancPluginErrorCode GetMainDicomTags(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
722 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
723 int64_t id)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
724 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
725 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
726 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
727 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_DicomTag);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
728
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
729 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
730 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
731 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
732 adapter->GetBackend().GetMainDicomTags(*output, accessor.GetManager(), id);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
733 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
734 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
735 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
736 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
737
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
738
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
739 static OrthancPluginErrorCode GetPublicId(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
740 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
741 int64_t id)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
742 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
743 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
744 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
745 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_None);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
746
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
747 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
748 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
749 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
750
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
751 std::string s = adapter->GetBackend().GetPublicId(accessor.GetManager(), id);
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
752 OrthancPluginDatabaseAnswerString(adapter->GetBackend().GetContext(),
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
753 output->GetDatabase(),
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
754 s.c_str());
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
755
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
756 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
757 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
758 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
759 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
760
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
761
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
762 static OrthancPluginErrorCode GetResourceCount(uint64_t* target,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
763 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
764 OrthancPluginResourceType resourceType)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
765 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
766 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
767
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
768 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
769 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
770 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
771 *target = adapter->GetBackend().GetResourcesCount(accessor.GetManager(), resourceType);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
772 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
773 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
774 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
775 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
776
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
777
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
778 static OrthancPluginErrorCode GetResourceType(OrthancPluginResourceType* resourceType,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
779 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
780 int64_t id)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
781 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
782 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
783
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
784 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
785 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
786 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
787 *resourceType = adapter->GetBackend().GetResourceType(accessor.GetManager(), id);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
788 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
789 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
790 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
791 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
792
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
793
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
794 static OrthancPluginErrorCode GetTotalCompressedSize(uint64_t* target,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
795 void* payload)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
796 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
797 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
798
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
799 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
800 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
801 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
802 *target = adapter->GetBackend().GetTotalCompressedSize(accessor.GetManager());
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
803 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
804 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
805 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
806 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
807
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
808
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
809 static OrthancPluginErrorCode GetTotalUncompressedSize(uint64_t* target,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
810 void* payload)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
811 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
812 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
813
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
814 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
815 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
816 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
817 *target = adapter->GetBackend().GetTotalUncompressedSize(accessor.GetManager());
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
818 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
819 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
820 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
821 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
822
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
823
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
824 static OrthancPluginErrorCode IsExistingResource(int32_t* existing,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
825 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
826 int64_t id)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
827 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
828 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
829
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
830 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
831 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
832 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
833 *existing = adapter->GetBackend().IsExistingResource(accessor.GetManager(), id);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
834 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
835 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
836 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
837 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
838
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
839
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
840 static OrthancPluginErrorCode IsProtectedPatient(int32_t* isProtected,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
841 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
842 int64_t id)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
843 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
844 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
845
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
846 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
847 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
848 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
849 *isProtected = adapter->GetBackend().IsProtectedPatient(accessor.GetManager(), id);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
850 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
851 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
852 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
853 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
854
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
855
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
856 static OrthancPluginErrorCode ListAvailableMetadata(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
857 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
858 int64_t id)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
859 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
860 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
861 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
862 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_None);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
863
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
864 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
865 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
866 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
867
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
868 std::list<int32_t> target;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
869 adapter->GetBackend().ListAvailableMetadata(target, accessor.GetManager(), id);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
870
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
871 for (std::list<int32_t>::const_iterator
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
872 it = target.begin(); it != target.end(); ++it)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
873 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
874 OrthancPluginDatabaseAnswerInt32(adapter->GetBackend().GetContext(),
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
875 output->GetDatabase(),
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
876 *it);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
877 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
878
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
879 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
880 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
881 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
882 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
883
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
884
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
885 static OrthancPluginErrorCode ListAvailableAttachments(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
886 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
887 int64_t id)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
888 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
889 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
890 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
891 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_None);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
892
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
893 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
894 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
895 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
896
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
897 std::list<int32_t> target;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
898 adapter->GetBackend().ListAvailableAttachments(target, accessor.GetManager(), id);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
899
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
900 for (std::list<int32_t>::const_iterator
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
901 it = target.begin(); it != target.end(); ++it)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
902 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
903 OrthancPluginDatabaseAnswerInt32(adapter->GetBackend().GetContext(),
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
904 output->GetDatabase(),
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
905 *it);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
906 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
907
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
908 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
909 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
910 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
911 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
912
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
913
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
914 static OrthancPluginErrorCode LogChange(void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
915 const OrthancPluginChange* change)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
916 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
917 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
918
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
919 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
920 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
921 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
922
209
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
923 int64_t id;
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
924 OrthancPluginResourceType type;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
925 if (!adapter->GetBackend().LookupResource(id, type, accessor.GetManager(), change->publicId) ||
209
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
926 type != change->resourceType)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
927 {
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
928 throw Orthanc::OrthancException(Orthanc::ErrorCode_Database);
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
929 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
930 else
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
931 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
932 adapter->GetBackend().LogChange(accessor.GetManager(), change->changeType, id, type, change->date);
209
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
933 }
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
934
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
935 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
936 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
937 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
938 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
939
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
940
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
941 static OrthancPluginErrorCode LogExportedResource(void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
942 const OrthancPluginExportedResource* exported)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
943 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
944 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
945
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
946 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
947 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
948 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
378
9db9e0275ec0 refactoring IndexBackend::LogExportedResource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 373
diff changeset
949 adapter->GetBackend().LogExportedResource(accessor.GetManager(), exported->resourceType, exported->publicId,
9db9e0275ec0 refactoring IndexBackend::LogExportedResource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 373
diff changeset
950 exported->modality, exported->date, exported->patientId,
9db9e0275ec0 refactoring IndexBackend::LogExportedResource()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 373
diff changeset
951 exported->studyInstanceUid, exported->seriesInstanceUid, exported->sopInstanceUid);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
952 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
953 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
954 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
955 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
956
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
957
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
958 static OrthancPluginErrorCode LookupAttachment(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
959 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
960 int64_t id,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
961 int32_t contentType)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
962 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
963 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
964 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
965 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_Attachment);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
966
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
967 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
968 {
261
34e2b93a7ac1 implementing interface for revisions in attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 256
diff changeset
969 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
34e2b93a7ac1 implementing interface for revisions in attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 256
diff changeset
970 int64_t revision; // not handled in this API
34e2b93a7ac1 implementing interface for revisions in attachments
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 256
diff changeset
971 adapter->GetBackend().LookupAttachment(*output, revision, accessor.GetManager(), id, contentType);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
972 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
973 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
974 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
975 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
976
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
977
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
978 static OrthancPluginErrorCode LookupGlobalProperty(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
979 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
980 int32_t property)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
981 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
982 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
983 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
984 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_None);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
985
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
986 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
987 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
988 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
989
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
990 std::string s;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
991 if (adapter->GetBackend().LookupGlobalProperty(s, accessor.GetManager(), MISSING_SERVER_IDENTIFIER, property))
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
992 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
993 OrthancPluginDatabaseAnswerString(adapter->GetBackend().GetContext(),
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
994 output->GetDatabase(),
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
995 s.c_str());
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
996 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
997
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
998 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
999 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1000 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1001 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1002
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1003
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1004 static OrthancPluginErrorCode LookupIdentifier3(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1005 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1006 OrthancPluginResourceType resourceType,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1007 const OrthancPluginDicomTag* tag,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1008 OrthancPluginIdentifierConstraint constraint)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1009 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1010 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1011 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1012 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_None);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1013
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1014 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1015 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1016 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1017
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1018 std::list<int64_t> target;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1019 adapter->GetBackend().LookupIdentifier(target, accessor.GetManager(), resourceType,
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1020 tag->group, tag->element, constraint, tag->value);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1021
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1022 for (std::list<int64_t>::const_iterator
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1023 it = target.begin(); it != target.end(); ++it)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1024 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1025 OrthancPluginDatabaseAnswerInt64(adapter->GetBackend().GetContext(),
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1026 output->GetDatabase(), *it);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1027 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1028
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1029 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1030 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1031 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1032 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1033
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1034
271
6b18d3fbee82 backward compatibility with Orthanc SDK 0.9.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 261
diff changeset
1035 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE)
6b18d3fbee82 backward compatibility with Orthanc SDK 0.9.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 261
diff changeset
1036 # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 4, 0)
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1037 static OrthancPluginErrorCode LookupIdentifierRange(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1038 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1039 OrthancPluginResourceType resourceType,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1040 uint16_t group,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1041 uint16_t element,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1042 const char* start,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1043 const char* end)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1044 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1045 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1046 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1047 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_None);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1048
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1049 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1050 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1051 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1052
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1053 std::list<int64_t> target;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1054 adapter->GetBackend().LookupIdentifierRange(target, accessor.GetManager(), resourceType, group, element, start, end);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1055
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1056 for (std::list<int64_t>::const_iterator
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1057 it = target.begin(); it != target.end(); ++it)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1058 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1059 OrthancPluginDatabaseAnswerInt64(adapter->GetBackend().GetContext(),
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1060 output->GetDatabase(), *it);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1061 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1062
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1063 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1064 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1065 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1066 }
271
6b18d3fbee82 backward compatibility with Orthanc SDK 0.9.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 261
diff changeset
1067 # endif
6b18d3fbee82 backward compatibility with Orthanc SDK 0.9.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 261
diff changeset
1068 #endif
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1069
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1070
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1071 static OrthancPluginErrorCode LookupMetadata(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1072 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1073 int64_t id,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1074 int32_t metadata)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1075 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1076 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1077 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1078 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_None);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1079
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1080 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1081 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1082 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1083
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1084 std::string s;
256
e184dcadf163 handling of revisions in metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 252
diff changeset
1085 int64_t revision; // not handled in this API
e184dcadf163 handling of revisions in metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 252
diff changeset
1086 if (adapter->GetBackend().LookupMetadata(s, revision, accessor.GetManager(), id, metadata))
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1087 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1088 OrthancPluginDatabaseAnswerString(adapter->GetBackend().GetContext(),
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1089 output->GetDatabase(), s.c_str());
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1090 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1091
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1092 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1093 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1094 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1095 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1096
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1097
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1098 static OrthancPluginErrorCode LookupParent(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1099 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1100 int64_t id)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1101 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1102 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1103 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1104 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_None);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1105
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1106 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1107 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1108 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1109
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1110 int64_t parent;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1111 if (adapter->GetBackend().LookupParent(parent, accessor.GetManager(), id))
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1112 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1113 OrthancPluginDatabaseAnswerInt64(adapter->GetBackend().GetContext(),
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1114 output->GetDatabase(), parent);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1115 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1116
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1117 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1118 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1119 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1120 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1121
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1122
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1123 static OrthancPluginErrorCode LookupResource(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1124 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1125 const char* publicId)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1126 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1127 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1128 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1129 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_None);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1130
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1131 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1132 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1133 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1134
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1135 int64_t id;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1136 OrthancPluginResourceType type;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1137 if (adapter->GetBackend().LookupResource(id, type, accessor.GetManager(), publicId))
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1138 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1139 OrthancPluginDatabaseAnswerResource(adapter->GetBackend().GetContext(),
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1140 output->GetDatabase(),
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1141 id, type);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1142 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1143
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1144 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1145 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1146 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1147 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1148
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1149
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1150 static OrthancPluginErrorCode SelectPatientToRecycle(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1151 void* payload)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1152 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1153 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1154 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1155 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_None);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1156
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1157 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1158 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1159 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1160
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1161 int64_t id;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1162 if (adapter->GetBackend().SelectPatientToRecycle(id, accessor.GetManager()))
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1163 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1164 OrthancPluginDatabaseAnswerInt64(adapter->GetBackend().GetContext(),
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1165 output->GetDatabase(), id);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1166 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1167
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1168 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1169 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1170 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1171 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1172
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1173
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1174 static OrthancPluginErrorCode SelectPatientToRecycle2(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1175 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1176 int64_t patientIdToAvoid)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1177 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1178 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1179 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1180 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_None);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1181
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1182 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1183 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1184 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1185
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1186 int64_t id;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1187 if (adapter->GetBackend().SelectPatientToRecycle(id, accessor.GetManager(), patientIdToAvoid))
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1188 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1189 OrthancPluginDatabaseAnswerInt64(adapter->GetBackend().GetContext(),
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1190 output->GetDatabase(), id);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1191 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1192
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1193 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1194 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1195 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1196 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1197
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1198
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1199 static OrthancPluginErrorCode SetGlobalProperty(void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1200 int32_t property,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1201 const char* value)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1202 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1203 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1204
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1205 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1206 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1207 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1208 adapter->GetBackend().SetGlobalProperty(accessor.GetManager(), MISSING_SERVER_IDENTIFIER, property, value);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1209 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1210 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1211 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1212 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1213
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1214
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1215 static OrthancPluginErrorCode SetMainDicomTag(void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1216 int64_t id,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1217 const OrthancPluginDicomTag* tag)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1218 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1219 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1220
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1221 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1222 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1223 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1224 adapter->GetBackend().SetMainDicomTag(accessor.GetManager(), id, tag->group, tag->element, tag->value);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1225 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1226 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1227 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1228 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1229
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1230
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1231 static OrthancPluginErrorCode SetIdentifierTag(void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1232 int64_t id,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1233 const OrthancPluginDicomTag* tag)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1234 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1235 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1236
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1237 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1238 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1239 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1240 adapter->GetBackend().SetIdentifierTag(accessor.GetManager(), id, tag->group, tag->element, tag->value);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1241 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1242 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1243 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1244 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1245
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1246
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1247 static OrthancPluginErrorCode SetMetadata(void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1248 int64_t id,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1249 int32_t metadata,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1250 const char* value)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1251 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1252 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1253
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1254 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1255 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1256 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
256
e184dcadf163 handling of revisions in metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 252
diff changeset
1257 adapter->GetBackend().SetMetadata(accessor.GetManager(), id, metadata, value,
e184dcadf163 handling of revisions in metadata
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 252
diff changeset
1258 0 /* revision number, unused in old API */);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1259 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1260 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1261 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1262 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1263
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1264
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1265 static OrthancPluginErrorCode SetProtectedPatient(void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1266 int64_t id,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1267 int32_t isProtected)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1268 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1269 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1270
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1271 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1272 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1273 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1274 adapter->GetBackend().SetProtectedPatient(accessor.GetManager(), id, (isProtected != 0));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1275 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1276 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1277 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1278 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1279
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1280
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1281 static OrthancPluginErrorCode StartTransaction(void* payload)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1282 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1283 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1284
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1285 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1286 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1287 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1288 accessor.GetManager().StartTransaction(TransactionType_ReadWrite);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1289 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1290 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1291 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1292 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1293
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1294
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1295 static OrthancPluginErrorCode RollbackTransaction(void* payload)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1296 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1297 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1298
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1299 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1300 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1301 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1302 accessor.GetManager().RollbackTransaction();
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1303 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1304 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1305 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1306 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1307
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1308
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1309 static OrthancPluginErrorCode CommitTransaction(void* payload)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1310 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1311 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1312
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1313 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1314 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1315 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1316 accessor.GetManager().CommitTransaction();
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1317 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1318 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1319 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1320 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1321
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1322
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1323 static OrthancPluginErrorCode Open(void* payload)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1324 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1325 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1326
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1327 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1328 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1329 adapter->OpenConnection();
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1330 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1331 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1332 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1333 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1334
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1335
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1336 static OrthancPluginErrorCode Close(void* payload)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1337 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1338 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1339
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1340 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1341 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1342 adapter->CloseConnection();
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1343 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1344 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1345 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1346 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1347
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1348
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1349 static OrthancPluginErrorCode GetDatabaseVersion(uint32_t* version,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1350 void* payload)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1351 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1352 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1353
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1354 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1355 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1356 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1357 *version = adapter->GetBackend().GetDatabaseVersion(accessor.GetManager());
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1358 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1359 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1360 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1361 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1362
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1363
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1364 static OrthancPluginErrorCode UpgradeDatabase(void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1365 uint32_t targetVersion,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1366 OrthancPluginStorageArea* storageArea)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1367 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1368 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1369
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1370 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1371 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1372 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1373 adapter->GetBackend().UpgradeDatabase(accessor.GetManager(), targetVersion, storageArea);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1374 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1375 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1376 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1377 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1378
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1379
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1380 static OrthancPluginErrorCode ClearMainDicomTags(void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1381 int64_t internalId)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1382 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1383 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1384
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1385 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1386 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1387 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1388 adapter->GetBackend().ClearMainDicomTags(accessor.GetManager(), internalId);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1389 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1390 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1391 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1392 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1393
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1394
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1395 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1396 /* Use GetOutput().AnswerResource() */
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1397 static OrthancPluginErrorCode LookupResources(
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1398 OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1399 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1400 uint32_t constraintsCount,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1401 const OrthancPluginDatabaseConstraint* constraints,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1402 OrthancPluginResourceType queryLevel,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1403 uint32_t limit,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1404 uint8_t requestSomeInstance)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1405 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1406 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1407 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1408 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_MatchingResource);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1409
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1410 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1411 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1412 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1413
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1414 std::vector<Orthanc::DatabaseConstraint> lookup;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1415 lookup.reserve(constraintsCount);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1416
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1417 for (uint32_t i = 0; i < constraintsCount; i++)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1418 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1419 lookup.push_back(Orthanc::DatabaseConstraint(constraints[i]));
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1420 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1421
391
d14e6ff04a5c added primitives to handle labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 389
diff changeset
1422 std::set<std::string> noLabels;
d14e6ff04a5c added primitives to handle labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 389
diff changeset
1423 adapter->GetBackend().LookupResources(*output, accessor.GetManager(), lookup, queryLevel,
d14e6ff04a5c added primitives to handle labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 389
diff changeset
1424 noLabels, noLabels, limit, (requestSomeInstance != 0));
d14e6ff04a5c added primitives to handle labels
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 389
diff changeset
1425
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1426 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1427 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1428 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1429 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1430 #endif
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1431
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1432
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1433 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1434 static OrthancPluginErrorCode CreateInstance(OrthancPluginCreateInstanceResult* target,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1435 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1436 const char* hashPatient,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1437 const char* hashStudy,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1438 const char* hashSeries,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1439 const char* hashInstance)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1440 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1441 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1442
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1443 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1444 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1445 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1446 adapter->GetBackend().CreateInstance(*target, accessor.GetManager(), hashPatient, hashStudy, hashSeries, hashInstance);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1447 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1448 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1449 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1450 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1451 #endif
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1452
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1453
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1454 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1455 static OrthancPluginErrorCode SetResourcesContent(
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1456 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1457 uint32_t countIdentifierTags,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1458 const OrthancPluginResourcesContentTags* identifierTags,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1459 uint32_t countMainDicomTags,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1460 const OrthancPluginResourcesContentTags* mainDicomTags,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1461 uint32_t countMetadata,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1462 const OrthancPluginResourcesContentMetadata* metadata)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1463 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1464 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1465
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1466 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1467 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1468 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1469 adapter->GetBackend().SetResourcesContent(accessor.GetManager(), countIdentifierTags, identifierTags,
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1470 countMainDicomTags, mainDicomTags, countMetadata, metadata);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1471 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1472 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1473 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1474 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1475 #endif
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1476
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1477
271
6b18d3fbee82 backward compatibility with Orthanc SDK 0.9.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 261
diff changeset
1478 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE)
6b18d3fbee82 backward compatibility with Orthanc SDK 0.9.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 261
diff changeset
1479 # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 2)
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1480 // New primitive since Orthanc 1.5.2
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1481 static OrthancPluginErrorCode GetChildrenMetadata(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1482 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1483 int64_t resourceId,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1484 int32_t metadata)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1485 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1486 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1487 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1488 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_None);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1489
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1490 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1491 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1492 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1493
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1494 std::list<std::string> values;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1495 adapter->GetBackend().GetChildrenMetadata(values, accessor.GetManager(), resourceId, metadata);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1496
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1497 for (std::list<std::string>::const_iterator
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1498 it = values.begin(); it != values.end(); ++it)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1499 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1500 OrthancPluginDatabaseAnswerString(adapter->GetBackend().GetContext(),
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1501 output->GetDatabase(),
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1502 it->c_str());
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1503 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1504
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1505 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1506 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1507 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1508 }
271
6b18d3fbee82 backward compatibility with Orthanc SDK 0.9.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 261
diff changeset
1509 # endif
6b18d3fbee82 backward compatibility with Orthanc SDK 0.9.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 261
diff changeset
1510 #endif
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1511
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1512
271
6b18d3fbee82 backward compatibility with Orthanc SDK 0.9.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 261
diff changeset
1513 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE)
6b18d3fbee82 backward compatibility with Orthanc SDK 0.9.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 261
diff changeset
1514 # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 2)
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1515 // New primitive since Orthanc 1.5.2
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1516 static OrthancPluginErrorCode GetLastChangeIndex(int64_t* result,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1517 void* payload)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1518 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1519 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1520
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1521 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1522 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1523 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1524 *result = adapter->GetBackend().GetLastChangeIndex(accessor.GetManager());
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1525 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1526 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1527 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1528 }
271
6b18d3fbee82 backward compatibility with Orthanc SDK 0.9.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 261
diff changeset
1529 # endif
6b18d3fbee82 backward compatibility with Orthanc SDK 0.9.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 261
diff changeset
1530 #endif
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1531
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1532
271
6b18d3fbee82 backward compatibility with Orthanc SDK 0.9.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 261
diff changeset
1533 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE)
6b18d3fbee82 backward compatibility with Orthanc SDK 0.9.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 261
diff changeset
1534 # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 2)
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1535 // New primitive since Orthanc 1.5.2
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1536 static OrthancPluginErrorCode TagMostRecentPatient(void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1537 int64_t patientId)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1538 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1539 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1540
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1541 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1542 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1543 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1544 adapter->GetBackend().TagMostRecentPatient(accessor.GetManager(), patientId);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1545 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1546 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1547 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1548 }
271
6b18d3fbee82 backward compatibility with Orthanc SDK 0.9.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 261
diff changeset
1549 # endif
6b18d3fbee82 backward compatibility with Orthanc SDK 0.9.5
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 261
diff changeset
1550 #endif
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1551
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1552
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1553 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in 1.3.1
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1554 # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 4)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1555 // New primitive since Orthanc 1.5.4
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1556 static OrthancPluginErrorCode GetAllMetadata(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1557 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1558 int64_t resourceId)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1559 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1560 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1561 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1562 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_Metadata);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1563
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1564 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1565 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1566 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1567
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1568 std::map<int32_t, std::string> result;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1569 adapter->GetBackend().GetAllMetadata(result, accessor.GetManager(), resourceId);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1570
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1571 for (std::map<int32_t, std::string>::const_iterator
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1572 it = result.begin(); it != result.end(); ++it)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1573 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1574 OrthancPluginDatabaseAnswerMetadata(adapter->GetBackend().GetContext(),
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1575 output->GetDatabase(),
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1576 resourceId, it->first, it->second.c_str());
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1577 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1578
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1579 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1580 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1581 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1582 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1583 # endif
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1584 #endif
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1585
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1586
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1587 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in 1.3.1
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1588 # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 4)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1589 // New primitive since Orthanc 1.5.4
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1590 static OrthancPluginErrorCode LookupResourceAndParent(OrthancPluginDatabaseContext* context,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1591 uint8_t* isExisting,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1592 int64_t* id,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1593 OrthancPluginResourceType* type,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1594 void* payload,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1595 const char* publicId)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1596 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1597 DatabaseBackendAdapterV2::Adapter* adapter = reinterpret_cast<DatabaseBackendAdapterV2::Adapter*>(payload);
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1598 std::unique_ptr<DatabaseBackendAdapterV2::Output> output(dynamic_cast<DatabaseBackendAdapterV2::Output*>(adapter->GetBackend().CreateOutput()));
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1599 output->SetAllowedAnswers(DatabaseBackendAdapterV2::Output::AllowedAnswers_String);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1600
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1601 try
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1602 {
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1603 DatabaseBackendAdapterV2::Adapter::DatabaseAccessor accessor(*adapter);
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1604
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1605 std::string parent;
225
94c9908e6aca removed DatabaseManager member out of class IndexBackend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 224
diff changeset
1606 if (adapter->GetBackend().LookupResourceAndParent(*id, *type, parent, accessor.GetManager(), publicId))
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1607 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1608 *isExisting = 1;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1609
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1610 if (!parent.empty())
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1611 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1612 OrthancPluginDatabaseAnswerString(adapter->GetBackend().GetContext(),
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1613 output->GetDatabase(),
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1614 parent.c_str());
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1615 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1616 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1617 else
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1618 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1619 *isExisting = 0;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1620 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1621
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1622 return OrthancPluginErrorCode_Success;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1623 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1624 ORTHANC_PLUGINS_DATABASE_CATCH;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1625 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1626 # endif
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1627 #endif
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1628
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1629
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1630 IDatabaseBackendOutput* DatabaseBackendAdapterV2::Factory::CreateOutput()
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1631 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1632 return new Output(context_, database_);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1633 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1634
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1635
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1636 static std::unique_ptr<DatabaseBackendAdapterV2::Adapter> adapter_;
222
c8e06b41feec refactoring registration/finalization of index backend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 221
diff changeset
1637
c8e06b41feec refactoring registration/finalization of index backend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 221
diff changeset
1638 void DatabaseBackendAdapterV2::Register(IDatabaseBackend* backend)
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1639 {
222
c8e06b41feec refactoring registration/finalization of index backend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 221
diff changeset
1640 {
373
be7de633695c started DatabaseBackendAdapterV4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 359
diff changeset
1641 std::unique_ptr<IDatabaseBackend> protection(backend);
be7de633695c started DatabaseBackendAdapterV4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 359
diff changeset
1642
be7de633695c started DatabaseBackendAdapterV4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 359
diff changeset
1643 if (backend == NULL)
be7de633695c started DatabaseBackendAdapterV4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 359
diff changeset
1644 {
be7de633695c started DatabaseBackendAdapterV4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 359
diff changeset
1645 throw Orthanc::OrthancException(Orthanc::ErrorCode_NullPointer);
be7de633695c started DatabaseBackendAdapterV4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 359
diff changeset
1646 }
222
c8e06b41feec refactoring registration/finalization of index backend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 221
diff changeset
1647
373
be7de633695c started DatabaseBackendAdapterV4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 359
diff changeset
1648 if (adapter_.get() != NULL)
be7de633695c started DatabaseBackendAdapterV4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 359
diff changeset
1649 {
be7de633695c started DatabaseBackendAdapterV4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 359
diff changeset
1650 throw Orthanc::OrthancException(Orthanc::ErrorCode_BadSequenceOfCalls);
be7de633695c started DatabaseBackendAdapterV4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 359
diff changeset
1651 }
be7de633695c started DatabaseBackendAdapterV4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 359
diff changeset
1652
be7de633695c started DatabaseBackendAdapterV4
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 359
diff changeset
1653 adapter_.reset(new Adapter(protection.release()));
222
c8e06b41feec refactoring registration/finalization of index backend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 221
diff changeset
1654 }
c8e06b41feec refactoring registration/finalization of index backend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 221
diff changeset
1655
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1656 OrthancPluginDatabaseBackend params;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1657 memset(&params, 0, sizeof(params));
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1658
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1659 OrthancPluginDatabaseExtensions extensions;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1660 memset(&extensions, 0, sizeof(extensions));
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1661
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1662 params.addAttachment = AddAttachment;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1663 params.attachChild = AttachChild;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1664 params.clearChanges = ClearChanges;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1665 params.clearExportedResources = ClearExportedResources;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1666 params.createResource = CreateResource;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1667 params.deleteAttachment = DeleteAttachment;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1668 params.deleteMetadata = DeleteMetadata;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1669 params.deleteResource = DeleteResource;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1670 params.getAllPublicIds = GetAllPublicIds;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1671 params.getChanges = GetChanges;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1672 params.getChildrenInternalId = GetChildrenInternalId;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1673 params.getChildrenPublicId = GetChildrenPublicId;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1674 params.getExportedResources = GetExportedResources;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1675 params.getLastChange = GetLastChange;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1676 params.getLastExportedResource = GetLastExportedResource;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1677 params.getMainDicomTags = GetMainDicomTags;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1678 params.getPublicId = GetPublicId;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1679 params.getResourceCount = GetResourceCount;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1680 params.getResourceType = GetResourceType;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1681 params.getTotalCompressedSize = GetTotalCompressedSize;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1682 params.getTotalUncompressedSize = GetTotalUncompressedSize;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1683 params.isExistingResource = IsExistingResource;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1684 params.isProtectedPatient = IsProtectedPatient;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1685 params.listAvailableMetadata = ListAvailableMetadata;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1686 params.listAvailableAttachments = ListAvailableAttachments;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1687 params.logChange = LogChange;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1688 params.logExportedResource = LogExportedResource;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1689 params.lookupAttachment = LookupAttachment;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1690 params.lookupGlobalProperty = LookupGlobalProperty;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1691 params.lookupIdentifier = NULL; // Unused starting with Orthanc 0.9.5 (db v6)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1692 params.lookupIdentifier2 = NULL; // Unused starting with Orthanc 0.9.5 (db v6)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1693 params.lookupMetadata = LookupMetadata;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1694 params.lookupParent = LookupParent;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1695 params.lookupResource = LookupResource;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1696 params.selectPatientToRecycle = SelectPatientToRecycle;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1697 params.selectPatientToRecycle2 = SelectPatientToRecycle2;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1698 params.setGlobalProperty = SetGlobalProperty;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1699 params.setMainDicomTag = SetMainDicomTag;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1700 params.setIdentifierTag = SetIdentifierTag;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1701 params.setMetadata = SetMetadata;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1702 params.setProtectedPatient = SetProtectedPatient;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1703 params.startTransaction = StartTransaction;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1704 params.rollbackTransaction = RollbackTransaction;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1705 params.commitTransaction = CommitTransaction;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1706 params.open = Open;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1707 params.close = Close;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1708
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1709 extensions.getAllPublicIdsWithLimit = GetAllPublicIdsWithLimit;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1710 extensions.getDatabaseVersion = GetDatabaseVersion;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1711 extensions.upgradeDatabase = UpgradeDatabase;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1712 extensions.clearMainDicomTags = ClearMainDicomTags;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1713 extensions.getAllInternalIds = GetAllInternalIds; // New in Orthanc 0.9.5 (db v6)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1714 extensions.lookupIdentifier3 = LookupIdentifier3; // New in Orthanc 0.9.5 (db v6)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1715
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1716 bool performanceWarning = true;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1717
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1718 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in Orthanc 1.3.1
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1719 # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 4, 0)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1720 extensions.lookupIdentifierRange = LookupIdentifierRange; // New in Orthanc 1.4.0
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1721 # endif
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1722 #endif
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1723
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1724 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1725 // Optimizations brought by Orthanc 1.5.2
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1726 extensions.lookupResources = LookupResources; // Fast lookup
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1727 extensions.setResourcesContent = SetResourcesContent; // Fast setting tags/metadata
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1728 extensions.getChildrenMetadata = GetChildrenMetadata;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1729 extensions.getLastChangeIndex = GetLastChangeIndex;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1730 extensions.tagMostRecentPatient = TagMostRecentPatient;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1731
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1732 if (adapter_->GetBackend().HasCreateInstance())
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1733 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1734 extensions.createInstance = CreateInstance; // Fast creation of resources
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1735 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1736 #endif
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1737
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1738 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in 1.3.1
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1739 # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 4)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1740 // Optimizations brought by Orthanc 1.5.4
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1741 extensions.lookupResourceAndParent = LookupResourceAndParent;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1742 extensions.getAllMetadata = GetAllMetadata;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1743 performanceWarning = false;
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1744 # endif
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1745 #endif
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1746
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1747 OrthancPluginContext* context = adapter_->GetBackend().GetContext();
207
d9ef3f16e6a2 wrapping transactions in API v3
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 205
diff changeset
1748
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1749 if (performanceWarning)
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1750 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1751 char info[1024];
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1752 sprintf(info,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1753 "Performance warning: The database index plugin was compiled "
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1754 "against an old version of the Orthanc SDK (%d.%d.%d): "
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1755 "Consider upgrading to version %d.%d.%d of the Orthanc SDK",
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1756 ORTHANC_PLUGINS_MINIMAL_MAJOR_NUMBER,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1757 ORTHANC_PLUGINS_MINIMAL_MINOR_NUMBER,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1758 ORTHANC_PLUGINS_MINIMAL_REVISION_NUMBER,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1759 ORTHANC_OPTIMAL_VERSION_MAJOR,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1760 ORTHANC_OPTIMAL_VERSION_MINOR,
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1761 ORTHANC_OPTIMAL_VERSION_REVISION);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1762
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1763 OrthancPluginLogWarning(context, info);
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1764 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1765
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1766 OrthancPluginDatabaseContext* database =
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1767 OrthancPluginRegisterDatabaseBackendV2(context, &params, &extensions, adapter_.get());
207
d9ef3f16e6a2 wrapping transactions in API v3
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 205
diff changeset
1768 if (database == NULL)
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1769 {
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1770 throw std::runtime_error("Unable to register the database backend");
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1771 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1772
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1773 adapter_->GetBackend().SetOutputFactory(new Factory(context, database));
222
c8e06b41feec refactoring registration/finalization of index backend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 221
diff changeset
1774 }
c8e06b41feec refactoring registration/finalization of index backend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 221
diff changeset
1775
c8e06b41feec refactoring registration/finalization of index backend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 221
diff changeset
1776
c8e06b41feec refactoring registration/finalization of index backend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 221
diff changeset
1777 void DatabaseBackendAdapterV2::Finalize()
c8e06b41feec refactoring registration/finalization of index backend
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 221
diff changeset
1778 {
224
61c309e06797 added internal class DatabaseBackendAdapterV2::Adapter
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 222
diff changeset
1779 adapter_.reset(NULL);
205
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1780 }
873e37048f96 renaming OrthancCppDatabasePlugin.h as DatabaseBackendAdapterV2.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1781 }