aqnwb 0.1.0
Loading...
Searching...
No Matches
VectorData.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4
5#include "Utils.hpp"
6#include "io/ReadIO.hpp"
8
9namespace AQNWB::NWB
10{
14class VectorData : public Data
15{
16public:
17 REGISTER_SUBCLASS(VectorData, "hdmf-common")
18
19
25 VectorData(const std::string& path, std::shared_ptr<IO::BaseIO> io);
26
30 virtual ~VectorData() override {}
31
42 Status initialize(std::unique_ptr<IO::BaseRecordingData>&& dataset,
43 const std::string& description)
44 {
45 Status dataStatus = Data::initialize(std::move(dataset));
46 Status attrStatus =
47 m_io->createAttribute(description, m_path, "description");
48 return dataStatus && attrStatus;
49 }
50
53 std::string,
54 "description",
55 Description of what these vectors represent)
56};
57
72template<typename DTYPE = std::any>
74{
75public:
82 VectorDataTyped(const std::string& path, std::shared_ptr<IO::BaseIO> io)
83 : VectorData(path, io)
84 {
85 }
86
90 virtual ~VectorDataTyped() override {}
91
105 static std::shared_ptr<VectorDataTyped<DTYPE>> fromVectorData(
106 const VectorData& data)
107 {
108 return std::make_shared<VectorDataTyped<DTYPE>>(data.getPath(),
109 data.getIO());
110 }
111
114
115 // Define the data fields to expose for lazy read access
116 DEFINE_FIELD(readData, DatasetField, DTYPE, "", The main data)
117};
118} // namespace AQNWB::NWB
AQNWB::Types::Status Status
Definition BaseIO.hpp:22
#define REGISTER_SUBCLASS(T, NAMESPACE)
Macro to register a subclass with the RegisteredType class registry.
Definition RegisteredType.hpp:373
#define DEFINE_FIELD(name, storageObjectType, default_type, fieldPath, description)
Defines a lazy-loaded field accessor function.
Definition RegisteredType.hpp:407
Status initialize(std::unique_ptr< IO::BaseRecordingData > &&dataset)
Initialize the dataset for the Data object.
Definition Data.hpp:41
Data(const std::string &path, std::shared_ptr< IO::BaseIO > io)
Constructor.
Definition Data.cpp:9
std::string m_path
The path of the registered type.
Definition RegisteredType.hpp:318
std::shared_ptr< IO::BaseIO > m_io
A shared pointer to the IO object.
Definition RegisteredType.hpp:323
std::string getPath() const
Gets the path of the registered type.
Definition RegisteredType.hpp:70
std::shared_ptr< IO::BaseIO > getIO() const
Get a shared pointer to the IO object.
Definition RegisteredType.hpp:88
Status initialize(std::unique_ptr< IO::BaseRecordingData > &&dataset, const std::string &description)
Initialize the dataset for the VectorData object.
Definition VectorData.hpp:42
std::unique_ptr< IO::ReadDataWrapper< AttributeField, VTYPE > > readDescription() const
VectorData(const std::string &path, std::shared_ptr< IO::BaseIO > io)
Constructor.
Definition VectorData.cpp:8
virtual ~VectorData() override
Virtual destructor.
Definition VectorData.hpp:30
static std::shared_ptr< VectorDataTyped< DTYPE > > fromVectorData(const VectorData &data)
Create a VectorDataTyped object from a Data object.
Definition VectorData.hpp:105
std::unique_ptr< IO::ReadDataWrapper< DatasetField, VTYPE > > readData() const
VectorDataTyped(const std::string &path, std::shared_ptr< IO::BaseIO > io)
Constructor.
Definition VectorData.hpp:82
virtual ~VectorDataTyped() override
Virtual destructor.
Definition VectorData.hpp:90
Namespace for all classes related to the NWB data standard.
Definition TimeSeries.hpp:12
constexpr auto AttributeField
Alias for AQNWB::Types::StorageObjectType::Attribute.
Definition RegisteredType.hpp:23
constexpr auto DatasetField
Alias for AQNWB::Types::StorageObjectType::Dataset.
Definition RegisteredType.hpp:28