h5cpp  0.3.3
A modern C++ wrapper for the HDF5 C library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ebool.hpp
Go to the documentation of this file.
1 //
2 // (c) Copyright 2017 DESY,ESS
3 //
4 // This file is part of h5cpp.
5 //
6 // This library is free software; you can redistribute it and/or modify it
7 // under the terms of the GNU Lesser General Public License as published
8 // by the Free Software Foundation; either version 2.1 of the License, or
9 // (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful, but
12 // WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY
13 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 // License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with this library; if not, write to the
18 // Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor
19 // Boston, MA 02110-1301 USA
20 // ===========================================================================
21 //
22 // Authors:
23 // Jan Kotanski <jan.kotanski@desy.de>
24 // Created on: Sep 18, 2018
25 //
26 #pragma once
27 
30 #include <h5cpp/datatype/enum.hpp>
31 #include <h5cpp/error/error.hpp>
32 #include <sstream>
33 
34 namespace hdf5
35 {
36 namespace datatype
37 {
41 enum EBool : int8_t
42 {
43  FALSE = 0,
44  TRUE = 1
45 };
46 
47 
48 template<>
49 class TypeTrait<datatype::EBool> {
50  public:
51  using TypeClass = datatype::Enum;
52  using Type = datatype::EBool;
53 
54  static TypeClass create(const Type & = Type()) {
55  auto type = TypeClass::create(Type());
56  type.insert("FALSE", Type::FALSE);
57  type.insert("TRUE", Type::TRUE);
58  return type;
59  }
60 };
61 
62 
69 DLL_EXPORT bool is_bool(const Enum & etype);
70 
71 } // namespace datatype
72 } // namespace hdf5
TypeTrait< T >::DataspaceType create(const T &value)
factory function for dataspaces
Definition: type_trait.hpp:115
Type
determine the datatype instance
Definition: type.hpp:43
compound data type
Definition: enum.hpp:45
indicates a true value
Definition: ebool.hpp:44
DLL_EXPORT bool is_bool(const Enum &etype)
check if Enum is EBool
Definition: attribute.hpp:43
trait to create HDF5 datatypes
Definition: type_trait.hpp:53
indicates a false value
Definition: ebool.hpp:43
static TypeClass create(const T &=T())
create the new type instance
Datatype TypeClass
subtype of Datatype which will be used
Definition: type_trait.hpp:58
#define DLL_EXPORT
Definition: windows.hpp:35
EBool
enumeration bool type
Definition: ebool.hpp:41