aqnwb 0.1.0
Loading...
Searching...
No Matches
AQNWB::NWB::DynamicTable Class Reference

Represents a group containing multiple datasets that are aligned on the first dimension. More...

#include <DynamicTable.hpp>

Inheritance diagram for AQNWB::NWB::DynamicTable:
[legend]
Collaboration diagram for AQNWB::NWB::DynamicTable:
[legend]

Public Member Functions

 DynamicTable (const std::string &path, std::shared_ptr< IO::BaseIO > io)
 Constructor.
 
virtual ~DynamicTable ()
 Destructor.
 
Status initialize (const std::string &description)
 Initializes the DynamicTable object by creating NWB attributes and column names.
 
Status finalize ()
 Finalizes writing the DynamicTable.
 
Status addColumn (std::unique_ptr< VectorData > &vectorData, const std::vector< std::string > &values)
 Adds a column of vector string data to the table.
 
Status addReferenceColumn (const std::string &name, const std::string &colDescription, const std::vector< std::string > &dataset)
 Adds a column of references to the table.
 
Status setRowIDs (std::unique_ptr< ElementIdentifiers > &elementIDs, const std::vector< int > &values)
 Adds a column of element identifiers to the table.
 
virtual void setColNames (const std::vector< std::string > &newColNames)
 Sets the column names of the DynamicTable.
 
template<typename DTYPE = std::any>
std::shared_ptr< VectorDataTyped< DTYPE > > readColumn (const std::string &colName)
 Read an arbitrary column of the DyanmicTable.
 
template<typename VTYPE = std::string>
std::unique_ptr< IO::ReadDataWrapper< AttributeField, VTYPE > > readColNames () const
 
template<typename VTYPE = std::string>
std::unique_ptr< IO::ReadDataWrapper< AttributeField, VTYPE > > readDescription () const
 
template<typename RTYPE = ElementIdentifiers>
std::shared_ptr< RTYPE > readIdColumn () const
 
- Public Member Functions inherited from AQNWB::NWB::Container
 Container (const std::string &path, std::shared_ptr< IO::BaseIO > io)
 Constructor.
 
virtual ~Container ()
 Destructor.
 
Status initialize ()
 Initialize the container.
 
template<typename VTYPE = std::string>
std::unique_ptr< IO::ReadDataWrapper< AttributeField, VTYPE > > readNeurodataType () const
 
template<typename VTYPE = std::string>
std::unique_ptr< IO::ReadDataWrapper< AttributeField, VTYPE > > readNamespace () const
 
- Public Member Functions inherited from AQNWB::NWB::RegisteredType
 RegisteredType (const std::string &path, std::shared_ptr< IO::BaseIO > io)
 Constructor.
 
virtual ~RegisteredType ()
 Destructor.
 
std::string getPath () const
 Gets the path of the registered type.
 
std::string getName () const
 Get the name of the object.
 
std::shared_ptr< IO::BaseIOgetIO () const
 Get a shared pointer to the IO object.
 
virtual std::string getTypeName () const
 Get the name of the class type.
 
virtual std::string getNamespace () const
 Get the schema namespace of the class type.
 
std::string getFullTypeName () const
 Get the full name of the type, i.e., namespace::typename
 
template<StorageObjectType SOT, typename VTYPE, typename std::enable_if< Types::IsDataStorageObjectType< SOT >::value, int >::type = 0>
std::unique_ptr< IO::ReadDataWrapper< SOT, VTYPE > > readField (const std::string &fieldPath) const
 Support reading of arbitrary fields by their relative path.
 
std::shared_ptr< AQNWB::NWB::RegisteredTypereadField (const std::string &fieldPath) const
 Read a field that is itself a RegisteredType.
 
virtual std::unordered_map< std::string, std::string > findOwnedTypes (const std::unordered_set< std::string > &types={}, const IO::SearchMode &search_mode=IO::SearchMode::STOP_ON_TYPE) const
 Find all typed objects that are owned by this object, i.e., objects that have a neurodata_type and namespace attribute and have this object as there closest parent with an assigned type.
 

Protected Attributes

std::vector< std::string > m_colNames
 Names of the columns in the table.
 
- Protected Attributes inherited from AQNWB::NWB::RegisteredType
std::string m_path
 The path of the registered type.
 
std::shared_ptr< IO::BaseIOm_io
 A shared pointer to the IO object.
 

Additional Inherited Members

- Static Public Member Functions inherited from AQNWB::NWB::RegisteredType
static std::unordered_set< std::string > & getRegistry ()
 Get the registry of subclass names.
 
static std::unordered_map< std::string, std::pair< std::function< std::unique_ptr< RegisteredType >(const std::string &, std::shared_ptr< IO::BaseIO >)>, std::pair< std::string, std::string > > > & getFactoryMap ()
 Get the factory map for creating instances of subclasses.
 
static std::shared_ptr< RegisteredTypecreate (const std::string &fullClassName, const std::string &path, std::shared_ptr< IO::BaseIO > io, bool fallbackToBase=false)
 Create an instance of a registered subclass by name.
 
static std::shared_ptr< AQNWB::NWB::RegisteredTypecreate (const std::string &path, std::shared_ptr< IO::BaseIO > io, bool fallbackToBase=false)
 Factory method to create an instance of a subclass of RegisteredType from file.
 
