Skip to content

Commit

Permalink
restructure folders and namespace names
Browse files Browse the repository at this point in the history
  • Loading branch information
stephprince committed Apr 3, 2024
1 parent 28d2c7f commit dd05ae1
Show file tree
Hide file tree
Showing 22 changed files with 75 additions and 76 deletions.
23 changes: 11 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@ include(cmake/variables.cmake)

add_library(
aq-nwb_lib OBJECT
src/NWBFile.cpp
src/Utils.hpp
src/io/HDF5IO.cpp
src/io/BaseIO.cpp
src/schema/hdmf/base/Data.hpp
src/schema/hdmf/base/Container.cpp
src/schema/hdmf/table/DynamicTable.cpp
src/schema/hdmf/table/ElementIdentifiers.hpp
src/schema/hdmf/table/VectorData.hpp
src/schema/nwb/device/Device.cpp
src/schema/nwb/file/ElectrodeGroup.cpp
src/schema/nwb/file/ElectrodeTable.cpp
src/BaseIO.cpp
src/hdf5/HDF5IO.cpp
src/nwb/NWBFile.cpp
src/nwb/hdmf/base/Data.hpp
src/nwb/hdmf/base/Container.cpp
src/nwb/hdmf/table/DynamicTable.cpp
src/nwb/hdmf/table/ElementIdentifiers.hpp
src/nwb/hdmf/table/VectorData.hpp
src/nwb/core/device/Device.cpp
src/nwb/core/file/ElectrodeGroup.cpp
src/nwb/core/file/ElectrodeTable.cpp
)

target_include_directories(
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 12 additions & 12 deletions src/NWBFile.cpp → src/nwb/NWBFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

#include "NWBFile.hpp"

#include "BaseIO.hpp"
#include "Utils.hpp"
#include "io/BaseIO.hpp"
#include "schema/nwb/device/Device.hpp"
#include "schema/nwb/file/ElectrodeGroup.hpp"
#include "schema/nwb/file/ElectrodeTable.hpp"
#include "nwb/core/device/Device.hpp"
#include "nwb/core/file/ElectrodeGroup.hpp"
#include "nwb/core/file/ElectrodeTable.hpp"

using namespace AQNWB;

Expand Down Expand Up @@ -97,19 +97,18 @@ Status NWBFile::startRecording()
std::string devicePath = "general/devices/" + groupName;
std::string elecPath = "general/extracellular_ephys/" + groupName;

Schema::Device device =
Schema::Device(devicePath, io, "description", "unknown");
NWB::Device device = NWB::Device(devicePath, io, "description", "unknown");
device.initialize();

Schema::ElectrodeGroup elecGroup =
Schema::ElectrodeGroup(elecPath, io, "description", "unknown", device);
NWB::ElectrodeGroup elecGroup =
NWB::ElectrodeGroup(elecPath, io, "description", "unknown", device);
elecGroup.initialize();
}

// Create electrode table
std::string electrodePath = "general/extracellular_ephys/electrodes/";
Schema::ElectrodeTable elecTable =
Schema::ElectrodeTable(electrodePath, io, channels);
NWB::ElectrodeTable elecTable =
NWB::ElectrodeTable(electrodePath, io, channels);
elecTable.initialize();

