Mercurial > hg > orthanc
annotate OrthancFramework/Sources/Compression/IBufferCompressor.cpp @ 4437:d9473bd5ed43
upgrade to year 2021
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 06 Jan 2021 17:27:28 +0100 |
parents | 3b70a2e6a06c |
children | 7053502fbf97 |
rev | line source |
---|---|
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
4437
d9473bd5ed43
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4296
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public License |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 * Lesser General Public License for more details. |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 * |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 * License along with this program. If not, see |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 * <http://www.gnu.org/licenses/>. |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 **/ |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 #include "../PrecompiledHeaders.h" |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #include "IBufferCompressor.h" |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 namespace Orthanc |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 void IBufferCompressor::Compress(std::string& compressed, |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 IBufferCompressor& compressor, |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 const std::string& uncompressed) |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 compressor.Compress(compressed, |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 uncompressed.size() == 0 ? NULL : uncompressed.c_str(), |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 uncompressed.size()); |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
37 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 void IBufferCompressor::Uncompress(std::string& uncompressed, |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 IBufferCompressor& compressor, |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 const std::string& compressed) |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
42 compressor.Uncompress(uncompressed, |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
43 compressed.size() == 0 ? NULL : compressed.c_str(), |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 compressed.size()); |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 } |