icedb  version 0.5.1
Snow particle scattering database API
Data_Types.hpp
Go to the documentation of this file.
1 #pragma once
2 #include "defs.h"
3 #include <cstdint>
4 #include <memory>
5 #include <typeinfo>
6 #include <typeindex> // C++ 11 really is required.
7 //#include "compat/variant_backend.hpp"
8 
9 namespace H5 {
10  class H5Object;
11  class Group;
12  class DataSet;
13  class CommonFG;
14  class H5Location;
15 }
16 namespace icedb {
17 
19  namespace Data_Types {
21  template <class T> constexpr bool Is_Valid_Data_Type() { return false; }
22  template<> constexpr bool Is_Valid_Data_Type<uint64_t>() { return true; }
23  template<> constexpr bool Is_Valid_Data_Type<int64_t>() { return true; }
24  template<> constexpr bool Is_Valid_Data_Type<uint32_t>() { return true; }
25  template<> constexpr bool Is_Valid_Data_Type<int32_t>() { return true; }
26  template<> constexpr bool Is_Valid_Data_Type<uint16_t>() { return true; }
27  template<> constexpr bool Is_Valid_Data_Type<int16_t>() { return true; }
28  template<> constexpr bool Is_Valid_Data_Type<uint8_t>() { return true; }
29  template<> constexpr bool Is_Valid_Data_Type<int8_t>() { return true; }
30  template<> constexpr bool Is_Valid_Data_Type<float>() { return true; }
31  template<> constexpr bool Is_Valid_Data_Type<double>() { return true; }
32  template<> constexpr bool Is_Valid_Data_Type<char>() { return true; }
33  template<> constexpr bool Is_Valid_Data_Type<std::string>() { return true; }
35  inline bool Is_Valid_Data_Type(const std::type_info &type_id) {
36  if (type_id == typeid(uint64_t)) return true;
37  else if (type_id == typeid(int64_t)) return true;
38  else if (type_id == typeid(uint32_t)) return true;
39  else if (type_id == typeid(int32_t)) return true;
40  else if (type_id == typeid(uint16_t)) return true;
41  else if (type_id == typeid(int16_t)) return true;
42  else if (type_id == typeid(uint8_t)) return true;
43  else if (type_id == typeid(int8_t)) return true;
44  else if (type_id == typeid(float)) return true;
45  else if (type_id == typeid(double)) return true;
46  else if (type_id == typeid(char)) return true;
47  else if (type_id == typeid(std::string)) return true;
48  return false;
49  }
50 
51  //typedef variant<uint64_t, int64_t, uint32_t, int32_t, uint16_t, int16_t, uint8_t, int8_t, float, double, char, std::string> All_Variant_type;
52 
53  template <class T> const std::type_index getType() { return typeid(T); }
54  }
55 }
Definition: Data_Types.hpp:9
constexpr bool Is_Valid_Data_Type< int16_t >()
Definition: Data_Types.hpp:27
constexpr bool Is_Valid_Data_Type< int64_t >()
Definition: Data_Types.hpp:23
bool Is_Valid_Data_Type(const std::type_info &type_id)
Is the type (type_id) a type supported for I/O by this library?
Definition: Data_Types.hpp:35
constexpr bool Is_Valid_Data_Type< double >()
Definition: Data_Types.hpp:31
constexpr bool Is_Valid_Data_Type< uint64_t >()
Definition: Data_Types.hpp:22
constexpr bool Is_Valid_Data_Type< uint16_t >()
Definition: Data_Types.hpp:26
constexpr bool Is_Valid_Data_Type< uint8_t >()
Definition: Data_Types.hpp:28
constexpr bool Is_Valid_Data_Type< int8_t >()
Definition: Data_Types.hpp:29
constexpr bool Is_Valid_Data_Type< int32_t >()
Definition: Data_Types.hpp:25
const std::type_index getType()
Definition: Data_Types.hpp:53
constexpr bool Is_Valid_Data_Type< float >()
Definition: Data_Types.hpp:30
constexpr bool Is_Valid_Data_Type< uint32_t >()
Definition: Data_Types.hpp:24
constexpr bool Is_Valid_Data_Type< char >()
Definition: Data_Types.hpp:32