h5cpp
0.5.0
A modern C++ wrapper for the HDF5 C library
|
Go to the documentation of this file.
47 #pragma clang diagnostic push
48 #pragma clang diagnostic ignored "-Wweak-vtables"
78 void insert(
const std::string& name,
const T& data)
const;
83 size_t number_of_values()
const;
88 std::string name(
size_t index)
const;
94 T value(
size_t index)
const;
100 T value(
const std::string& name)
const;
108 void insert_underlying(
const std::string& name,
const T& data)
const;
113 static Enum create_underlying(
const Datatype& base_type);
119 void underlying_value(
size_t index, T& data)
const;
125 void underlying_value(
const std::string& name, T& data)
const;
129 void check_type(
const T& data)
const;
133 #pragma clang diagnostic pop
137 void Enum::check_type(
const T& data)
const
141 if (mem_type_holder.
get<T>() !=
super())
143 std::stringstream ss;
144 ss <<
"Attempt to insert enum value of mismatching type";
145 throw (std::runtime_error(ss.str()));
161 if (0 > H5Tenum_insert(
static_cast<hid_t
>(*
this),
name.c_str(), &data))
163 std::stringstream ss;
164 ss <<
"Could not insert Enum value " <<
name <<
"=" << data;
172 auto data2 =
static_cast<typename std::underlying_type<T>::type
>(data);
181 if (0 > H5Tget_member_value(
static_cast<hid_t
>(*
this),
static_cast<uint32_t
>(index), &data))
183 std::stringstream ss;
184 ss <<
"Could not retrieve Enum value at idx=" << index;
194 if (0 > H5Tenum_valueof(
static_cast<hid_t
>(*
this),
name.c_str(), &data))
196 std::stringstream ss;
197 ss <<
"Could not retrieve Enum value with name=" <<
name;
205 typename std::underlying_type<T>::type t;
207 return static_cast<T
>(t);
213 typename std::underlying_type<T>::type t;
215 return static_cast<T
>(t);
const Datatype & get(const T &v=T())
factory holder method for getting reference of data types
Definition: factory.hpp:74
data type object holder
Definition: factory.hpp:53
void insert_underlying(const std::string &name, const T &data) const
insert enum value definition
Definition: enum.hpp:157
static Singleton & instance()
reference to singleton
Definition: error.hpp:59
static Enum create_underlying(const Datatype &base_type)
named constructor from underlying datatype
Datatype super() const
get the base type
static Enum create(const T &)
named constructor (with underlying type deduction)
Definition: enum.hpp:150
void throw_with_stack(const std::string &message)
throws an exception, potentially nested with error stack
compound data type
Definition: enum.hpp:50
TypeTrait< typename std::remove_const< T >::type >::TypeClass create(const T &v=T())
factory function for creating data types
Definition: factory.hpp:39
Wrapper for hid_t object identifiers.
Definition: object_handle.hpp:66
T value(size_t index) const
get value at index (with underlying type deduction)
Definition: enum.hpp:203
#define DLL_EXPORT
Definition: windows.hpp:29
void underlying_value(size_t index, T &data) const
get value at index
Definition: enum.hpp:177
std::string name(size_t index) const
get value name
void insert(const std::string &name, const T &data) const
insert enum value definition (with underlying type deduction)
Definition: enum.hpp:170
base class for all data types
Definition: datatype.hpp:41
top-level namespace of the entire library
Definition: attribute.hpp:45