From 69c3c4e8592ff2b7c81e61e5c17fd7aa5ec18849 Mon Sep 17 00:00:00 2001 From: Oliver Ruebel Date: Sat, 7 Sep 2024 22:38:16 -0700 Subject: [PATCH] Update ElectrodGroup to provide standard Container constructor and move args to initalize --- src/nwb/NWBFile.cpp | 4 +-- src/nwb/file/ElectrodeGroup.cpp | 29 +++--------------- src/nwb/file/ElectrodeGroup.hpp | 52 ++++++--------------------------- 3 files changed, 15 insertions(+), 70 deletions(-) diff --git a/src/nwb/NWBFile.cpp b/src/nwb/NWBFile.cpp index 80fe155d..fc2e5f3b 100644 --- a/src/nwb/NWBFile.cpp +++ b/src/nwb/NWBFile.cpp @@ -120,8 +120,8 @@ Status NWBFile::createElectricalSeries( device.initialize("description", "unknown"); ElectrodeGroup elecGroup = - ElectrodeGroup(electrodePath, io, "description", "unknown", device); - elecGroup.initialize(); + ElectrodeGroup(electrodePath, io); + elecGroup.initialize("description", "unknown", device); // Setup electrical series datasets auto electricalSeries = diff --git a/src/nwb/file/ElectrodeGroup.cpp b/src/nwb/file/ElectrodeGroup.cpp index 3d4bcfaa..53c13b9d 100644 --- a/src/nwb/file/ElectrodeGroup.cpp +++ b/src/nwb/file/ElectrodeGroup.cpp @@ -6,21 +6,17 @@ using namespace AQNWB::NWB; /** Constructor */ ElectrodeGroup::ElectrodeGroup(const std::string& path, - std::shared_ptr io, - const std::string& description, - const std::string& location, - const Device& device) + std::shared_ptr io) : Container(path, io) - , description(description) - , location(location) - , device(device) { } /** Destructor */ ElectrodeGroup::~ElectrodeGroup() {} -void ElectrodeGroup::initialize() +void ElectrodeGroup::initialize(const std::string& description, + const std::string& location, + const Device& device) { Container::initialize(); @@ -29,20 +25,3 @@ void ElectrodeGroup::initialize() io->createLink("/" + path + "/device", "/" + device.getPath()); } -// Getter for description -std::string ElectrodeGroup::getDescription() const -{ - return description; -} - -// Getter for location -std::string ElectrodeGroup::getLocation() const -{ - return location; -} - -// Getter for device -const Device& ElectrodeGroup::getDevice() const -{ - return device; -} diff --git a/src/nwb/file/ElectrodeGroup.hpp b/src/nwb/file/ElectrodeGroup.hpp index 863ea2f6..415a603c 100644 --- a/src/nwb/file/ElectrodeGroup.hpp +++ b/src/nwb/file/ElectrodeGroup.hpp @@ -19,16 +19,9 @@ class ElectrodeGroup : public Container * @brief Constructor. * @param path The location in the file of the electrode group. * @param io A shared pointer to the IO object. - * @param description The description of the electrode group. - * @param location The location of electrode group within the subject e.g. - * brain region. - * @param device The device associated with the electrode group. */ ElectrodeGroup(const std::string& path, - std::shared_ptr io, - const std::string& description, - const std::string& location, - const Device& device); + std::shared_ptr io); /** * @brief Destructor. @@ -40,42 +33,15 @@ class ElectrodeGroup : public Container * * Initializes the ElectrodeGroup by creating NWB related attributes and * linking to the Device object. + * + * @param description The description of the electrode group. + * @param location The location of electrode group within the subject e.g. + * brain region. + * @param device The device associated with the electrode group. */ - void initialize(); - - /** - * @brief Gets the description of the electrode group. - * @return The description of the electrode group. - */ - std::string getDescription() const; - - /** - * @brief Gets the location of the electrode group. - * @return The location of the electrode group. - */ - std::string getLocation() const; - - /** - * @brief Gets the device associated with the electrode group. - * @return The device associated with the electrode group. - */ - const Device& getDevice() const; - -private: - /** - * @brief The description of the electrode group. - */ - std::string description; - - /** - * @brief The location of electrode group within the subject e.g. brain - * region. - */ - std::string location; + void initialize(const std::string& description, + const std::string& location, + const Device& device); - /** - * @brief The device associated with the electrode group. - */ - Device device; }; } // namespace AQNWB::NWB