aqnwb 0.1.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:
32 NWBData(const std::string& path, std::shared_ptr<AQNWB::IO::BaseIO> io);
33
40
42};
43
58template<typename DTYPE = std::any>
59class NWBDataTyped : public NWBData
60{
61public:
68 NWBDataTyped(const std::string& path, std::shared_ptr<IO::BaseIO> io)
69 : NWBData(path, io)
70 {
71 }
72
85 static std::shared_ptr<NWBDataTyped<DTYPE>> fromNWBData(const Data& data)
86 {
87 return std::make_shared<NWBDataTyped<DTYPE>>(data.getPath(), data.getIO());
88 }
89
90 // Define the data fields to expose for lazy read access
91 DEFINE_DATASET_FIELD(readData, recordData, DTYPE, "", The main data)
92
95};
96
97} // 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:410
#define DEFINE_DATASET_FIELD(readName, writeName, default_type, fieldPath, description)
Defines a lazy-loaded dataset field accessor function.
Definition RegisteredType.hpp:476
The configuration for an array dataset.
Definition BaseIO.hpp:200
An abstract data type for a dataset.
Definition Data.hpp:16
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:68
static std::shared_ptr< NWBDataTyped< DTYPE > > fromNWBData(const Data &data)
Create a DataTyped object from a Data object.
Definition NWBData.hpp:85
std::shared_ptr< IO::BaseRecordingData > recordData(bool reset=false)
std::unique_ptr< IO::ReadDataWrapper< DatasetField, VTYPE > > readData() const
std::string m_path
The path of the registered type.
Definition RegisteredType.hpp:338
std::shared_ptr< IO::BaseIO > m_io
A shared pointer to the IO object.
Definition RegisteredType.hpp:343
std::string getPath() const
Gets the path of the registered type.
Definition RegisteredType.hpp:71
std::shared_ptr< AQNWB::IO::BaseIO > getIO() const
Get a shared pointer to the IO object.
Definition RegisteredType.hpp:89
Namespace for all classes related to the NWB data standard.
Definition NWBContainer.hpp:18
const std::string namespaceName
Definition core.hpp:21