aqnwb 0.1.0
Loading...
Searching...
No Matches
AQNWB::BaseIO Class Referenceabstract

The BaseIO class is an abstract base class that defines the interface for input/output (IO) operations on a file. More...

#include <BaseIO.hpp>

Inheritance diagram for AQNWB::BaseIO:
[legend]

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.
 
BaseIOoperator= (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< BaseRecordingDatacreateArrayDataSet (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< BaseRecordingDatagetDataSet (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.
 

Detailed Description

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.

Note
This class cannot be instantiated directly as it is an abstract class.

Constructor & Destructor Documentation

◆ BaseIO() [1/2]

BaseIO::BaseIO ( const std::string & filename)

Constructor for the BaseIO class.

◆ BaseIO() [2/2]

AQNWB::BaseIO::BaseIO ( const BaseIO & )
delete

Copy constructor is deleted to prevent construction-copying.

◆ ~BaseIO()

BaseIO::~BaseIO ( )
virtual

Destructor the BaseIO class.

Member Function Documentation

◆ canModifyObjects()

virtual bool AQNWB::BaseIO::canModifyObjects ( )
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.

Returns
True if the file is in a modification mode, false otherwise.

Reimplemented in AQNWB::HDF5::HDF5IO.

◆ close()

virtual Status AQNWB::BaseIO::close ( )
pure virtual

Closes the file.

Returns
The status of the file closing operation.

Implemented in AQNWB::HDF5::HDF5IO.

◆ createArrayDataSet()

virtual std::unique_ptr< BaseRecordingData > AQNWB::BaseIO::createArrayDataSet ( const BaseDataType & type,
const SizeArray & size,
const SizeArray & chunking,
const std::string & path )
pure virtual

Creates an extendable dataset with a given base data type, size, chunking, and path.

Parameters
typeThe base data type of the dataset.
sizeThe size of the dataset.
chunkingThe chunking size of the dataset.
pathThe location in the file of the new dataset.
Returns
A pointer to the created dataset.

Implemented in AQNWB::HDF5::HDF5IO.

◆ createAttribute() [1/4]

virtual Status AQNWB::BaseIO::createAttribute ( const BaseDataType & type,
const void * data,
const std::string & path,
const std::string & name,
const SizeType & size = 1 )
pure virtual

Creates an attribute at a given location in the file.

Parameters
typeThe base data type of the attribute.
dataPointer to the attribute data.
pathThe location in the file to set the attribute.
nameThe name of the attribute.
sizeThe size of the attribute (default is 1).
Returns
The status of the attribute creation operation.

Implemented in AQNWB::HDF5::HDF5IO.

Here is the caller graph for this function:

◆ createAttribute() [2/4]

virtual Status AQNWB::BaseIO::createAttribute ( const std::string & data,
const std::string & path,
const std::string & name )
pure virtual

Creates a string attribute at a given location in the file.

Parameters
dataThe string attribute data.
pathThe location in the file to set the attribute.
nameThe name of the attribute.
Returns
The status of the attribute creation operation.

Implemented in AQNWB::HDF5::HDF5IO.

◆ createAttribute() [3/4]

virtual Status AQNWB::BaseIO::createAttribute ( const std::vector< const char * > & data,
const std::string & path,
const std::string & name,
const SizeType & maxSize )
pure virtual

Creates a string array attribute at a given location in the file.

Parameters
dataThe string array attribute data.
pathThe location in the file to set the attribute.
nameThe name of the attribute.
maxSizeThe maximum size of the string.
Returns
The status of the attribute creation operation.

Implemented in AQNWB::HDF5::HDF5IO.

◆ createAttribute() [4/4]

virtual Status AQNWB::BaseIO::createAttribute ( const std::vector< std::string > & data,
const std::string & path,
const std::string & name )
pure virtual

Creates a string array attribute at a given location in the file.

Parameters
dataThe string array attribute data.
pathThe location in the file to set the attribute.
nameThe name of the attribute.
Returns
The status of the attribute creation operation.

Implemented in AQNWB::HDF5::HDF5IO.

◆ createCommonNWBAttributes()

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.

Parameters
pathThe location of the object in the file.
objectNamespaceThe namespace of the object.
neurodataTypeThe neurodata type of the object.
descriptionThe description of the object (default is empty).
Returns
The status of the operation.
Here is the call graph for this function:

◆ createDataAttributes()

Status BaseIO::createDataAttributes ( const std::string & path,
const float & conversion,
const float & resolution,
const std::string & unit )

Convenience function for creating data related attributes.

Parameters
pathThe location of the object in the file.
conversionScalar to multiply each element in data to convert it to the specified ‘unit’.
resolutionSmallest meaningful difference between values in data.
unitBase unit of measurement for working with the data.
Returns
The status of the operation.
Here is the call graph for this function:

◆ createGroup()

virtual Status AQNWB::BaseIO::createGroup ( const std::string & path)
pure virtual

Creates a new group in the file.

Parameters
pathThe location in the file of the new group.
Returns
The status of the group creation operation.

Implemented in AQNWB::HDF5::HDF5IO.

◆ createGroupIfDoesNotExist()

virtual Status AQNWB::BaseIO::createGroupIfDoesNotExist ( const std::string & path)
protectedpure virtual

Creates a new group if it does not already exist.

Parameters
pathThe location of the group in the file.
Returns
The status of the operation.

Implemented in AQNWB::HDF5::HDF5IO.

◆ createLink()

virtual Status AQNWB::BaseIO::createLink ( const std::string & path,
const std::string & reference )
pure virtual

Creates a soft link to another location in the file.

Parameters
pathThe location in the file to the new link.
referenceThe location in the file of the object that is being linked to.
Returns
The status of the link creation operation.

Implemented in AQNWB::HDF5::HDF5IO.

◆ createReferenceAttribute()

virtual Status AQNWB::BaseIO::createReferenceAttribute ( const std::string & referencePath,
const std::string & path,
const std::string & name )
pure virtual

Sets an object reference attribute for a given location in the file.

Parameters
referencePathThe full path to the referenced group / dataset.
pathThe location in the file to set the attribute.
nameThe name of the attribute.
Returns
The status of the attribute creation operation.

Implemented in AQNWB::HDF5::HDF5IO.

◆ createReferenceDataSet()

virtual Status AQNWB::BaseIO::createReferenceDataSet ( const std::string & path,
const std::vector< std::string > & references )
pure virtual

Creates a dataset that holds an array of references to groups within the file.

Parameters
pathThe location in the file of the new dataset.
referencesThe array of references.
Returns
The status of the dataset creation operation.

Implemented in AQNWB::HDF5::HDF5IO.

◆ createStringDataSet() [1/2]

virtual Status AQNWB::BaseIO::createStringDataSet ( const std::string & path,
const std::string & value )
pure virtual

Creates a non-modifiable dataset with a string value.

Parameters
pathThe location in the file of the dataset.
valueThe string value of the dataset.
Returns
The status of the dataset creation operation.

Implemented in AQNWB::HDF5::HDF5IO.

◆ createStringDataSet() [2/2]

virtual Status AQNWB::BaseIO::createStringDataSet ( const std::string & path,
const std::vector< std::string > & values )
pure virtual

Creates a dataset that holds an array of string values.

Parameters
pathThe location in the file of the dataset.
valuesThe vector of string values of the dataset.
Returns
The status of the dataset creation operation.

Implemented in AQNWB::HDF5::HDF5IO.

◆ createTimestampsAttributes()

Status BaseIO::createTimestampsAttributes ( const std::string & path)

Convenience function for creating timestamp related attributes.

Parameters
pathThe location of the object in the file.
Returns
The status of the operation.
Here is the call graph for this function:

◆ flush()

virtual Status AQNWB::BaseIO::flush ( )
pure virtual

Flush data to disk.

Returns
The status of the flush operation.

Implemented in AQNWB::HDF5::HDF5IO.

◆ getDataSet()

virtual std::unique_ptr< BaseRecordingData > AQNWB::BaseIO::getDataSet ( const std::string & path)
pure virtual

Returns a pointer to a dataset at a given path.

Parameters
pathThe location in the file of the dataset.
Returns
A pointer to the dataset.

Implemented in AQNWB::HDF5::HDF5IO.

◆ getFileName()

virtual std::string AQNWB::BaseIO::getFileName ( ) const
inlinevirtual

Returns the full path to the file.

Returns
The full path to the file.
Here is the caller graph for this function:

◆ isOpen()

bool AQNWB::BaseIO::isOpen ( ) const
inline

Returns true if the file is open.

Returns
True if the file is open, false otherwise.

◆ isReadyToOpen()

bool AQNWB::BaseIO::isReadyToOpen ( ) const
inline

Returns true if the file is able to be opened.

Returns
True if the file is able to be opened, false otherwise.

◆ objectExists()

virtual bool AQNWB::BaseIO::objectExists ( const std::string & path)
pure virtual

Checks whether a Dataset, Group, or Link already exists at the location in the file.

Parameters
pathThe location of the object in the file.
Returns
Whether the object exists.

Implemented in AQNWB::HDF5::HDF5IO.

◆ open() [1/2]

virtual Status AQNWB::BaseIO::open ( )
pure virtual

Opens the file for writing.

Returns
The status of the file opening operation.

Implemented in AQNWB::HDF5::HDF5IO.

◆ open() [2/2]

virtual Status AQNWB::BaseIO::open ( bool newfile)
pure virtual

Opens an existing file or creates a new file for writing.

Parameters
newfileFlag indicating whether to create a new file.
Returns
The status of the file opening operation.

Implemented in AQNWB::HDF5::HDF5IO.

◆ operator=()

BaseIO & AQNWB::BaseIO::operator= ( const BaseIO & )
delete

Assignment operator is deleted to prevent copying.

◆ startRecording()

virtual Status AQNWB::BaseIO::startRecording ( )
pure virtual

Starts the recording process.

Returns
The status of the operation.

Implemented in AQNWB::HDF5::HDF5IO.

◆ stopRecording()

virtual Status AQNWB::BaseIO::stopRecording ( )
pure virtual

Stops the recording process.

Returns
The status of the operation.

Implemented in AQNWB::HDF5::HDF5IO.

Member Data Documentation

◆ m_filename

const std::string AQNWB::BaseIO::m_filename
protected

The name of the file.

◆ m_opened

bool AQNWB::BaseIO::m_opened
protected

Whether the file is currently open.

◆ m_readyToOpen

bool AQNWB::BaseIO::m_readyToOpen
protected

Whether the file is ready to be opened.


The documentation for this class was generated from the following files: