comparison Framework/Plugins/StorageAreaBuffer.h @ 194:a51ce147dbe0

refactoring using new class StorageAreaBuffer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 08 Jan 2021 14:40:03 +0100
parents
children 53bd9022c58b
comparison
equal deleted inserted replaced
193:3236894320d6 194:a51ce147dbe0
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-2021 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 <orthanc/OrthancCPlugin.h>
25
26 #include <boost/noncopyable.hpp>
27 #include <string>
28
29
30 namespace OrthancDatabases
31 {
32 class StorageAreaBuffer : public boost::noncopyable
33 {
34 private:
35 void* data_;
36 int64_t size_;
37
38 public:
39 StorageAreaBuffer();
40
41 ~StorageAreaBuffer()
42 {
43 Clear();
44 }
45
46 void Clear();
47
48 void Assign(const std::string& content);
49
50 int64_t GetSize() const
51 {
52 return size_;
53 }
54
55 const void* GetData() const
56 {
57 return data_;
58 }
59
60 void* ReleaseData();
61
62 void ToString(std::string& target);
63 };
64 }