template<typename T>
static std::shared_ptr< T > create (const std::string &path, std::shared_ptr< IO::BaseIO > io)
 Factory method to create an instance of a subclass of RegisteredType by type.
 
- Static Protected Member Functions inherited from AQNWB::NWB::RegisteredType
static void registerSubclass (const std::string &fullClassName, std::function< std::unique_ptr< RegisteredType >(const std::string &, std::shared_ptr< IO::BaseIO >)> factoryFunction, const std::string &typeName, const std::string &typeNamespace)
 Register a subclass name and its factory function in the registry.
 
- Static Protected Attributes inherited from AQNWB::NWB::RegisteredType
static const std::string m_defaultUnregisteredGroupTypeClass
 Save the default RegisteredType to use for reading Group types that are not registered.
 
static const std::string m_defaultUnregisteredDatasetTypeClass
 Save the default RegisteredType to use for reading Dataset types that are not registered.
 

Detailed Description

Represents a group containing multiple datasets that are aligned on the first dimension.

This class inherits from the Container class and provides methods to add columns of different types of data to the table.

Constructor & Destructor Documentation

◆ DynamicTable()

DynamicTable::DynamicTable ( const std::string & path,
std::shared_ptr< IO::BaseIO > io )

Constructor.

Parameters
pathThe location of the table in the file.
ioA shared pointer to the IO object.

Constructor

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~DynamicTable()

DynamicTable::~DynamicTable ( )
virtual

Destructor.

Destructor

Member Function Documentation

◆ addColumn()

Status DynamicTable::addColumn ( std::unique_ptr< VectorData > & vectorData,
const std::vector< std::string > & values )

Adds a column of vector string data to the table.

Parameters
vectorDataA unique pointer to the VectorData dataset.
valuesThe vector of string values.
Returns
Status::Success if successful, otherwise Status::Failure.

Add column to table

Here is the caller graph for this function:

◆ addReferenceColumn()

Status DynamicTable::addReferenceColumn ( const std::string & name,
const std::string & colDescription,
const std::vector< std::string > & dataset )

Adds a column of references to the table.

Parameters
nameThe name of the column.
colDescriptionThe description of the column.
datasetThe vector of string values representing the references.
Returns
Status::Success if successful, otherwise Status::Failure.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ finalize()

Status DynamicTable::finalize ( )

Finalizes writing the DynamicTable.

Finalizes the DynamicTable by writing the column names as a single write once the table has been set up

Returns
Status::Success if successful, otherwise Status::Failure.
Here is the caller graph for this function:

◆ initialize()

Status DynamicTable::initialize ( const std::string & description)

Initializes the DynamicTable object by creating NWB attributes and column names.

Parameters
descriptionThe description of the table (optional).
Returns
Status::Success if successful, otherwise Status::Failure.

Initialization function

Here is the call graph for this function:

◆ readColNames()

template<typename VTYPE = std::string>
std::unique_ptr< IO::ReadDataWrapper< AttributeField, VTYPE > > AQNWB::NWB::DynamicTable::readColNames ( ) const
inline

The names of the columns in the table

Here is the call graph for this function:

◆ readColumn()

template<typename DTYPE = std::any>
std::shared_ptr< VectorDataTyped< DTYPE > > AQNWB::NWB::DynamicTable::readColumn ( const std::string & colName)
inline

Read an arbitrary column of the DyanmicTable.

For columns defined in the schema the corresponding DEFINE_REGISTERED_FIELD read functions are preferred because they help avoid the need for specifying the specific name of the column and data type to use.

Returns
The VectorData object representing the column or a nullptr if the column doesn't exists
Here is the call graph for this function:

◆ readDescription()

template<typename VTYPE = std::string>
std::unique_ptr< IO::ReadDataWrapper< AttributeField, VTYPE > > AQNWB::NWB::DynamicTable::readDescription ( ) const
inline

Description of what is in this dynamic table

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readIdColumn()

template<typename RTYPE = ElementIdentifiers>
std::shared_ptr< RTYPE > AQNWB::NWB::DynamicTable::readIdColumn ( ) const
inline

"unique identifiers for the rows of this dynamic table"

Here is the caller graph for this function:

◆ setColNames()

virtual void AQNWB::NWB::DynamicTable::setColNames ( const std::vector< std::string > & newColNames)
inlinevirtual

Sets the column names of the DynamicTable.

..note:: For this change to take affect in the file we need to call finalize() after setting the column names to write the data to the file.

.. warning:: This will overwrite any existing column names. It is up to the caller to ensure that all existing columns are included in the new list.

Parameters
newColNamesThe vector of new column names.

◆ setRowIDs()

Status DynamicTable::setRowIDs ( std::unique_ptr< ElementIdentifiers > & elementIDs,
const std::vector< int > & values )

Adds a column of element identifiers to the table.

Parameters
elementIDsA unique pointer to the ElementIdentifiers dataset.
valuesThe vector of id values.
Returns
Status::Success if successful, otherwise Status::Failure.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_colNames

std::vector<std::string> AQNWB::NWB::DynamicTable::m_colNames
protected

Names of the columns in the table.


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