aqnwb 0.2.0
Loading...
Searching...
No Matches
NWBData.hpp
Go to the documentation of this file.
1#pragma once
2
3// Common STL includes
4#include <any>
5#include <memory>
6#include <optional>
7#include <string>
8#include <vector>
9// Base AqNWB includes for IO and RegisteredType
10#include "io/BaseIO.hpp"
11#include "io/ReadIO.hpp"
13// Include for parent type
15// Include for the namespace schema header
16#include "spec/core.hpp"
17
18namespace AQNWB::NWB
19{
20
25{
26public:
27 // Register the NWBData as a subclass of Data
29
30
36
37protected:
43 NWBData(const std::string& path, std::shared_ptr<AQNWB::IO::BaseIO> io);
44};
45
60template<typename DTYPE = std::any>
61class NWBDataTyped : public NWBData
62{
63public:
70 NWBDataTyped(const std::string& path, std::shared_ptr<IO::BaseIO> io)
71 : NWBData(path, io)
72 {
73 }
74
88 static std::shared_ptr<NWBDataTyped<DTYPE>> fromNWBData(const Data& data)
89 {
90 return std::make_shared<NWBDataTyped<DTYPE>>(data.getPath(), data.getIO());
91 }
92
93 // Define the data fields to expose for lazy read access
94 DEFINE_DATASET_FIELD(readData, recordData, DTYPE, "", The main data)
95
98};
99
100} // namespace AQNWB::NWB
AQNWB::Types::Status Status
Definition BaseIO.hpp:22
#define REGISTER_SUBCLASS(T, BASE, NAMESPACE)
Macro to register a subclass with the RegisteredType class registry.
Definition RegisteredType.hpp:501
#define DEFINE_DATASET_FIELD(readName, writeName, default_type, fieldPath, description)
Defines a lazy-loaded dataset field accessor function.
Definition RegisteredType.hpp:573
The configuration for an array dataset.
Definition BaseIO.hpp:204
An abstract data type for a dataset.
Definition Data.hpp:17
Data(const std::string &path, std::shared_ptr< IO::BaseIO > io)
Constructor.
Definition Data.cpp:9
Status initialize(const AQNWB::IO::ArrayDataSetConfig &dataConfig)
Initialize the object.
Definition NWBData.cpp:16
NWBData(const std::string &path, std::shared_ptr< AQNWB::IO::BaseIO > io)
Constructor.
Definition NWBData.cpp:11
NWBDataTyped(const std::string &path, std::shared_ptr< IO::BaseIO > io)
Constructor.
Definition NWBData.hpp:70
std::shared_ptr< AQNWB::IO::BaseRecordingData > recordData(bool reset=false)
static std::shared_ptr< NWBDataTyped< DTYPE > > fromNWBData(const Data &data)
Create a NWBDataTyped object from a Data object.
Definition NWBData.hpp:88
std::unique_ptr< AQNWB::IO::ReadDataWrapper< AQNWB::NWB::DatasetField, VTYPE > > readData() const
std::string m_path
The path of the registered type.
Definition RegisteredType.hpp:410
std::weak_ptr< IO::BaseIO > m_io
A weak pointer to the IO object.
Definition RegisteredType.hpp:422
std::string getPath() const
Gets the path of the registered type.
Definition RegisteredType.hpp:59
std::shared_ptr< AQNWB::IO::BaseIO > getIO() const
Get a shared pointer to the IO object.
Definition RegisteredType.hpp:77
Namespace for all classes related to the NWB data standard.
const std::string namespaceName
Definition core.hpp:21