comparison OrthancServer/Plugins/Engine/OrthancPluginDatabaseV4.h @ 5207:e7529e6241d2 db-protobuf

first successful protobuf communication
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 30 Mar 2023 21:31:56 +0200
parents
children 154d37a56500
comparison
equal deleted inserted replaced
5206:fb3add662286 5207:e7529e6241d2
1 /**
2 * Orthanc - A Lightweight, RESTful DICOM Store
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
6 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
7 *
8 * This program is free software: you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation, either version 3 of the
11 * License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 **/
21
22
23 #pragma once
24
25 #if ORTHANC_ENABLE_PLUGINS == 1
26
27 #include "../../../OrthancFramework/Sources/SharedLibrary.h"
28 #include "../../Sources/Database/IDatabaseWrapper.h"
29 #include "../Include/orthanc/OrthancCPlugin.h"
30 #include "PluginsErrorDictionary.h"
31
32 namespace Orthanc
33 {
34 class OrthancPluginDatabaseV4 : public IDatabaseWrapper
35 {
36 private:
37 class Transaction;
38
39 SharedLibrary& library_;
40 PluginsErrorDictionary& errorDictionary_;
41 _OrthancPluginRegisterDatabaseBackendV4 database_;
42 std::string serverIdentifier_;
43 bool open_;
44 unsigned int databaseVersion_;
45 bool hasFlushToDisk_;
46 bool hasRevisionsSupport_;
47
48 void CheckSuccess(OrthancPluginErrorCode code) const;
49
50 public:
51 OrthancPluginDatabaseV4(SharedLibrary& library,
52 PluginsErrorDictionary& errorDictionary,
53 const _OrthancPluginRegisterDatabaseBackendV4& database,
54 const std::string& serverIdentifier);
55
56 virtual ~OrthancPluginDatabaseV4();
57
58 virtual void Open() ORTHANC_OVERRIDE;
59
60 virtual void Close() ORTHANC_OVERRIDE;
61
62 const SharedLibrary& GetSharedLibrary() const
63 {
64 return library_;
65 }
66
67 virtual void FlushToDisk() ORTHANC_OVERRIDE;
68
69 virtual bool HasFlushToDisk() const ORTHANC_OVERRIDE;
70
71 virtual IDatabaseWrapper::ITransaction* StartTransaction(TransactionType type,
72 IDatabaseListener& listener)
73 ORTHANC_OVERRIDE;
74
75 virtual unsigned int GetDatabaseVersion() ORTHANC_OVERRIDE;
76
77 virtual void Upgrade(unsigned int targetVersion,
78 IStorageArea& storageArea) ORTHANC_OVERRIDE;
79
80 virtual bool HasRevisionsSupport() const ORTHANC_OVERRIDE;
81 };
82 }
83
84 #endif