32class HDF5RecordingData;
45 explicit HDF5IO(
const std::string& fileName);
120 const std::string& dataPath)
const override;
129 const std::string& dataPath)
const override;
142 const std::string& path,
143 const std::string& name,
155 const std::string& path,
156 const std::string& name,
157 const bool overwrite =
false)
override;
170 const std::string& path,
171 const std::string& name,
172 const bool overwrite =
false)
override;
182 const std::string& path,
183 const std::string& name)
override;
202 const std::string& reference)
override;
211 const std::string& value)
override;
220 const std::vector<std::string>& values)
override;
230 const std::string& path,
231 const std::vector<std::string>& references)
override;
278 const std::string& path)
override;
285 std::shared_ptr<IO::BaseRecordingData>
getDataSet(
286 const std::string& path)
override;
319 bool objectExists(
const std::string& path)
const override;
349 virtual std::vector<std::pair<std::string, StorageObjectType>>
352 StorageObjectType::Undefined)
const override;
421 template<
typename T,
typename HDF5TYPE>
424 const H5::DataSpace& memspace,
425 const H5::DataSpace& dataspace)
const;
444 template<
typename T,
typename HDF5TYPE>
446 size_t numElements)
const;
460 template<
typename HDF5TYPE>
462 const HDF5TYPE& dataSource,
464 const H5::DataSpace& memspace,
465 const H5::DataSpace& dataspace)
const;
482 template<
typename HDF5TYPE>
484 size_t numElements)
const;
486 std::unique_ptr<H5::Attribute>
getAttribute(
const std::string& path)
const;
AQNWB::Types::StorageObjectType StorageObjectType
Definition BaseIO.hpp:20
AQNWB::Types::Status Status
Definition BaseIO.hpp:21
AQNWB::Types::SizeArray SizeArray
Definition BaseIO.hpp:22
AQNWB::Types::SizeType SizeType
Definition Channel.hpp:8
Base class for array dataset configuration.
Definition BaseIO.hpp:205
Represents a base data type.
Definition BaseIO.hpp:47
BaseIO(const std::string &filename)
Constructor for the BaseIO class.
Definition BaseIO.cpp:149
Generic structure to hold type-erased data and shape.
Definition ReadIO.hpp:34
std::shared_ptr< IO::BaseRecordingData > getDataSet(const std::string &path) override
Returns a pointer to a dataset at a given path.
Definition HDF5IO.cpp:1307
Status stopRecording() override
Stops the recording process.
Definition HDF5IO.cpp:1093
SizeArray getStorageObjectChunking(const std::string &path) const override
Gets the chunking configuration of a dataset.
Definition HDF5IO.cpp:1229
bool m_disableSWMRMode
Tracks whether SWMR mode is disabled for the current recording. Set by startRecording(bool) at the st...
Definition HDF5IO.hpp:509
Status createGroup(const std::string &path) override
Creates a new group in the file.
Definition HDF5IO.cpp:930
static IO::BaseDataType getBaseDataType(const H5::DataType &nativeType)
Returns the BaseDataType for a given HDF5 native data type.
Definition HDF5IO.cpp:1499
Status createLink(const std::string &path, const std::string &reference) override
Creates a soft link to another location in the file.
Definition HDF5IO.cpp:962
std::string readReferenceAttribute(const std::string &dataPath) const override
Reads a reference attribute and returns the path to the referenced object.
Definition HDF5IO.cpp:322
Status createReferenceDataSet(const std::string &path, const std::vector< std::string > &references) override
Creates a dataset that holds an array of references to groups within the file.
Definition HDF5IO.cpp:982
bool attributeExists(const std::string &path) const override
Checks whether an Attribute exists at the location in the file.
Definition HDF5IO.cpp:1137
virtual std::vector< std::pair< std::string, StorageObjectType > > getStorageObjects(const std::string &path, const StorageObjectType &objectType=StorageObjectType::Undefined) const override
Gets the list of storage objects (groups, datasets, attributes) inside a group.
Definition HDF5IO.cpp:1144
BaseDataType getStorageObjectDataType(const std::string &path) const override
Gets the BaseDataType of a dataset or attribute.
Definition HDF5IO.cpp:1262
StorageObjectType getStorageObjectType(std::string path) const override
Get the storage type (Group, Dataset, Attribute) of the object at path.
Definition HDF5IO.cpp:156
AQNWB::IO::DataBlockGeneric readAttribute(const std::string &dataPath) const override
Reads a attribute and determines the data type.
Definition HDF5IO.cpp:385
Status createAttribute(const IO::BaseDataType &type, const void *data, const std::string &path, const std::string &name, const SizeType &size=1) override
Creates an attribute at a given location in the file.
Definition HDF5IO.cpp:701
Status startRecording() override
Start SWMR write to start recording process.
Definition HDF5IO.cpp:1072
std::unique_ptr< H5::Attribute > getAttribute(const std::string &path) const
Definition HDF5IO.cpp:123
std::vector< std::string > readStringDataHelper(const HDF5TYPE &dataSource, size_t numElements, const H5::DataSpace &memspace, const H5::DataSpace &dataspace) const
Reads a variable-length string from an HDF5 dataset or attribute.
Definition HDF5IO.cpp:216
SizeArray getStorageObjectShape(const std::string &path) const override
Returns the size of the dataset or attribute for each dimension.
Definition HDF5IO.cpp:1201
std::unique_ptr< IO::BaseRecordingData > createArrayDataSet(const IO::BaseArrayDataSetConfig &config, const std::string &path) override
Creates an extendable dataset with the given configuration and path.
Definition HDF5IO.cpp:1330
Status createReferenceAttribute(const std::string &referencePath, const std::string &path, const std::string &name) override
Sets an object reference attribute for a given location in the file.
Definition HDF5IO.cpp:890
Status close() override
Closes the file.
Definition HDF5IO.cpp:94
bool canModifyObjects() override
Checks whether the file is in a mode where objects can be added or deleted. Note, this does not apply...
Definition HDF5IO.cpp:1108
HDF5IO(const std::string &fileName)
Constructor for the HDF5IO class that takes a file name as input.
Definition HDF5IO.cpp:24
H5O_type_t getH5ObjectType(const std::string &path) const
Returns the HDF5 type of object at a given path.
Definition HDF5IO.cpp:1423
AQNWB::IO::DataBlockGeneric readDataset(const std::string &dataPath, const SizeArray &start={}, const SizeArray &count={}, const SizeArray &stride={}, const SizeArray &block={}) override
Reads a dataset or attribute and determines the data type.
Definition HDF5IO.cpp:517
Status createStringDataSet(const std::string &path, const std::string &value) override
Creates a non-modifiable dataset with a string value.
Definition HDF5IO.cpp:1029
static H5::DataType getH5Type(IO::BaseDataType type)
Returns the HDF5 data type for a given base data type.
Definition HDF5IO.cpp:1542
bool objectExists(const std::string &path) const override
Checks whether a Dataset, Group, or Link already exists at the location in the file.
Definition HDF5IO.cpp:1127
std::vector< T > readDataHelper(const HDF5TYPE &dataSource, size_t numElements, const H5::DataSpace &memspace, const H5::DataSpace &dataspace) const
Reads data from an HDF5 dataset or attribute into a vector of the appropriate type.
Definition HDF5IO.cpp:184
Status closeFileImpl()
Non-virtual helper that performs the actual HDF5 file close.
Definition HDF5IO.cpp:100
static H5::DataType getNativeType(IO::BaseDataType type)
Returns the HDF5 native data type for a given base data type.
Definition HDF5IO.cpp:1448
Status open() override
Opens an existing file or creates a new file for writing.
Definition HDF5IO.cpp:47
Status flush() override
Flush data to disk.
Definition HDF5IO.cpp:117
Status createGroupIfDoesNotExist(const std::string &path) override
Creates a new group if it does not exist.
Definition HDF5IO.cpp:948
~HDF5IO() override
Destructor.
Definition HDF5IO.cpp:30
std::unique_ptr< H5::H5File > m_file
Unique pointer to the HDF5 file for reading.
Definition HDF5IO.hpp:503
Namespace for all components of the HDF5 I/O backend.
FileMode
The access mode for the file.
Definition BaseIO.hpp:173