elecTable.electrodeDataset->dataset = createRecordingData(
Expand Down Expand Up @@ -139,8 +138,9 @@ void NWBFile::cacheSpecifications(const std::string& specPath,
io->createGroup("/specifications/" + specPath + versionNumber);

std::filesystem::path currentFile = __FILE__;
std::filesystem::path schemaDir = currentFile.parent_path().parent_path()
/ "resources/spec" / specPath / versionNumber;
std::filesystem::path schemaDir =
currentFile.parent_path().parent_path().parent_path() / "resources/spec"
/ specPath / versionNumber;

for (auto const& entry : std::filesystem::directory_iterator {schemaDir})
if (std::filesystem::is_regular_file(entry)
Expand Down
2 changes: 1 addition & 1 deletion src/NWBFile.hpp → src/nwb/NWBFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <cstdint>

#include "io/BaseIO.hpp"
#include "BaseIO.hpp"

namespace AQNWB
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "schema/nwb/device/Device.hpp"
#include "nwb/core/device/Device.hpp"

using namespace AQNWB::Schema;
using namespace AQNWB::NWB;

// Device
/** Constructor */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

#include <string>

#include "io/BaseIO.hpp"
#include "schema/hdmf/base/Container.hpp"
#include "BaseIO.hpp"
#include "nwb/hdmf/base/Container.hpp"

namespace AQNWB::Schema
namespace AQNWB::NWB
{
/**
* @brief Metadata about a data acquisition device, e.g., recording system,
Expand Down Expand Up @@ -60,4 +60,4 @@ class Device : public Container
*/
std::string manufacturer;
};
} // namespace AQNWB::Schema
} // namespace AQNWB::NWB
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "schema/nwb/file/ElectrodeGroup.hpp"
#include "nwb/core/file/ElectrodeGroup.hpp"

using namespace AQNWB::Schema;
using namespace AQNWB::NWB;

// ElectrodeGroup

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

#include <string>

#include "io/BaseIO.hpp"
#include "schema/hdmf/base/Container.hpp"
#include "schema/nwb/device/Device.hpp"
#include "BaseIO.hpp"
#include "nwb/core/device/Device.hpp"
#include "nwb/hdmf/base/Container.hpp"

namespace AQNWB::Schema
namespace AQNWB::NWB
{
/**
* @brief The ElectrodeGroup class represents a physical grouping of electrodes,
Expand Down Expand Up @@ -78,4 +78,4 @@ class ElectrodeGroup : public Container
*/
Device device;
};
} // namespace AQNWB::Schema
} // namespace AQNWB::NWB
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "schema/nwb/file/ElectrodeTable.hpp"
#include "nwb/core/file/ElectrodeTable.hpp"

using namespace AQNWB::Schema;
using namespace AQNWB::NWB;

// ElectrodeTable

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

#include <string>

#include "io/BaseIO.hpp"
#include "schema/hdmf/table/DynamicTable.hpp"
#include "schema/hdmf/table/ElementIdentifiers.hpp"
#include "schema/hdmf/table/VectorData.hpp"
#include "BaseIO.hpp"
#include "nwb/hdmf/table/DynamicTable.hpp"
#include "nwb/hdmf/table/ElementIdentifiers.hpp"
#include "nwb/hdmf/table/VectorData.hpp"

namespace AQNWB::Schema
namespace AQNWB::NWB
{
/**
* @brief Represents a table containing electrode metadata.
Expand Down Expand Up @@ -115,4 +115,4 @@ class ElectrodeTable : public DynamicTable
*/
std::string groupPath = "/general/extracellular_ephys/array1";
};
} // namespace AQNWB::Schema
} // namespace AQNWB::NWB
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "schema/hdmf/base/Container.hpp"
#include "nwb/hdmf/base/Container.hpp"

using namespace AQNWB::Schema;
using namespace AQNWB::NWB;

// Container

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#include <memory>
#include <string>

#include "io/BaseIO.hpp"
#include "BaseIO.hpp"

namespace AQNWB::Schema
namespace AQNWB::NWB
{
/**
* @brief Abstract data type for a group storing collections of data and
Expand Down Expand Up @@ -48,4 +48,4 @@ class Container
*/
std::shared_ptr<BaseIO> io;
};
} // namespace AQNWB::Schema
} // namespace AQNWB::NWB
6 changes: 3 additions & 3 deletions src/schema/hdmf/base/Data.hpp → src/nwb/hdmf/base/Data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include <memory>

#include "io/BaseIO.hpp"
#include "BaseIO.hpp"

namespace AQNWB::Schema
namespace AQNWB::NWB
{
/**
* @brief An abstract data type for a dataset.
Expand All @@ -27,4 +27,4 @@ class Data
*/
std::unique_ptr<BaseRecordingData> dataset;
};
} // namespace AQNWB::Schema
} // namespace AQNWB::NWB
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "schema/hdmf/table/DynamicTable.hpp"
#include "nwb/hdmf/table/DynamicTable.hpp"

