OmniSciDB  06b3bd477c
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
geo_compression.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020 OmniSci, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <cstdint>
20 #include <vector>
21 
23 #include "Shared/sqltypes.h"
24 namespace geospatial {
25 
26 int32_t get_compression_scheme(const SQLTypeInfo& ti);
27 
28 uint64_t compress_coord(double coord, const SQLTypeInfo& ti, bool x);
29 
30 uint64_t compress_null_point(const SQLTypeInfo& ti, bool x);
31 
32 bool is_null_point(const SQLTypeInfo& geo_ti,
33  const int8_t* coords,
34  const size_t coords_sz);
35 
36 // Compress non-NULL geo coords; and also NULL POINT coords (special case)
37 std::vector<uint8_t> compress_coords(std::vector<double>& coords, const SQLTypeInfo& ti);
38 
39 template <typename T>
40 void unpack_geo_vector(std::vector<T>& output, const int8_t* input_ptr, const size_t sz);
41 
42 template <typename T, typename C>
43 std::shared_ptr<std::vector<T>> decompress_coords(const C& compression,
44  const int8_t* coords,
45  const size_t coords_sz);
46 } // namespace geospatial
std::shared_ptr< std::vector< T > > decompress_coords(const C &compression, const int8_t *coords, const size_t coords_sz)
uint64_t compress_null_point(const SQLTypeInfo &ti, bool x)
Constants for Builtin SQL Types supported by OmniSci.
Compression / decompression routines for geospatial coordinates. Suitable for inclusion by the LLVM c...
void unpack_geo_vector(std::vector< T > &output, const int8_t *input_ptr, const size_t sz)
uint64_t compress_coord(double coord, const SQLTypeInfo &ti, bool x)
std::vector< uint8_t > compress_coords(std::vector< double > &coords, const SQLTypeInfo &ti)
bool is_null_point(const SQLTypeInfo &geo_ti, const int8_t *coords, const size_t coords_sz)
int32_t get_compression_scheme(const SQLTypeInfo &ti)