ATLAS Offline Software
Loading...
Searching...
No Matches
H5Traits.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3*/
5
6#include "H5Cpp.h"
7
8namespace H5Utils {
9 namespace internal {
10
11 // bool is a special case, we need to define it with a more
12 // complicated function
13 H5::DataType get_bool_type();
14
15 typedef H5::PredType PT;
16 const H5::DataType H5Traits<int>::type = PT::NATIVE_INT;
17 const H5::DataType H5Traits<long>::type = PT::NATIVE_LONG;
18 const H5::DataType H5Traits<long long>::type = PT::NATIVE_LLONG;
19 const H5::DataType H5Traits<unsigned long>::type = PT::NATIVE_ULONG;
20 const H5::DataType H5Traits<unsigned long long>::type = PT::NATIVE_ULLONG;
21 const H5::DataType H5Traits<unsigned int>::type = PT::NATIVE_UINT;
22 const H5::DataType H5Traits<unsigned char>::type = PT::NATIVE_UCHAR;
23 const H5::DataType H5Traits<char>::type = PT::NATIVE_CHAR;
24 const H5::DataType H5Traits<float>::type = PT::NATIVE_FLOAT;
25 const H5::DataType H5Traits<double>::type = PT::NATIVE_DOUBLE;
26 const H5::DataType H5Traits<bool>::type = get_bool_type();
27 const H5::DataType H5Traits<short>::type = PT::NATIVE_SHORT;
28 const H5::DataType H5Traits<unsigned short>::type = PT::NATIVE_USHORT;
29
30 // define the spaciel bool case
31 H5::DataType get_bool_type() {
32 bool TRUE = true;
33 bool FALSE = false;
34 H5::EnumType btype(sizeof(bool));
35 btype.insert("TRUE", &TRUE);
36 btype.insert("FALSE", &FALSE);
37 return btype;
38 }
39
40 }
41}
clssses to add type traits for H5
Definition common.h:21
H5::DataType get_bool_type()
Definition H5Traits.cxx:31
H5::PredType PT
Definition H5Traits.cxx:15
HDF5 Tuple Writer.
Definition common.h:20
We have lots of code to get around HDF5's rather weak typing.
Definition H5Traits.h:54