aqnwb 0.1.0
|
The BaseIO class is an abstract base class that defines the interface for input/output (IO) operations on a file. More...
#include <BaseIO.hpp>
Public Member Functions | |
BaseIO (const std::string &filename) | |
Constructor for the BaseIO class. | |
BaseIO (const BaseIO &)=delete | |
Copy constructor is deleted to prevent construction-copying. | |
BaseIO & | operator= (const BaseIO &)=delete |
Assignment operator is deleted to prevent copying. | |
virtual | ~BaseIO () |
Destructor the BaseIO class. | |
virtual std::string | getFileName () const |
Returns the full path to the file. | |
virtual Status | open ()=0 |
Opens the file for writing. | |
virtual Status | open (bool newfile)=0 |
Opens an existing file or creates a new file for writing. | |
virtual Status | close ()=0 |
Closes the file. | |
virtual Status | flush ()=0 |
Flush data to disk. | |
virtual Status | createAttribute (const BaseDataType &type, const void *data, const std::string &path, const std::string &name, const SizeType &size=1)=0 |
Creates an attribute at a given location in the file. | |
virtual Status | createAttribute (const std::string &data, const std::string &path, const std::string &name)=0 |
Creates a string attribute at a given location in the file. | |
virtual Status | createAttribute (const std::vector< std::string > &data, const std::string &path, const std::string &name)=0 |
Creates a string array attribute at a given location in the file. | |
virtual Status | createAttribute (const std::vector< const char * > &data, const std::string &path, const std::string &name, const SizeType &maxSize)=0 |
Creates a string array attribute at a given location in the file. | |
virtual Status | createReferenceAttribute (const std::string &referencePath, const std::string &path, const std::string &name)=0 |
Sets an object reference attribute for a given location in the file. | |
virtual Status | createGroup (const std::string &path)=0 |
Creates a new group in the file. | |
virtual Status | createLink (const std::string &path, const std::string &reference)=0 |
Creates a soft link to another location in the file. | |
virtual Status | createStringDataSet (const std::string &path, const std::string &value)=0 |
Creates a non-modifiable dataset with a string value. | |
virtual Status | createStringDataSet (const std::string &path, const std::vector< std::string > &values)=0 |
Creates a dataset that holds an array of string values. | |
virtual Status | createReferenceDataSet (const std::string &path, const std::vector< std::string > &references)=0 |
Creates a dataset that holds an array of references to groups within the file. | |
virtual Status | startRecording ()=0 |
Starts the recording process. | |
virtual Status | stopRecording ()=0 |
Stops the recording process. | |
virtual bool | canModifyObjects () |
Returns true if the file is in a mode where objects can be added or deleted. Note, this does not apply to the modification of raw data on already existing objects. Derived classes should override this function to check if objects can be modified. | |
virtual std::unique_ptr< BaseRecordingData > | createArrayDataSet (const BaseDataType &type, const SizeArray &size, const SizeArray &chunking, const std::string &path)=0 |
Creates an extendable dataset with a given base data type, size, chunking, and path. | |
virtual std::unique_ptr< BaseRecordingData > | getDataSet (const std::string &path)=0 |
Returns a pointer to a dataset at a given path. | |
virtual bool | objectExists (const std::string &path)=0 |
Checks whether a Dataset, Group, or Link already exists at the location in the file. | |
Status | createCommonNWBAttributes (const std::string &path, const std::string &objectNamespace, const std::string &neurodataType="", const std::string &description="") |
Convenience function for creating NWB related attributes. | |
Status | createDataAttributes (const std::string &path, const float &conversion, const float &resolution, const std::string &unit) |
Convenience function for creating data related attributes. | |
Status | createTimestampsAttributes (const std::string &path) |
Convenience function for creating timestamp related attributes. | |
bool | isOpen () const |
Returns true if the file is open. | |
bool | isReadyToOpen () const |
Returns true if the file is able to be opened. | |
Protected Member Functions | |
virtual Status | createGroupIfDoesNotExist (const std::string &path)=0 |
Creates a new group if it does not already exist. | |
Protected Attributes | |
const std::string | m_filename |
The name of the file. | |
bool | m_readyToOpen |
Whether the file is ready to be opened. | |
bool | m_opened |
Whether the file is currently open. | |
The BaseIO class is an abstract base class that defines the interface for input/output (IO) operations on a file.
This class provides pure virtual methods that must be implemented by all IO classes. It also includes other methods for common IO operations.
BaseIO::BaseIO | ( | const std::string & | filename | ) |
Constructor for the BaseIO class.
|
delete |
Copy constructor is deleted to prevent construction-copying.
|
virtual |
Destructor the BaseIO class.
|
inlinevirtual |
Returns true if the file is in a mode where objects can be added or deleted. Note, this does not apply to the modification of raw data on already existing objects. Derived classes should override this function to check if objects can be modified.
Reimplemented in AQNWB::HDF5::HDF5IO.
|
pure virtual |
Closes the file.
Implemented in AQNWB::HDF5::HDF5IO.
|
pure virtual |
Creates an extendable dataset with a given base data type, size, chunking, and path.
type | The base data type of the dataset. |
size | The size of the dataset. |
chunking | The chunking size of the dataset. |
path | The location in the file of the new dataset. |
Implemented in AQNWB::HDF5::HDF5IO.
|
pure virtual |
Creates an attribute at a given location in the file.
type | The base data type of the attribute. |
data | Pointer to the attribute data. |
path | The location in the file to set the attribute. |
name | The name of the attribute. |
size | The size of the attribute (default is 1). |
Implemented in AQNWB::HDF5::HDF5IO.
|
pure virtual |
Creates a string attribute at a given location in the file.
data | The string attribute data. |
path | The location in the file to set the attribute. |
name | The name of the attribute. |
Implemented in AQNWB::HDF5::HDF5IO.
|
pure virtual |
Creates a string array attribute at a given location in the file.
data | The string array attribute data. |
path | The location in the file to set the attribute. |
name | The name of the attribute. |
maxSize | The maximum size of the string. |
Implemented in AQNWB::HDF5::HDF5IO.
|
pure virtual |
Creates a string array attribute at a given location in the file.
data | The string array attribute data. |
path | The location in the file to set the attribute. |
name | The name of the attribute. |
Implemented in AQNWB::HDF5::HDF5IO.
Status BaseIO::createCommonNWBAttributes | ( | const std::string & | path, |
const std::string & | objectNamespace, | ||
const std::string & | neurodataType = "", | ||
const std::string & | description = "" ) |
Convenience function for creating NWB related attributes.
path | The location of the object in the file. |
objectNamespace | The namespace of the object. |
neurodataType | The neurodata type of the object. |
description | The description of the object (default is empty). |
Status BaseIO::createDataAttributes | ( | const std::string & | path, |
const float & | conversion, | ||
const float & | resolution, | ||
const std::string & | unit ) |
Convenience function for creating data related attributes.
path | The location of the object in the file. |
conversion | Scalar to multiply each element in data to convert it to the specified ‘unit’. |
resolution | Smallest meaningful difference between values in data. |
unit | Base unit of measurement for working with the data. |
|
pure virtual |
Creates a new group in the file.
path | The location in the file of the new group. |
Implemented in AQNWB::HDF5::HDF5IO.
|
protectedpure virtual |
Creates a new group if it does not already exist.
path | The location of the group in the file. |
Implemented in AQNWB::HDF5::HDF5IO.
|
pure virtual |
Creates a soft link to another location in the file.
path | The location in the file to the new link. |
reference | The location in the file of the object that is being linked to. |
Implemented in AQNWB::HDF5::HDF5IO.
|
pure virtual |
Sets an object reference attribute for a given location in the file.
referencePath | The full path to the referenced group / dataset. |
path | The location in the file to set the attribute. |
name | The name of the attribute. |
Implemented in AQNWB::HDF5::HDF5IO.
|
pure virtual |
Creates a dataset that holds an array of references to groups within the file.
path | The location in the file of the new dataset. |
references | The array of references. |
Implemented in AQNWB::HDF5::HDF5IO.
|
pure virtual |
Creates a non-modifiable dataset with a string value.
path | The location in the file of the dataset. |
value | The string value of the dataset. |
Implemented in AQNWB::HDF5::HDF5IO.
|
pure virtual |
Creates a dataset that holds an array of string values.
path | The location in the file of the dataset. |
values | The vector of string values of the dataset. |
Implemented in AQNWB::HDF5::HDF5IO.
Status BaseIO::createTimestampsAttributes | ( | const std::string & | path | ) |
Convenience function for creating timestamp related attributes.
path | The location of the object in the file. |
|
pure virtual |
|
pure virtual |
Returns a pointer to a dataset at a given path.
path | The location in the file of the dataset. |
Implemented in AQNWB::HDF5::HDF5IO.
|
inlinevirtual |
Returns the full path to the file.
|
inline |
Returns true if the file is open.
|
inline |
Returns true if the file is able to be opened.
|
pure virtual |
Checks whether a Dataset, Group, or Link already exists at the location in the file.
path | The location of the object in the file. |
Implemented in AQNWB::HDF5::HDF5IO.
|
pure virtual |
Opens the file for writing.
Implemented in AQNWB::HDF5::HDF5IO.
|
pure virtual |
Opens an existing file or creates a new file for writing.
newfile | Flag indicating whether to create a new file. |
Implemented in AQNWB::HDF5::HDF5IO.
Assignment operator is deleted to prevent copying.
|
pure virtual |
Starts the recording process.
Implemented in AQNWB::HDF5::HDF5IO.
|
pure virtual |
Stops the recording process.
Implemented in AQNWB::HDF5::HDF5IO.
|
protected |
The name of the file.
|
protected |
Whether the file is currently open.
|
protected |
Whether the file is ready to be opened.