OpenZGY/C++ API and Internals (ALPHA)
Access seismic data stored in ZGY format.
compression.h
Go to the documentation of this file.
1 // Copyright 2017-2020, Schlumberger
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 #include <string>
18 #include <vector>
19 #include <memory>
20 #include <functional>
21 #include <map>
22 
23 #include "../declspec.h"
24 #include "enum.h"
25 
31 namespace InternalZGY {
32 #if 0
33 }
34 #endif
35 
36 // See the .cpp file for documentation.
37 class OPENZGY_TEST_API CompressFactoryImpl
38 {
39 public:
40  //typedef std::function<rawdata_t(const rawdata_t&,const index3_t&)> compressor_t;
41  typedef std::function<compressor_t(const std::vector<std::string>&)> compfactory_t;
42  typedef std::function<rawdata_t(const rawdata_t&,BrickStatus,const index3_t&)> decompressor_t;
43 
44 public:
45  static void registerCompressor(const std::string& name,
46  const compfactory_t& fn);
47  static void registerDecompressor(const std::string& name,
48  const decompressor_t& fn);
49  static std::vector<std::string> knownCompressors();
50  static std::vector<std::string> knownDecompressors();
51 
52  static compressor_t getCompressor(const std::string& name,
53  const std::vector<std::string>& args);
54  static rawdata_t decompress(const rawdata_t& cdata,
55  BrickStatus status,
56  const index3_t& shape);
57 private:
58  typedef std::map<std::string, compfactory_t> comp_reg_t;
59  typedef std::vector<std::pair<std::string, decompressor_t>> decomp_reg_t;
60  static comp_reg_t& _getCompressRegistry();
61  static decomp_reg_t& _getDecompressRegistry();
62 };
63 
64 } // namespace
65 
66 
InternalZGY::CompressFactoryImpl
Registry of known compress and decompress algorithms.
Definition: compression.h:37
enum.h
enums and type aliases not visible to the public API.
InternalZGY::rawdata_t
std::pair< std::shared_ptr< const void >, std::int64_t > rawdata_t
Shared data plus size. No other information.
Definition: enum.h:71
InternalZGY::compressor_t
std::function< rawdata_t(const rawdata_t &, const index3_t &)> compressor_t
Function for compressing a brick.
Definition: enum.h:84
InternalZGY
Implementation not visible to clients.
InternalZGY::index3_t
std::array< std::int64_t, 3 > index3_t
type equivalent to std::int64_t[3]
Definition: enum.h:60
InternalZGY::BrickStatus
BrickStatus
Definition: enum.h:167