Skip to content

Commit

Permalink
Update ElectrodGroup to provide standard Container constructor and mo…
Browse files Browse the repository at this point in the history
…ve args to initalize
  • Loading branch information
oruebel committed Sep 8, 2024
1 parent b9c6c9b commit 69c3c4e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 70 deletions.
4 changes: 2 additions & 2 deletions src/nwb/NWBFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
29 changes: 4 additions & 25 deletions src/nwb/file/ElectrodeGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,17 @@ using namespace AQNWB::NWB;

/** Constructor */
ElectrodeGroup::ElectrodeGroup(const std::string& path,
std::shared_ptr<IO::BaseIO> io,
const std::string& description,
const std::string& location,
const Device& device)
std::shared_ptr<IO::BaseIO> 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();

Expand All @@ -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;
}
52 changes: 9 additions & 43 deletions src/nwb/file/ElectrodeGroup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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::BaseIO> io,
const std::string& description,
const std::string& location,
const Device& device);
std::shared_ptr<IO::BaseIO> io);

/**
* @brief Destructor.
Expand All @@ -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

0 comments on commit 69c3c4e

Please sign in to comment.