h5cpp  0.5.0
A modern C++ wrapper for the HDF5 C library
float.hpp
Go to the documentation of this file.
1 //
2 // (c) Copyright 2017 DESY,ESS
3 //
4 // This file is part of h5pp.
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 // Eugen Wintersberger <eugen.wintersberger@desy.de>
24 // Martin Shetty <martin.shetty@esss.se>
25 // Jan Kotanski <jan.kotanski@desy.de>
26 // Created on: Aug 23, 2017
27 //
28 #pragma once
29 
31 #include <h5cpp/core/windows.hpp>
32 #include <vector>
33 
34 namespace hdf5 {
35 namespace datatype {
36 
37 class DLL_EXPORT Float : public Datatype {
38  public:
45  Float() = default;
46 
52  Float(ObjectHandle &&handle);
53 
64  explicit Float(const Datatype &datatype);
65 
71  virtual size_t precision() const;
72 
78  virtual void precision(size_t precision) const;
79 
85  virtual size_t offset() const;
86 
92  virtual void offset(size_t offset) const;
93 
99  virtual Order order() const;
100 
106  virtual void order(Order order) const;
107 
113  virtual const std::vector<Pad> pad() const;
114 
122  virtual void pad(Pad lsb, Pad msb) const;
123 
131  virtual const std::vector<size_t> fields() const;
132 
143  virtual void fields(size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize) const;
144 
150  virtual size_t ebias() const;
151 
157  virtual void ebias(size_t ebias) const;
158 
164  virtual Norm norm() const;
165 
171  virtual void norm(Norm norm) const;
172 
178  virtual Pad inpad() const;
179 
185  virtual void inpad(Pad inpad) const;
186 };
187 
188 
190  private:
191  uint16_t _value;
192  public:
194  float16_t():_value(0u) {}
195 
197  float16_t(uint16_t v):_value(v) {}
198 
200  operator uint16_t() const {
201  return _value;
202  }
203 };
204 
205 
206 } // namespace datatype
207 } // namespace hdf5
hdf5::datatype::Float
Definition: float.hpp:37
hdf5::datatype::Norm
Norm
enumeration describes mantissa norm
Definition: types.hpp:118
datatype.hpp
windows.hpp
hdf5::datatype::float16_t::float16_t
float16_t(uint16_t v)
conversion constructor
Definition: float.hpp:197
hdf5::datatype::Order
Order
enumeration type for byte order
Definition: types.hpp:80
hdf5::datatype::float16_t
Definition: float.hpp:189
hdf5::ObjectHandle
Wrapper for hid_t object identifiers.
Definition: object_handle.hpp:66
DLL_EXPORT
#define DLL_EXPORT
Definition: windows.hpp:29
hdf5::datatype::Pad
Pad
enumeration for floating point padding
Definition: types.hpp:137
hdf5::datatype::float16_t::float16_t
float16_t()
default constructor
Definition: float.hpp:194
hdf5::datatype::Datatype
base class for all data types
Definition: datatype.hpp:41
hdf5
top-level namespace of the entire library
Definition: attribute.hpp:45