HighFive  2.3.1
HighFive - Header-only C++ HDF5 interface
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 #ifndef H5ATTRIBUTE_HPP
10 #define H5ATTRIBUTE_HPP
11 
12 #include <vector>
13 
14 #include "H5DataSpace.hpp"
15 #include "H5DataType.hpp"
16 #include "H5Object.hpp"
17 #include "bits/H5Path_traits.hpp"
18 
19 namespace HighFive {
20 
24 class Attribute : public Object,
25  public PathTraits<Attribute> {
26  public:
27 
29 
33  std::string getName() const;
34 
35  size_t getStorageSize() const;
36 
41  DataType getDataType() const;
42 
47  DataSpace getSpace() const;
48 
54  DataSpace getMemSpace() const;
55 
63  template <typename T>
64  void read(T& array) const;
65 
69  template <typename T>
70  void read(T* array, const DataType& dtype = DataType()) const;
71 
79  template <typename T>
80  void write(const T& buffer);
81 
85  template <typename T>
86  void write_raw(const T* buffer, const DataType& dtype = DataType());
87 
88  // No empty attributes
89  Attribute() = delete;
90 
91  private:
92  using Object::Object;
93 
94  template <typename Derivate> friend class ::HighFive::AnnotateTraits;
95 };
96 
97 } // namespace HighFive
98 
99 
100 #endif // H5ATTRIBUTE_HPP
Class representing an attribute of a dataset or group.
Definition: H5Attribute.hpp:25
void write_raw(const T *buffer, const DataType &dtype=DataType())
Definition: H5Attribute_misc.hpp:110
DataSpace getSpace() const
getSpace
Definition: H5Attribute_misc.hpp:47
DataType getDataType() const
getDataType
Definition: H5Attribute_misc.hpp:41
std::string getName() const
return the name of the current attribute
Definition: H5Attribute_misc.hpp:31
void write(const T &buffer)
Definition: H5Attribute_misc.hpp:94
static const ObjectType type
Definition: H5Attribute.hpp:28
DataSpace getMemSpace() const
getMemSpace
Definition: H5Attribute_misc.hpp:56
size_t getStorageSize() const
Definition: H5Attribute_misc.hpp:37
void read(T &array) const
Definition: H5Attribute_misc.hpp:59
Class representing the space (dimensions) of a dataset.
Definition: H5DataSpace.hpp:37
HDF5 Data Type.
Definition: H5DataType.hpp:42
Definition: H5Object.hpp:36
Object()
Definition: H5Object_misc.hpp:16
Definition: H5Path_traits.hpp:16
Definition: H5_definitions.hpp:15
ObjectType
Enum of the types of objects (H5O api)
Definition: H5Object.hpp:25