Skip to content

Commit

Permalink
Some minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
oruebel committed Sep 6, 2024
1 parent 58e5afb commit b7cc149
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/Utils.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#pragma once

#include <chrono>
#include <ctime>
#include <iomanip>
#include <sstream>
#include <string>

#include <boost/date_time.hpp>
#include <boost/uuid/uuid.hpp>
Expand All @@ -12,6 +15,7 @@
#include "io/BaseIO.hpp"
#include "io/hdf5/HDF5IO.hpp"


namespace AQNWB
{
/**
Expand Down Expand Up @@ -62,7 +66,7 @@ inline std::shared_ptr<IO::BaseIO> createIO(const std::string& type,
const std::string& filename)
{
if (type == "HDF5") {
return std::make_shared<IO::HDF5::HDF5IO>(filename);
return std::make_shared<AQNWB::IO::HDF5::HDF5IO>(filename);
} else {
throw std::invalid_argument("Invalid IO type");
}
Expand Down Expand Up @@ -92,4 +96,5 @@ inline std::unique_ptr<int16_t[]> transformToInt16(SizeType numSamples,

return intData;
}

} // namespace AQNWB
26 changes: 23 additions & 3 deletions src/io/ReadIO.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include "Types.hpp"


using StorageObjectType = AQNWB::Types::StorageObjectType;
using SizeType = AQNWB::Types::SizeType;

Expand Down Expand Up @@ -52,6 +53,19 @@ class DataBlockGeneric
* correct type.
*/
std::type_index typeIndex = typeid(void);

/**
* \brief Default constructor
*/
DataBlockGeneric() = default;

/**
* \brief Parameterized constructor
*/
DataBlockGeneric(const std::any& data, const std::vector<SizeType>& shape, const std::type_index& typeIndex)
: data(data), shape(shape), typeIndex(typeIndex)
{
}
};

/**
Expand All @@ -78,7 +92,9 @@ class DataBlock
*/
const std::type_index typeIndex = typeid(DTYPE);

/// Constructor
/**
* Constructor
*/
DataBlock(const std::vector<DTYPE>& data, const std::vector<SizeType>& shape)
: data(data)
, shape(shape)
Expand Down Expand Up @@ -146,7 +162,7 @@ class DataBlock
* AQNWB::Types::StorageObjectType
* @tparam VTYPE The data type of the values stored in the data object
*/
template<StorageObjectType OTYPE, typename VTYPE>
template<StorageObjectType OTYPE, typename VTYPE = std::any>
class ReadDataWrapper
{
// Embedded traits for compile time checking of allowed OTYPE for the class
Expand Down Expand Up @@ -199,8 +215,12 @@ class ReadDataWrapper
public:
/**
* @brief Default constructor.
*
* @param io The IO object to use for reading
* @param dataPath The path to the attribute or dataset to read
*/
ReadDataWrapper(const std::shared_ptr<IO::BaseIO> io, std::string dataPath)
ReadDataWrapper(const std::shared_ptr<IO::BaseIO> io,
const std::string& dataPath)
: io(io)
, dataPath(dataPath)
{
Expand Down

0 comments on commit b7cc149

Please sign in to comment.