Skip to content

Commit

Permalink
make electrodeTablePath a static const property
Browse files Browse the repository at this point in the history
  • Loading branch information
stephprince committed Aug 6, 2024
1 parent 5254d8a commit a2ce569
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
4 changes: 3 additions & 1 deletion src/nwb/ecephys/ElectricalSeries.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "nwb/ecephys/ElectricalSeries.hpp"

#include "nwb/file/ElectrodeTable.hpp"

using namespace AQNWB::NWB;

// ElectricalSeries
Expand Down Expand Up @@ -66,7 +68,7 @@ void ElectricalSeries::initialize()
io->createCommonNWBAttributes(
getPath() + "/electrodes", "hdmf-common", "DynamicTableRegion", "");
io->createReferenceAttribute(
electrodesTablePath, getPath() + "/electrodes", "table");
ElectrodeTable::electrodeTablePath, getPath() + "/electrodes", "table");
}

Status ElectricalSeries::writeChannel(SizeType channelInd,
Expand Down
5 changes: 0 additions & 5 deletions src/nwb/ecephys/ElectricalSeries.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ class ElectricalSeries : public TimeSeries
*/
Types::ChannelVector channelVector;

/**
* @brief Path to the electrodes table this time series references
*/
std::string electrodesTablePath = "/general/extracellular_ephys/electrodes/";

/**
* @brief Pointer to channel-specific conversion factor dataset.
*/
Expand Down
8 changes: 3 additions & 5 deletions src/nwb/file/ElectrodeTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ using namespace AQNWB::NWB;
/** Constructor */
ElectrodeTable::ElectrodeTable(std::shared_ptr<BaseIO> io,
const std::string& description)
: DynamicTable(
"/general/extracellular_ephys/electrodes/", // default value for
// electrodes table
io,
description)
: DynamicTable(electrodeTablePath, // use the electrodeTablePath
io,
description)
{
}

Expand Down
6 changes: 6 additions & 0 deletions src/nwb/file/ElectrodeTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ class ElectrodeTable : public DynamicTable
std::unique_ptr<VectorData> locationsDataset =
std::make_unique<VectorData>(); /**< The locations dataset. */

/**
* @brief The path to the ElectrodeTable.
*/
inline const static std::string electrodeTablePath =
"/general/extracellular_ephys/electrodes/";

private:
/**
* @brief The channel information from the acquisition system.
Expand Down
4 changes: 2 additions & 2 deletions tests/testFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ using namespace AQNWB;

TEST_CASE("ElectrodeTable", "[ecephys]")
{
std::string path = "/general/extracellular_ephys/electrodes/";
SECTION("test initialization")
{
std::string filename = getTestFilePath("electrodeTable.h5");
Expand All @@ -35,7 +34,8 @@ TEST_CASE("ElectrodeTable", "[ecephys]")

// Check if id datasets are created correctly
SizeType numChannels = 3;
std::unique_ptr<BaseRecordingData> id_data = io->getDataSet(path + "id");
std::unique_ptr<BaseRecordingData> id_data =
io->getDataSet(NWB::ElectrodeTable::electrodeTablePath + "id");
std::unique_ptr<HDF5::HDF5RecordingData> idDataset(
dynamic_cast<HDF5::HDF5RecordingData*>(id_data.release()));
int* buffer = new int[numChannels];
Expand Down

0 comments on commit a2ce569

Please sign in to comment.