OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SharedMetadataValidator.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, 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 namespace foreign_storage {
20 template <typename V, std::enable_if_t<std::is_integral<V>::value, int> = 0>
21 inline V get_null_value() {
22  return inline_int_null_value<V>();
23 }
24 
25 template <typename V, std::enable_if_t<std::is_floating_point<V>::value, int> = 0>
26 inline V get_null_value() {
27  return inline_fp_null_value<V>();
28 }
29 
30 template <typename D, std::enable_if_t<std::is_integral<D>::value, int> = 0>
31 inline std::pair<D, D> get_min_max_bounds() {
32  static_assert(std::is_signed<D>::value,
33  "'get_min_max_bounds' is only valid for signed types");
34  return {get_null_value<D>() + 1, std::numeric_limits<D>::max()};
35 }
36 
37 template <typename D, std::enable_if_t<std::is_floating_point<D>::value, int> = 0>
38 inline std::pair<D, D> get_min_max_bounds() {
39  return {std::numeric_limits<D>::lowest(), std::numeric_limits<D>::max()};
40 }
41 } // namespace foreign_storage
std::pair< D, D > get_min_max_bounds()