HighFive 2.7.1
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
53 std::string getName() const;
54
55 size_t getStorageSize() const;
56
61 DataType getDataType() const;
62
67 DataSpace getSpace() const;
68
74 DataSpace getMemSpace() const;
75
77 template <typename T>
78 T read() const;
79
87 template <typename T>
88 void read(T& array) const;
89
91 template <typename T>
92 void read(T* array, const DataType& dtype = {}) const;
93
101 template <typename T>
102 void write(const T& buffer);
103
105 template <typename T>
106 void write_raw(const T* buffer, const DataType& dtype = {});
107
110 return details::get_plist<AttributeCreateProps>(*this, H5Aget_create_plist);
111 }
112
113 // No empty attributes
114 Attribute() = delete;
115
116 protected:
117 using Object::Object;
118
119 private:
120#if HIGHFIVE_HAS_FRIEND_DECLARATIONS
121 template <typename Derivate>
122 friend class ::HighFive::AnnotateTraits;
123#endif
124
125 friend Attribute detail::make_attribute(hid_t);
126};
127
128namespace detail {
129inline Attribute make_attribute(hid_t hid) {
130 return Attribute(hid);
131}
132} // namespace detail
133
134} // namespace HighFive
Class representing an attribute of a dataset or group.
Definition H5Attribute.hpp:46
void write_raw(const T *buffer, const DataType &dtype={})
Write a buffer to this attribute.
Definition H5Attribute_misc.hpp:140
DataSpace getSpace() const
getSpace
Definition H5Attribute_misc.hpp:42
DataType getDataType() const
getDataType
Definition H5Attribute_misc.hpp:36
std::string getName() const
return the name of the current attribute
Definition H5Attribute_misc.hpp:27
void write(const T &buffer)
Definition H5Attribute_misc.hpp:117
static const ObjectType type
Definition H5Attribute.hpp:48
T read() const
Return the attribute.
Definition H5Attribute_misc.hpp:55
DataSpace getMemSpace() const
getMemSpace
Definition H5Attribute_misc.hpp:50
size_t getStorageSize() const
Definition H5Attribute_misc.hpp:32
AttributeCreateProps getCreatePropertyList() const
Get the list of properties for creation of this attribute.
Definition H5Attribute.hpp:109
Class representing the space (dimensions) of a dataset.
Definition H5DataSpace.hpp:25
HDF5 Data Type.
Definition H5DataType.hpp:54
Definition H5Object.hpp:54
Object()
Definition H5Object_misc.hpp:24
Definition H5Path_traits.hpp:16
HDF5 property Lists.
Definition H5PropertyList.hpp:79
Definition H5_definitions.hpp:15
ObjectType
Enum of the types of objects (H5O api)
Definition H5Object.hpp:24