6 #ifndef ECHELON_FILE_HPP 7 #define ECHELON_FILE_HPP 9 #include <echelon/group.hpp> 10 #include <echelon/link.hpp> 11 #include <echelon/attribute_repository.hpp> 13 #include <echelon/hdf5/file.hpp> 120 const std::vector<hsize_t>& dims,
const std::vector<hsize_t>& max_dims,
140 template <
typename T>
144 return root_group_.create_dataset<T>(name, dims, options);
168 template <
typename T>
170 const std::vector<hsize_t>& max_dims,
194 template <
typename T>
197 return root_group_.create_scalar_dataset<T>(name);
211 template <
typename T>
214 return root_group_.create_scalar_dataset(name, value);
223 object operator[](
const std::string& name)
const;
230 void remove(
const std::string& name)
const;
307 template <
typename T>
311 return root_group_.require_dataset<T>(name, dims, options);
362 template <
typename T>
365 return root_group_.require_scalar_dataset<T>(name);
394 template <
typename T>
397 return root_group_.require_scalar_dataset(name, value);
412 void visit_links(
const std::function<
void(
const link&)>& visitor)
const;
420 void visit_objects(
const std::function<
void(
const object&)>& visitor)
const;
434 explicit operator bool()
const;
echelon's core namespace
Definition: attribute.cpp:10
A handle to a group object.
Definition: group.hpp:125
A handle to an HDF5 scalar dataset.
Definition: scalar_dataset.hpp:23
Attribute manager, which should be embedded into a parent object, which supports attributes.
Definition: attribute_repository.hpp:27
object operator[](const std::string &name) const
Accessor function for the root group.
Definition: file.cpp:56
scalar_dataset create_scalar_dataset(const std::string &name, const T &value)
Creates a new scalar dataset within the root group and initializes it with a given value...
Definition: file.hpp:212
group require_group(const std::string &name)
Returns the requested group, if it already exists, otherwise a new group is created.
Definition: file.cpp:66
A handle to an HDF5 type.
Definition: type.hpp:21
scalar_dataset create_scalar_dataset(const std::string &name)
Creates a new scalar dataset within the root group.
Definition: file.hpp:195
dataset create_dataset(const std::string &name, const std::vector< hsize_t > &dims, const dataset_options &options=dataset_options())
Creates a new dataset within the root group.
Definition: file.hpp:141
group mount(const file &mounted_file, const group &mount_point)
Mounts a file at a specified location.
Definition: file.cpp:117
object_reference ref() const
A object reference to the root group.
Definition: file.cpp:97
open_mode
Definition: file.hpp:48
dataset require_dataset(const std::string &name, const std::vector< hsize_t > &dims, const dataset_options &options=dataset_options())
Returns the requested dataset, if it already exists, otherwise a new dataset is created.
Definition: file.hpp:308
native_handle_type native_handle() const
The underlying HDF5 low-level handle.
Definition: file.cpp:102
A handle to an HDF5 file object.
Definition: hdf5/file.hpp:26
Truncate any pre-existing file.
void visit_links(const std::function< void(const link &)> &visitor) const
Visits every link, which is reachable from the root group.
Definition: file.cpp:87
scalar_dataset require_scalar_dataset(const std::string &name, const type &datatype)
Returns the requested scalar dataset, if it already exists, otherwise a new scalar dataset is created...
Definition: file.cpp:77
dataset create_dataset(const std::string &name, const type &datatype, const std::vector< hsize_t > &dims, const dataset_options &options=dataset_options())
Creates a new dataset within the root group.
Definition: file.cpp:38
A link (directed edge) between two HDF5 objects.
Definition: link.hpp:20
create_mode
Definition: file.hpp:40
group create_group(const std::string &name)
Creates a new group within the root group.
Definition: file.cpp:33
A handle to a file object.
Definition: file.hpp:27
scalar_dataset require_scalar_dataset(const std::string &name, const T &value)
Returns the requested scalar dataset, if it already exists, otherwise a new scalar dataset is created...
Definition: file.hpp:395
void unmount(const group &mount_point)
Unmounts a previously mounted file.
Definition: file.cpp:127
void iterate_links(const std::function< void(const link &)> &op) const
Iterates over every link within the root group.
Definition: file.cpp:82
Raise an error, if the file already exists.
scalar_dataset require_scalar_dataset(const std::string &name)
Returns the requested scalar dataset, if it already exists, otherwise the scalar dataset is created...
Definition: file.hpp:363
attribute_repository< group > attributes() const
The attributes, which are attached to the root group.
Definition: file.cpp:112
Additional options for the dataset creation.
Definition: group.hpp:36
dataset create_dataset(const std::string &name, const std::vector< hsize_t > &dims, const std::vector< hsize_t > &max_dims, const dataset_options &options=dataset_options())
Creates a new dataset within the root group.
Definition: file.hpp:169
void visit_objects(const std::function< void(const object &)> &visitor) const
Visits every object, which is reachable from the root group (including the root group) ...
Definition: file.cpp:92
A reference to an HDF5 object.
Definition: object_reference.hpp:24
A handle to an echelon dataset.
Definition: dataset.hpp:33
scalar_dataset create_scalar_dataset(const std::string &name, const type &datatype)
Creates a new scalar dataset within the root group.
Definition: file.cpp:51
dataset require_dataset(const std::string &name, const type &datatype, const std::vector< hsize_t > &dims, const dataset_options &options=dataset_options())
Returns the requested dataset, if it already exists, otherwise a new dataset is created.
Definition: file.cpp:71
file()=default
Initializes the handle with its null state.