9#include <unordered_map>
95template<StorageObjectType T>
97 : std::integral_constant<bool, (T == Dataset || T == Attribute)>
110 (std::numeric_limits<SizeType>::max)();
142 std::vector<uint8_t>,
143 std::vector<uint16_t>,
144 std::vector<uint32_t>,
145 std::vector<uint64_t>,
147 std::vector<int16_t>,
148 std::vector<int32_t>,
149 std::vector<int64_t>,
152 std::vector<std::string>>;
168 std::vector<std::pair<std::string_view, std::string_view>>
191 std::variant<ScalarDataVariant, VectorDataVariant>
value;
205 std::enable_if_t<std::is_constructible_v<ScalarDataVariant, T&&>
206 && !std::is_same_v<std::decay_t<T>,
CellValue>>>
220 typename = std::enable_if_t<
221 std::is_constructible_v<VectorDataVariant, T&&>>,
252 if constexpr (std::is_constructible_v<ScalarDataVariant, T>) {
253 if (std::holds_alternative<ScalarDataVariant>(
value)) {
255 || std::holds_alternative<T>(std::get<ScalarDataVariant>(
value));
258 if constexpr (std::is_constructible_v<VectorDataVariant, T>) {
259 if (std::holds_alternative<VectorDataVariant>(
value)) {
261 || std::holds_alternative<T>(std::get<VectorDataVariant>(
value));
278 if constexpr (std::is_constructible_v<VectorDataVariant, T>) {
279 return std::get<T>(std::get<VectorDataVariant>(
value));
281 return std::get<T>(std::get<ScalarDataVariant>(
value));
302 typename = std::enable_if_t<
303 std::is_constructible_v<ScalarDataVariant, T>
304 || std::is_constructible_v<VectorDataVariant, T>>>
317 [](
auto&& arg) -> std::string
319 using T = std::decay_t<
decltype(arg)>;
320 if constexpr (std::is_same_v<T, ScalarDataVariant>) {
322 [](
auto&& scalarArg) -> std::string
324 using ScalarT = std::decay_t<
decltype(scalarArg)>;
325 if constexpr (std::is_same_v<ScalarT, std::monostate>) {
327 }
else if constexpr (std::is_same_v<ScalarT, std::string>) {
330 return std::to_string(scalarArg);
334 }
else if constexpr (std::is_same_v<T, VectorDataVariant>) {
336 [](
auto&& vectorArg) -> std::string
338 using VectorT = std::decay_t<
decltype(vectorArg)>;
339 if constexpr (std::is_same_v<VectorT, std::monostate>) {
342 std::string res =
"[";
343 for (
size_t i = 0; i < vectorArg.size(); ++i) {
344 if constexpr (std::is_same_v<VectorT,
345 std::vector<std::string>>) {
348 res += std::to_string(vectorArg[i]);
350 if (i < vectorArg.size() - 1) {
372using RowData = std::unordered_map<std::string, CellValue>;
Class for storing acquisition system channel information.
Definition Channel.hpp:16
Provides definitions for various types used in the project.
Definition Types.hpp:24
std::vector< Channel > ChannelVector
Alias for a vector of channels.
Definition Types.hpp:120
std::string storageObjectTypeToString(StorageObjectType type)
Convert StorageObjectType enum value to string.
Definition Types.hpp:72
constexpr SizeType SizeTypeNotSet
Value to use to indicate that a SizeType index is not set.
Definition Types.hpp:109
std::variant< std::monostate, std::vector< uint8_t >, std::vector< uint16_t >, std::vector< uint32_t >, std::vector< uint64_t >, std::vector< int8_t >, std::vector< int16_t >, std::vector< int32_t >, std::vector< int64_t >, std::vector< float >, std::vector< double >, std::vector< std::string > > VectorDataVariant
Variant data type for representing any 1D vector of scalar values.
Definition Types.hpp:141
std::unordered_map< std::string, CellValue > RowData
Represents a row of data in a DynamicTable.
Definition Types.hpp:372
Status operator&&(Status lhs, Status rhs)
Overloaded && operator for Status enum.
Definition Types.hpp:40
StorageObjectType
Types of object used in the NWB schema.
Definition Types.hpp:60
@ Attribute
Definition Types.hpp:63
@ Group
Definition Types.hpp:61
@ Dataset
Definition Types.hpp:62
@ Undefined
Definition Types.hpp:64
Status operator||(Status lhs, Status rhs)
Overloaded || operator for Status enum.
Definition Types.hpp:51
Status
Represents the status of an operation.
Definition Types.hpp:29
@ Success
Definition Types.hpp:30
@ Failure
Definition Types.hpp:31
std::variant< std::monostate, uint8_t, uint16_t, uint32_t, uint64_t, int8_t, int16_t, int32_t, int64_t, float, double, std::string > ScalarDataVariant
Variant data type for representing a single scalar value.
Definition Types.hpp:125
std::vector< SizeType > SizeArray
Alias for an array of size types used in the project.
Definition Types.hpp:115
size_t SizeType
Alias for the size type used in the project.
Definition Types.hpp:104
The main namespace for AqNWB.
Definition Channel.hpp:11
std::variant< ScalarDataVariant, VectorDataVariant > value
Definition Types.hpp:191
CellValue(const char *val)
Implicit constructor for string literals.
Definition Types.hpp:237
std::string toString() const
Convert the cell value to a string representation.
Definition Types.hpp:314
const T & get() const
Helper method to extract the underlying value.
Definition Types.hpp:276
CellValue(T &&val)
Implicit constructor for vector values.
Definition Types.hpp:224
CellValue(T &&val)
Implicit constructor for scalar values.
Definition Types.hpp:208
bool holds_alternative() const
Checks if the CellValue holds a specific type.
Definition Types.hpp:249
Helper struct to check if a value is a data field, i.e., Dataset or Attribute.
Definition Types.hpp:98
Struct to hold namespace information.
Definition Types.hpp:158
std::string name
The name of the namespace.
Definition Types.hpp:159
std::string version
The version of the namespace.
Definition Types.hpp:160
std::vector< std::pair< std::string_view, std::string_view > > specVariables
The specVariables of the namespace.
Definition Types.hpp:169