using namespace AQNWB::Schema;
using namespace AQNWB::NWB;

// DynamicTable

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

#include <string>

#include "io/BaseIO.hpp"
#include "schema/hdmf/base/Container.hpp"
#include "schema/hdmf/table/ElementIdentifiers.hpp"
#include "schema/hdmf/table/VectorData.hpp"
#include "BaseIO.hpp"
#include "nwb/hdmf/base/Container.hpp"
#include "nwb/hdmf/table/ElementIdentifiers.hpp"
#include "nwb/hdmf/table/VectorData.hpp"

namespace AQNWB::Schema
namespace AQNWB::NWB
{
/**
* @brief Represents a group containing multiple datasets that are aligned on
Expand Down Expand Up @@ -94,4 +94,4 @@ class DynamicTable : public Container
*/
std::vector<std::string> colNames;
};
} // namespace AQNWB::Schema
} // namespace AQNWB::NWB
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include "schema/hdmf/base/Data.hpp"
#include "nwb/hdmf/base/Data.hpp"

namespace AQNWB::Schema
namespace AQNWB::NWB
{
/**
* @brief A list of unique identifiers for values within a dataset, e.g. rows of
Expand All @@ -11,4 +11,4 @@ namespace AQNWB::Schema
class ElementIdentifiers : public Data
{
};
} // namespace AQNWB::Schema
} // namespace AQNWB::NWB
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "schema/hdmf/table/VectorData.hpp"
#include "nwb/hdmf/table/VectorData.hpp"

using namespace AQNWB::Schema;
using namespace AQNWB::NWB;

// VectorData
std::string VectorData::getDescription() const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include <string>

#include "schema/hdmf/base/Data.hpp"
#include "nwb/hdmf/base/Data.hpp"

namespace AQNWB::Schema
namespace AQNWB::NWB
{
/**
* @brief An n-dimensional dataset representing a column of a DynamicTable.
Expand All @@ -24,4 +24,4 @@ class VectorData : public Data
*/
std::string description;
};
} // namespace AQNWB::Schema
} // namespace AQNWB::NWB
12 changes: 6 additions & 6 deletions tests/aq-nwb_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

#include <catch2/catch_test_macros.hpp>

#include "NWBFile.hpp"
#include "io/BaseIO.hpp"
#include "io/HDF5IO.hpp"
#include "schema/nwb/file/ElectrodeTable.hpp"
#include "BaseIO.hpp"
#include "hdf5/HDF5IO.hpp"
#include "nwb/NWBFile.hpp"
#include "nwb/core/file/ElectrodeTable.hpp"

using namespace AQNWB;
namespace fs = std::filesystem;
Expand Down Expand Up @@ -105,7 +105,7 @@ TEST_CASE("ElectrodeTable", "[datatypes]")
std::shared_ptr<BaseIO> io = std::make_unique<HDF5::HDF5IO>(filename);
io->open();
io->createGroup("array1");
Schema::ElectrodeTable electrodeTable(path, io, channels);
NWB::ElectrodeTable electrodeTable(path, io, channels);
electrodeTable.initialize();
electrodeTable.setGroupPath("array1");
electrodeTable.electrodeDataset->dataset =
Expand Down Expand Up @@ -136,7 +136,7 @@ TEST_CASE("ElectrodeTable", "[datatypes]")
std::string filename = getTestFilePath("electrodeTableNoData.h5");
std::shared_ptr<BaseIO> io = std::make_unique<HDF5::HDF5IO>(filename);
io->open();
Schema::ElectrodeTable electrodeTable(path, io, std::vector<int>(), "none");
NWB::ElectrodeTable electrodeTable(path, io, std::vector<int>(), "none");
electrodeTable.initialize();
}
}

0 comments on commit dd05ae1

Please sign in to comment.