HighFive 2.9.0
HighFive - Header-only C++ HDF5 interface
Loading...
Searching...
No Matches
H5Attribute.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c), 2017, Ali Can Demiralp <ali.demiralp@rwth-aachen.de>
3 *
4 * Distributed under the Boost Software License, Version 1.0.
5 * (See accompanying file LICENSE_1_0.txt or copy at
6 * http://www.boost.org/LICENSE_1_0.txt)
7 *
8 */
9#pragma once
10
11#include <vector>
12
13#include <H5Apublic.h>
14
15#include "H5DataType.hpp"
16#include "H5Object.hpp"
17#include "bits/H5Friends.hpp"
19
20namespace HighFive {
21class DataSpace;
22
23namespace detail {
24
40Attribute make_attribute(hid_t hid);
41} // namespace detail
42
46class Attribute: public Object, public PathTraits<Attribute> {
47 public:
49
56 std::string getName() const;
57
63 size_t getStorageSize() const;
64
71 DataType getDataType() const;
72
79 DataSpace getSpace() const;
80
84 DataSpace getMemSpace() const;
85
93 template <typename T>
94 T read() const;
95
113 template <typename T>
114 void read(T& array) const;
115
118 template <typename T>
119 void read(T* array, const DataType& mem_datatype) const;
120
123 template <typename T>
124 void read(T* array) const;
125
144 template <typename T>
145 void read_raw(T* array, const DataType& mem_datatype) const;
146
166 template <typename T>
167 void read_raw(T* array) const;
168
186 template <typename T>
187 void write(const T& value);
188
212 template <typename T>
213 void write_raw(const T* buffer, const DataType& mem_datatype);
214
235 template <typename T>
236 void write_raw(const T* buffer);
237
252 return details::get_plist<AttributeCreateProps>(*this, H5Aget_create_plist);
253 }
254
255 // No empty attributes
256 Attribute() = delete;
257
258 protected:
259 using Object::Object;
260
261 private:
262#if HIGHFIVE_HAS_FRIEND_DECLARATIONS
263 template <typename Derivate>
264 friend class ::HighFive::AnnotateTraits;
265#endif
266
267 friend Attribute detail::make_attribute(hid_t);
268};
269
270namespace detail {
271inline Attribute make_attribute(hid_t hid) {
272 return Attribute(hid);
273}
274} // namespace detail
275
276} // namespace HighFive
Class representing an Attribute of a DataSet or Group.
Definition H5Attribute.hpp:46
DataSpace getSpace() const
Get the DataSpace of the current Attribute.
Definition H5Attribute_misc.hpp:43
DataType getDataType() const
Get the DataType of the Attribute.
Definition H5Attribute_misc.hpp:37
void read_raw(T *array, const DataType &mem_datatype) const
Read the attribute into a pre-allocated buffer.
Definition H5Attribute_misc.hpp:110
std::string getName() const
Get the name of the current Attribute.
Definition H5Attribute_misc.hpp:28
static const ObjectType type
Definition H5Attribute.hpp:48
T read() const
Get the value of the Attribute.
Definition H5Attribute_misc.hpp:54
DataSpace getMemSpace() const
Get the DataSpace of the current Attribute.
Definition H5Attribute_misc.hpp:49
void write(const T &value)
Write the value into the Attribute.
Definition H5Attribute_misc.hpp:131
void write_raw(const T *buffer, const DataType &mem_datatype)
Write from a raw pointer.
Definition H5Attribute_misc.hpp:156
size_t getStorageSize() const
The number of bytes required to store the attribute in the HDF5 file.
Definition H5Attribute_misc.hpp:33
AttributeCreateProps getCreatePropertyList() const
The create property list used for this attribute.
Definition H5Attribute.hpp:251
Class representing the space (dimensions) of a DataSet.
Definition H5DataSpace.hpp:31
HDF5 Data Type.
Definition H5DataType.hpp:61
Definition H5Object.hpp:54
Object()
Definition H5Object_misc.hpp:25
Definition H5Path_traits.hpp:16
HDF5 property Lists.
Definition H5PropertyList.hpp:160
Definition H5_definitions.hpp:22
ObjectType
Enum of the types of objects (H5O api)
Definition H5Object.hpp:24