comparison Framework/Plugins/StorageBackend.h @ 1:d17b2631bb67

starting StorageBackend
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 04 Jul 2018 18:05:24 +0200
parents
children 41543239072d
comparison
equal deleted inserted replaced
0:7cea966b6829 1:d17b2631bb67
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-2018 Osimis S.A., Belgium
6 *
7 * This program is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU Affero General Public License
9 * as published by the Free Software Foundation, either version 3 of
10 * the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Affero General Public License for more details.
16 *
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 **/
20
21
22 #pragma once
23
24 #include "../Common/DatabaseManager.h"
25 #include <orthanc/OrthancCDatabasePlugin.h>
26
27
28 namespace OrthancDatabases
29 {
30 class StorageBackend : public boost::noncopyable
31 {
32 private:
33 DatabaseManager manager_;
34
35 protected:
36 DatabaseManager& GetManager()
37 {
38 return manager_;
39 }
40
41 public:
42 StorageBackend(IDatabaseFactory* factory);
43
44 virtual ~StorageBackend()
45 {
46 }
47
48 // WARNING: These methods can possibly be invoked simultaneously
49 // (no mutual exclusion in the storage area plugins)
50 virtual void Create(const std::string& uuid,
51 const void* content,
52 size_t size,
53 OrthancPluginContentType type) = 0;
54
55 virtual void Read(void*& content,
56 size_t& size,
57 const std::string& uuid,
58 OrthancPluginContentType type) = 0;
59
60 virtual void Remove(const std::string& uuid,
61 OrthancPluginContentType type) = 0;
62
63 static void Register(OrthancPluginContext* context,
64 StorageBackend* backend); // Takes ownership
65
66 static void Finalize();
67 };
68 }