0
|
1 /**
|
|
2 * Palantir - A Lightweight, RESTful DICOM Store
|
|
3 * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
|
|
4 * Belgium
|
|
5 *
|
|
6 * This program is free software: you can redistribute it and/or
|
|
7 * modify it under the terms of the GNU General Public License as
|
|
8 * published by the Free Software Foundation, either version 3 of the
|
|
9 * License, or (at your option) any later version.
|
|
10 *
|
|
11 * This program is distributed in the hope that it will be useful, but
|
|
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14 * General Public License for more details.
|
|
15 *
|
|
16 * You should have received a copy of the GNU General Public License
|
|
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
18 **/
|
|
19
|
|
20
|
|
21 #include "BufferCompressor.h"
|
|
22
|
|
23 namespace Palantir
|
|
24 {
|
|
25 void BufferCompressor::Compress(std::string& output,
|
|
26 const std::vector<uint8_t>& input)
|
|
27 {
|
|
28 if (input.size() > 0)
|
|
29 Compress(output, &input[0], input.size());
|
|
30 else
|
|
31 Compress(output, NULL, 0);
|
|
32 }
|
|
33
|
|
34 void BufferCompressor::Uncompress(std::string& output,
|
|
35 const std::vector<uint8_t>& input)
|
|
36 {
|
|
37 if (input.size() > 0)
|
|
38 Uncompress(output, &input[0], input.size());
|
|
39 else
|
|
40 Uncompress(output, NULL, 0);
|
|
41 }
|
|
42
|
|
43 void BufferCompressor::Compress(std::string& output,
|
|
44 const std::string& input)
|
|
45 {
|
|
46 if (input.size() > 0)
|
|
47 Compress(output, &input[0], input.size());
|
|
48 else
|
|
49 Compress(output, NULL, 0);
|
|
50 }
|
|
51
|
|
52 void BufferCompressor::Uncompress(std::string& output,
|
|
53 const std::string& input)
|
|
54 {
|
|
55 if (input.size() > 0)
|
|
56 Uncompress(output, &input[0], input.size());
|
|
57 else
|
|
58 Uncompress(output, NULL, 0);
|
|
59 }
|
|
60 }
|