1 | /** |
2 | * Licensed to the Apache Software Foundation (ASF) under one |
3 | * or more contributor license agreements. See the NOTICE file |
4 | * distributed with this work for additional information |
5 | * regarding copyright ownership. The ASF licenses this file |
6 | * to you under the Apache License, Version 2.0 (the |
7 | * "License"); you may not use this file except in compliance |
8 | * with the License. You may obtain a copy of the License at |
9 | * |
10 | * http://www.apache.org/licenses/LICENSE-2.0 |
11 | * |
12 | * Unless required by applicable law or agreed to in writing, software |
13 | * distributed under the License is distributed on an "AS IS" BASIS, |
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15 | * See the License for the specific language governing permissions and |
16 | * limitations under the License. |
17 | */ |
18 | |
19 | #include "RLEv1.hh" |
20 | #include "RLEv2.hh" |
21 | #include "orc/Exceptions.hh" |
22 | |
23 | namespace orc { |
24 | |
25 | RleEncoder::~RleEncoder() { |
26 | // PASS |
27 | } |
28 | |
29 | RleDecoder::~RleDecoder() { |
30 | // PASS |
31 | } |
32 | |
33 | std::unique_ptr<RleEncoder> createRleEncoder |
34 | (std::unique_ptr<BufferedOutputStream> output, |
35 | bool isSigned, |
36 | RleVersion version, |
37 | MemoryPool&) { |
38 | switch (static_cast<int64_t>(version)) { |
39 | case RleVersion_1: |
40 | // We don't have std::make_unique() yet. |
41 | return std::unique_ptr<RleEncoder>(new RleEncoderV1(std::move(output), |
42 | isSigned)); |
43 | case RleVersion_2: |
44 | default: |
45 | throw NotImplementedYet("Not implemented yet" ); |
46 | } |
47 | } |
48 | |
49 | std::unique_ptr<RleDecoder> createRleDecoder |
50 | (std::unique_ptr<SeekableInputStream> input, |
51 | bool isSigned, |
52 | RleVersion version, |
53 | MemoryPool& pool) { |
54 | switch (static_cast<int64_t>(version)) { |
55 | case RleVersion_1: |
56 | // We don't have std::make_unique() yet. |
57 | return std::unique_ptr<RleDecoder>(new RleDecoderV1(std::move(input), |
58 | isSigned)); |
59 | case RleVersion_2: |
60 | return std::unique_ptr<RleDecoder>(new RleDecoderV2(std::move(input), |
61 | isSigned, pool)); |
62 | default: |
63 | throw NotImplementedYet("Not implemented yet" ); |
64 | } |
65 | } |
66 | |
67 | } // namespace orc |
68 | |