h5cpp 0.7
A modern C++ wrapper for the HDF5 C library
Loading...
Searching...
No Matches
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
32#include <vector>
33
34namespace hdf5 {
35namespace datatype {
36
37class DLL_EXPORT Float : public Datatype {
38 public:
45 Float() = default;
46
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
Wrapper for hid_t object identifiers.
Definition object_handle.hpp:67
base class for all data types
Definition datatype.hpp:42
Definition float.hpp:37
virtual size_t precision() const
get the precision of type, i.e. the number of significant bits
Float(ObjectHandle &&handle)
constructor
virtual void offset(size_t offset) const
set the bit offset of the first significant bit
virtual void inpad(Pad inpad) const
set the internal padding type for unused bits in floating-point datatypes
virtual size_t offset() const
get the bit offset of the first significant bit
virtual void order(Order order) const
set the order of datatype
virtual Order order() const
get the order of datatype
virtual Norm norm() const
get the mantissa normalization of a floating-point datatype
virtual const std::vector< size_t > fields() const
get the floating point datatype bit field information
virtual size_t ebias() const
get the exponent bias of a floating-point type
Float()=default
default constructor
virtual void norm(Norm norm) const
set the mantissa normalization of a floating-point datatype
virtual void fields(size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize) const
set the floating point datatype bit field information
virtual void ebias(size_t ebias) const
set the exponent bias of a floating-point type
virtual Pad inpad() const
get the internal padding type for unused bits in floating-point datatypes
virtual void precision(size_t precision) const
set the precision of a type, i.e. the number of significant bits
virtual const std::vector< Pad > pad() const
get the pads of datatype
Float(const Datatype &datatype)
constructor
virtual void pad(Pad lsb, Pad msb) const
set the pads of datatype
Definition float.hpp:189
float16_t(uint16_t v)
conversion constructor
Definition float.hpp:197
float16_t()
default constructor
Definition float.hpp:194
Norm
enumeration describes mantissa norm
Definition types.hpp:119
Order
enumeration type for byte order
Definition types.hpp:81
Pad
enumeration for floating point padding
Definition types.hpp:138
top-level namespace of the entire library
Definition attribute.hpp:45
#define DLL_EXPORT
Definition windows.hpp:29