comparison OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.h @ 5810:1f6642c04541 attach-custom-data

fix
author Alain Mazy <am@orthanc.team>
date Tue, 24 Sep 2024 15:15:51 +0200
parents 023a99146dd0
children a451777236fb
comparison
equal deleted inserted replaced
5809:023a99146dd0 5810:1f6642c04541
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium 5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium 6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium 7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
8 * 8 *
9 * This program is free software: you can redistribute it and/or 9 * This program is free software: you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as 10 * modify it under the terms of the GNU Affero General Public License
11 * published by the Free Software Foundation, either version 3 of the 11 * as published by the Free Software Foundation, either version 3 of
12 * License, or (at your option) any later version. 12 * the License, or (at your option) any later version.
13 * 13 *
14 * This program is distributed in the hope that it will be useful, but 14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of 15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details. 17 * Affero General Public License for more details.
18 * 18 *
19 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU Affero General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>. 20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 **/ 21 **/
22 22
23 23
24
24 #pragma once 25 #pragma once
25 26
26 #if ORTHANC_ENABLE_PLUGINS == 1 27 #include "IndexBackend.h"
27 28
28 #include "../../../OrthancFramework/Sources/SharedLibrary.h"
29 #include "../../Sources/Database/IDatabaseWrapper.h"
30 #include "../Include/orthanc/OrthancCPlugin.h"
31 #include "PluginsErrorDictionary.h"
32 29
33 namespace Orthanc 30 #if defined(ORTHANC_PLUGINS_VERSION_IS_ABOVE) // Macro introduced in Orthanc 1.3.1
34 { 31 # if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 12, 0)
35 class OrthancPluginDatabaseV4 : public IDatabaseWrapper 32
33 namespace OrthancDatabases
34 {
35 /**
36 * @brief Bridge between C and C++ database engines.
37 *
38 * Class creating the bridge between the C low-level primitives for
39 * custom database engines, and the high-level IDatabaseBackend C++
40 * interface, through ProtocolBuffers for Orthanc >= 1.12.0.
41 **/
42 class DatabaseBackendAdapterV4
36 { 43 {
37 private: 44 private:
38 class Transaction; 45 // This class cannot be instantiated
39 46 DatabaseBackendAdapterV4()
40 SharedLibrary& library_; 47 {
41 PluginsErrorDictionary& errorDictionary_; 48 }
42 _OrthancPluginRegisterDatabaseBackendV4 definition_;
43 std::string serverIdentifier_;
44 bool open_;
45 unsigned int databaseVersion_;
46 IDatabaseWrapper::Capabilities dbCapabilities_;
47
48 void CheckSuccess(OrthancPluginErrorCode code) const;
49 49
50 public: 50 public:
51 OrthancPluginDatabaseV4(SharedLibrary& library, 51 static void Register(IndexBackend* backend,
52 PluginsErrorDictionary& errorDictionary, 52 size_t countConnections,
53 const _OrthancPluginRegisterDatabaseBackendV4& database, 53 unsigned int maxDatabaseRetries);
54 const std::string& serverIdentifier);
55 54
56 virtual ~OrthancPluginDatabaseV4(); 55 static void Finalize();
57
58 const _OrthancPluginRegisterDatabaseBackendV4& GetDefinition() const
59 {
60 return definition_;
61 }
62
63 PluginsErrorDictionary& GetErrorDictionary() const
64 {
65 return errorDictionary_;
66 }
67
68 const std::string& GetServerIdentifier() const
69 {
70 return serverIdentifier_;
71 }
72
73 virtual void Open() ORTHANC_OVERRIDE;
74
75 virtual void Close() ORTHANC_OVERRIDE;
76
77 const SharedLibrary& GetSharedLibrary() const
78 {
79 return library_;
80 }
81
82 virtual void FlushToDisk() ORTHANC_OVERRIDE;
83
84 virtual IDatabaseWrapper::ITransaction* StartTransaction(TransactionType type,
85 IDatabaseListener& listener)
86 ORTHANC_OVERRIDE;
87
88 virtual unsigned int GetDatabaseVersion() ORTHANC_OVERRIDE;
89
90 virtual void Upgrade(unsigned int targetVersion,
91 IStorageArea& storageArea) ORTHANC_OVERRIDE;
92
93 virtual uint64_t MeasureLatency() ORTHANC_OVERRIDE;
94
95 virtual const Capabilities GetDatabaseCapabilities() const ORTHANC_OVERRIDE;
96
97 virtual bool HasIntegratedFind() const ORTHANC_OVERRIDE;
98 }; 56 };
99 } 57 }
100 58
59 # endif
101 #endif 60 #endif