47 VectorIndex(
const std::string& path, std::shared_ptr<AQNWB::IO::BaseIO> io);
58 const std::string& columnDescription,
59 const std::string& columnTargetPath)
73 auto* vectorIndex =
dynamic_cast<VectorIndex*
>(&data);
75 std::cerr <<
"VectorIndex::DataSpec::initialize received incompatible "
78 return Status::Failure;
80 return vectorIndex->initialize(
105 const std::string& description,
106 const std::string& targetPath);
122 size_t& elementsAppended)
override;
157 "Reference to the target dataset that this index applies to.")
162 "Description of what these vectors represent.")
169 "Used with VectorData to encode a ragged array. An array of indices into "
170 "the first dimension of the target VectorData - and forming a map "
171 "between the rows of a DynamicTable and the indices of the VectorData. "
172 "The name of the VectorIndex is expected to be the name of the target "
173 "VectorData object followed by _index.")
AQNWB::Types::Status Status
Definition BaseIO.hpp:21
AQNWB::Types::SizeType SizeType
Definition Channel.hpp:8
#define DEFINE_REFERENCED_REGISTERED_FIELD(name, registeredType, fieldPath, description)
Defines a lazy-loaded accessor function for reading fields that are RegisteredTypes that are linked t...
Definition RegisteredType.hpp:766
#define REGISTER_SUBCLASS(T, BASE, NAMESPACE)
Macro to register a subclass with the RegisteredType class registry.
Definition RegisteredType.hpp:547
#define DEFINE_ATTRIBUTE_FIELD(name, default_type, fieldPath, description)
Defines a lazy-loaded attribute field accessor function.
Definition RegisteredType.hpp:580
#define DEFINE_DATASET_FIELD(readName, writeName, default_type, fieldPath, description)
Defines a lazy-loaded dataset field accessor function.
Definition RegisteredType.hpp:619
The configuration for an array dataset.
Definition BaseIO.hpp:321
Base class for array dataset configuration.
Definition BaseIO.hpp:277
An abstract data type for a dataset.
Definition Data.hpp:21
An n-dimensional dataset representing a column of a DynamicTable.
Definition VectorData.hpp:23
VectorData(const std::string &path, std::shared_ptr< IO::BaseIO > io)
Constructor.
Definition VectorData.cpp:10
uint64_t m_currentIndex
The current index value, representing the total number of elements currently in the target VectorData...
Definition VectorIndex.hpp:185
std::shared_ptr< RTYPE > readTarget() const
bool m_dataTypeInitialized
Flag indicating whether m_dataType has been initialized.
Definition VectorIndex.hpp:207
std::shared_ptr< VectorData > getTargetColumn()
Gets the cached target VectorData column, or reads it if not cached.
Definition VectorIndex.cpp:84
Status appendData(const AQNWB::Types::CellValue &targetValues, size_t &elementsAppended) override
Appends data to the target VectorData and updates this index.
Definition VectorIndex.cpp:469
uint64_t extractIndexValue(const AQNWB::Types::CellValue &cell) const
Extracts the integer index value from a CellValue variant.
Definition VectorIndex.cpp:92
IO::BaseDataType m_dataType
Cached data type of the VectorIndex dataset.
Definition VectorIndex.hpp:202
std::vector< AQNWB::Types::CellValue > readIndexedCellValues(SizeType start=0, SizeType count=AQNWB::Types::SizeTypeNotSet)
Reads a range of ragged array vectors from the target VectorData.
Definition VectorIndex.cpp:199
std::unique_ptr< AQNWB::IO::ReadDataWrapper< AQNWB::NWB::AttributeField, VTYPE > > readDescription() const
Status initialize(const IO::BaseArrayDataSetConfig &dataConfig, const std::string &description, const std::string &targetPath)
Initialize the dataset for the VectorIndex object.
Definition VectorIndex.cpp:21
AQNWB::Types::CellValue combineCellsToVector(const std::vector< AQNWB::Types::CellValue > &cells, size_t offset, size_t count) const
Combines multiple scalar CellValues into a single vector CellValue.
Definition VectorIndex.cpp:123
VectorIndex(const std::string &path, std::shared_ptr< AQNWB::IO::BaseIO > io)
Constructor.
Definition VectorIndex.cpp:14
bool m_currentIndexInitialized
Flag indicating whether m_currentIndex has been initialized from the file.
Definition VectorIndex.hpp:191
std::shared_ptr< VectorData > m_targetColumn
Cached target VectorData column to avoid reading it from the file repeatedly.
Definition VectorIndex.hpp:197
Status initializeAppendState()
Initializes m_currentIndex and m_dataType by reading the last value from the dataset,...
Definition VectorIndex.cpp:366
std::unique_ptr< AQNWB::IO::ReadDataWrapper< AQNWB::NWB::DatasetField, VTYPE > > readData() const
virtual ~VectorIndex() override
Virtual destructor.
Definition VectorIndex.hpp:90
std::shared_ptr< AQNWB::IO::BaseRecordingData > recordData(bool reset=false)
The namespace for IO components of AqNWB.
Namespace for all classes related to the NWB data standard.
AQNWB::Types::CellValue CellValue
Definition Data.hpp:14
The namespace for managing format schema and namespaces.
Provides definitions for various types used in the project.
Definition Types.hpp:24
constexpr SizeType SizeTypeNotSet
Value to use to indicate that a SizeType index is not set.
Definition Types.hpp:109
The main namespace for AqNWB.
Definition Channel.hpp:11
Typed runtime configuration for a concrete Data subclass.
Definition Data.hpp:79
virtual ~DataSpec()=default
Status initialize(Data &data) const override
Initialize the created concrete Data object from this spec.
Definition VectorIndex.hpp:71
DataSpec(const std::string &datasetName, const IO::ArrayDataSetConfig &dataConfig, const std::string &columnDescription, const std::string &columnTargetPath)
Definition VectorIndex.hpp:56
std::string description
Definition VectorIndex.hpp:68
std::string targetPath
Definition VectorIndex.hpp:69
Represents a single cell value in a DynamicTable row.
Definition Types.hpp:190