echelon  0.8.0
hdf5/scalar_dataset.hpp
1 // Copyright (c) 2012-2014 Christopher Hinz
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 #ifndef ECHELON_HDF5_SCALAR_DATASET_HPP
7 #define ECHELON_HDF5_SCALAR_DATASET_HPP
8 
9 #include <echelon/hdf5/object.hpp>
10 
11 #include <echelon/hdf5/type.hpp>
12 #include <echelon/hdf5/precursor/dataset.hpp>
13 #include <echelon/hdf5/precursor/dataspace.hpp>
14 #include <echelon/hdf5/precursor/property_list.hpp>
15 
16 #include <echelon/hdf5/object_reference.hpp>
17 #include <echelon/hdf5/attribute_repository.hpp>
18 
19 #include <echelon/hdf5/storage_layer.hpp>
20 
21 namespace echelon
22 {
23 namespace hdf5
24 {
28 {
29 public:
32  using native_handle_type = hdf5::precursor::dataset;
33 
36  scalar_dataset() = default;
37 
38  scalar_dataset(const object& parent, const std::string& name, const type& datatype);
39 
40  explicit scalar_dataset(native_handle_type dataset_wrapper_);
41 
49  template <typename T>
50  friend inline void operator<<=(scalar_dataset& sink, const T& value)
51  {
52  write(sink.dataset_wrapper_, value);
53  }
54 
62  template <typename T>
63  friend inline void operator<<=(T& value, const scalar_dataset& source)
64  {
65  read(source.dataset_wrapper_, value);
66  }
67 
70  type datatype() const;
71 
74  object_reference ref() const;
75 
78  const native_handle_type& native_handle() const;
79 
82  explicit operator bool() const;
83 private:
84  hdf5::precursor::dataset dataset_wrapper_;
85 
86 public:
90 };
91 }
92 }
93 
94 #endif
echelon&#39;s core namespace
Definition: attribute.cpp:10
friend void operator<<=(scalar_dataset &sink, const T &value)
Writes the content of a variable into the scalar dataset.
Definition: hdf5/scalar_dataset.hpp:50
scalar_dataset()=default
Initializes the handle with its null state.
type datatype() const
The value type of the scalar dataset.
Definition: hdf5/scalar_dataset.cpp:27
hdf5::precursor::dataset native_handle_type
Type of the underlying HDF5 low-level handle.
Definition: hdf5/scalar_dataset.hpp:32
A handle to an HDF5 type.
Definition: hdf5/type.hpp:23
Attribute manager, which should be embedded into a parent object, which supports attributes.
Definition: hdf5/attribute_repository.hpp:52
const native_handle_type & native_handle() const
The underlying HDF5 low-level handle.
Definition: hdf5/scalar_dataset.cpp:37
A reference to an HDF5 object.
Definition: hdf5/object_reference.hpp:25
attribute_repository< scalar_dataset > attributes() const
The attributes, which are attached to the scalar dataset.
Definition: hdf5/scalar_dataset.cpp:47
friend void operator<<=(T &value, const scalar_dataset &source)
Reads the content of the scalar dataset into a variable.
Definition: hdf5/scalar_dataset.hpp:63
object_reference ref() const
A HDF5 object reference to this scalar dataset.
Definition: hdf5/scalar_dataset.cpp:32
A handle to an HDF5 scalar dataset.
Definition: hdf5/scalar_dataset.hpp:27