h5gt 0.2.0
C++ wrapper for HDF5 library (based on HighFive project)
Loading...
Searching...
No Matches
H5Attribute.hpp
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#ifndef H5ATTRIBUTE_HPP
10#define H5ATTRIBUTE_HPP
11
12#include <vector>
13
14#include "H5DataSpace.hpp"
15#include "H5DataType.hpp"
16
17namespace h5gt {
18
22class Attribute : public Object {
23public:
24
25 const static ObjectType type = ObjectType::Attribute;
26
30 std::string getName() const;
31
36 size_t getStorageSize() const;
37
42 DataType getDataType() const;
43
48 DataSpace getSpace() const;
49
55 DataSpace getMemSpace() const;
56
57 File getFile() const;
58
66 template <typename T>
67 void read(T& array) const;
68
72 template <typename T>
73 void read(T* array, const DataType& dtype = DataType()) const;
74
82 template <typename T>
83 void write(const T& buffer);
84
88 template <typename T>
89 void write_raw(const T* buffer, const DataType& dtype = DataType());
90
91 static Attribute FromId(const hid_t& id, const bool& increaseRefCount = false){
92 Object obj = Object(id, ObjectType::Attribute, increaseRefCount);
93 return Attribute(obj);
94 };
95
96protected:
97 Attribute(const Object& obj) : Object(obj){};
98
99private:
100 Attribute() = default;
101
102 template <typename Derivate> friend class ::h5gt::AnnotateTraits;
103};
104
105} // namespace h5gt
106
107
108#endif // H5ATTRIBUTE_HPP
Class representing an attribute of a dataset or group.
Definition H5Attribute.hpp:22
void write(const T &buffer)
Definition H5Attribute_misc.hpp:113
DataType getDataType() const
getDataType
Definition H5Attribute_misc.hpp:40
void write_raw(const T *buffer, const DataType &dtype=DataType())
Definition H5Attribute_misc.hpp:138
void read(T &array) const
Definition H5Attribute_misc.hpp:68
DataSpace getMemSpace() const
getMemSpace
Definition H5Attribute_misc.hpp:55
std::string getName() const
return the name of the current attribute
Definition H5Attribute_misc.hpp:30
size_t getStorageSize() const
getStorageSize
Definition H5Attribute_misc.hpp:36
DataSpace getSpace() const
getSpace
Definition H5Attribute_misc.hpp:46
Class representing the space (dimensions) of a dataset.
Definition H5DataSpace.hpp:37
HDF5 Data Type.
Definition H5DataType.hpp:48
File class.
Definition H5File.hpp:25
Definition H5Object.hpp:55