aqnwb 0.4.0
Loading...
Searching...
No Matches
DurationVectorData.hpp
Go to the documentation of this file.
1#pragma once
2
3// Common STL includes
4#include <memory>
5#include <optional>
6#include <string>
7#include <vector>
8// Base AqNWB includes for IO and RegisteredType
9#include "io/BaseIO.hpp"
10#include "io/ReadIO.hpp"
12// Include for parent type
14// Include for the namespace schema header
15#include "spec/core.hpp"
16
17namespace AQNWB::NWB
18{
19
24{
25public:
26 struct DataSpec : public Data::DataSpec<DurationVectorData>
27 {
28 DataSpec(const std::string& datasetName,
29 const AQNWB::IO::ArrayDataSetConfig& dataConfig,
30 const std::string& columnDescription,
31 std::optional<float> columnResolution = std::nullopt)
32 : Data::DataSpec<DurationVectorData>(datasetName, dataConfig)
33 , description(columnDescription)
34 , resolution(columnResolution)
35 {
36 }
37
38 std::string description;
39 std::optional<float> resolution;
40
41 Status initialize(Data& data) const override;
42 };
43
47 virtual ~DurationVectorData() override {}
48
59 const std::string& description,
60 std::optional<float> resolution = std::nullopt);
61
62 static std::shared_ptr<DataSpec> createDataSpec(
63 const std::string& name,
64 const AQNWB::IO::ArrayDataSetConfig& dataConfig,
65 const std::string& description,
66 std::optional<float> resolution = std::nullopt);
67
68 // Define read methods
71 std::string,
72 "unit",
73 "The unit of measurement for the durations - fixed to seconds.")
74
77 float,
78 "resolution",
79 "The temporal resolution of the durations - in seconds. This is "
80 "typically the sampling period (1 / sampling_rate) - also known as the "
81 "clock period - of the data acquisition system from which the durations "
82 "were recorded or derived.")
83
86 float,
87 "",
88 "A 1-D VectorData that stores durations in seconds.")
89
92 AQNWB::SPEC::CORE::namespaceName)
93
94protected:
100 DurationVectorData(const std::string& path,
101 std::shared_ptr<AQNWB::IO::BaseIO> io);
102};
103
104} // namespace AQNWB::NWB
AQNWB::Types::Status Status
Definition BaseIO.hpp:21
#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
An abstract data type for a dataset.
Definition Data.hpp:21
virtual ~DurationVectorData() override
Virtual destructor.
Definition DurationVectorData.hpp:47
static std::shared_ptr< DataSpec > createDataSpec(const std::string &name, const AQNWB::IO::ArrayDataSetConfig &dataConfig, const std::string &description, std::optional< float > resolution=std::nullopt)
Definition DurationVectorData.cpp:73
Status initialize(const AQNWB::IO::ArrayDataSetConfig &data, const std::string &description, std::optional< float > resolution=std::nullopt)
Initialize the object.
Definition DurationVectorData.cpp:19
DurationVectorData(const std::string &path, std::shared_ptr< AQNWB::IO::BaseIO > io)
Constructor.
Definition DurationVectorData.cpp:12
std::unique_ptr< AQNWB::IO::ReadDataWrapper< AQNWB::NWB::AttributeField, VTYPE > > readResolution() const
std::unique_ptr< AQNWB::IO::ReadDataWrapper< AQNWB::NWB::AttributeField, VTYPE > > readUnit() const
std::unique_ptr< AQNWB::IO::ReadDataWrapper< AQNWB::NWB::DatasetField, VTYPE > > readData() const
std::shared_ptr< AQNWB::IO::BaseRecordingData > recordData(bool reset=false)
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
The namespace for IO components of AqNWB.
Namespace for all classes related to the NWB data standard.
The namespace for managing format schema and namespaces.
The main namespace for AqNWB.
Definition Channel.hpp:11
Typed runtime configuration for a concrete Data subclass.
Definition Data.hpp:79
DataSpec(const std::string &datasetName, const AQNWB::IO::ArrayDataSetConfig &dataConfig, const std::string &columnDescription, std::optional< float > columnResolution=std::nullopt)
Definition DurationVectorData.hpp:28
std::string description
Definition DurationVectorData.hpp:38
Status initialize(Data &data) const override
Initialize the created concrete Data object from this spec.
Definition DurationVectorData.cpp:57
std::optional< float > resolution
Definition DurationVectorData.hpp:39