Skip to content

Commit

Permalink
Merge branch 'main' into add_read
Browse files Browse the repository at this point in the history
  • Loading branch information
oruebel committed Sep 20, 2024
2 parents c7ced4e + 33e3481 commit dd01ad3
Show file tree
Hide file tree
Showing 26 changed files with 414 additions and 363 deletions.
35 changes: 10 additions & 25 deletions src/Channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,17 @@ Channel::Channel(const std::string name,
const float bitVolts,
const std::array<float, 3> position,
const std::string comments)
: name(name)
, groupName(groupName)
, groupIndex(groupIndex)
, localIndex(localIndex)
, globalIndex(globalIndex)
, position(position)
, conversion(conversion)
, samplingRate(samplingRate)
, bitVolts(bitVolts)
, comments(comments)
: m_name(name)
, m_groupName(groupName)
, m_groupIndex(groupIndex)
, m_localIndex(localIndex)
, m_globalIndex(globalIndex)
, m_position(position)
, m_conversion(conversion)
, m_samplingRate(samplingRate)
, m_bitVolts(bitVolts)
, m_comments(comments)
{
}

Channel::~Channel() {}

float Channel::getConversion() const
{
return bitVolts / conversion;
}

float Channel::getSamplingRate() const
{
return samplingRate;
}

float Channel::getBitVolts() const
{
return bitVolts;
}
134 changes: 110 additions & 24 deletions src/Channel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,73 +36,159 @@ class Channel
*/
~Channel();

/**
* @brief Copy constructor
*/
Channel(const Channel& other) = default;

/**
* @brief Move constructor
*/
Channel(Channel&& other) = default;

/**
* @brief Assignment operator
*/
Channel& operator=(const Channel& other) = default;

/**
* @brief Move assignment operator
*/
Channel& operator=(Channel&& other) = default;

/**
* @brief Getter for conversion factor
* @return The conversion value.
*/
float getConversion() const;
inline float getConversion() const { return m_bitVolts / m_conversion; }

/**
* @brief Getter for samplingRate
* @return The samplingRate value.
* @brief Getter for sampling rate of the channel.
* @return The sampling rate value.
*/
float getSamplingRate() const;
inline float getSamplingRate() const { return m_samplingRate; }

/**
* @brief Getter for bitVolts
* @brief Getter for bitVolts floating point value of microvolts per bit
* @return The bitVolts value.
*/
float getBitVolts() const;
inline float getBitVolts() const { return m_bitVolts; }

/**
* @brief Name of the channel.
* @brief Get the name of the array group the channel belongs to.
* @return The groupName value.
*/
std::string name;
inline std::string getGroupName() const { return m_groupName; }

/**
* @brief Name of the array group the channel belongs to.
* @brief Get the name of the channel
* @return The name value.
*/
std::string groupName;
inline std::string getName() const { return m_name; }

/**
* @brief Index of array group the channel belongs to.
* @brief Get the array group index the channel belongs to
* @return The groupIndex value.
*/
SizeType groupIndex;
inline SizeType getGroupIndex() const { return m_groupIndex; }

/**
* @brief Index of channel within the recording array.
* @brief Get the index of the channel within the recording array.
* @return The localIndex value.
*/
SizeType localIndex;
inline SizeType getLocalIndex() const { return m_localIndex; }

/**
* @brief Index of channel across the recording system.
* @brief Get the index of the channel across the recording system.
* @return The globalIndex value.
*/
SizeType globalIndex;
inline SizeType getGlobalIndex() const { return m_globalIndex; }

/**
* @brief Coordinates of channel (x, y, z) within the recording array.
* @brief Get the coordinates of channel (x, y, z) within the recording array.
* @return The position value.
*/
std::array<float, 3> position;
inline const std::array<float, 3>& getPosition() const { return m_position; }

/**
* @brief Comments about the channel.
* @brief Get comments about the channel
* @return The comments value.
*/
inline std::string getComments() const { return m_comments; }

/**
* @brief Set comments about the channel.
* @param comments The comments to set.
*/
inline void setComments(const std::string& comments)
{
m_comments = comments;
}

/**
* @brief Set coordinates of channel (x, y, z) within the recording array.
* @param position The position to set.
*/
inline void setPosition(const std::array<float, 3>& position)
{
m_position = position;
}

/**
* @brief Set name of the channel.
* @param name The name to set.
*/
std::string comments;
inline void setName(const std::string& name) { m_name = name; }

private:
/**
* @brief Comments about the channel.
*/
std::string m_comments;

/**
* @brief Coordinates of channel (x, y, z) within the recording array.
*/
std::array<float, 3> m_position;

/**
* @brief Index of channel across the recording system.
*/
SizeType m_globalIndex;

/**
* @brief Index of channel within the recording array.
*/
SizeType m_localIndex;

/**
* @brief Index of array group the channel belongs to.
*/
SizeType m_groupIndex;

/**
* @brief Name of the channel.
*/
std::string m_name;

/**
* @brief Name of the array group the channel belongs to.
*/
std::string m_groupName;

/**
* @brief Conversion factor.
*/
float conversion;
float m_conversion;

/**
* @brief Sampling rate of the channel.
*/
float samplingRate;
float m_samplingRate;

/**
* @brief floating point value of microvolts per bit
*/
float bitVolts;
float m_bitVolts;
};
} // namespace AQNWB
} // namespace AQNWB
22 changes: 4 additions & 18 deletions src/io/BaseIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,15 @@ const BaseDataType BaseDataType::DSTR = BaseDataType(T_STR, DEFAULT_STR_SIZE);

// BaseIO

BaseIO::BaseIO()
: readyToOpen(true)
, opened(false)
BaseIO::BaseIO(const std::string& filename)
: m_filename(filename)
, m_readyToOpen(true)
, m_opened(false)
{
}

BaseIO::~BaseIO() {}

bool BaseIO::isOpen() const
{
return opened;
}

bool BaseIO::isReadyToOpen() const
{
return readyToOpen;
}

bool BaseIO::canModifyObjects()
{
return true;
}

Status BaseIO::createCommonNWBAttributes(const std::string& path,
const std::string& objectNamespace,
const std::string& neurodataType,
Expand Down
18 changes: 9 additions & 9 deletions src/io/BaseIO.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class BaseIO
/**
* @brief Constructor for the BaseIO class.
*/
BaseIO();
BaseIO(const std::string& filename);

/**
* @brief Copy constructor is deleted to prevent construction-copying.
Expand All @@ -121,7 +121,7 @@ class BaseIO
* @brief Returns the full path to the file.
* @return The full path to the file.
*/
virtual std::string getFileName() = 0;
virtual std::string getFileName() const { return m_filename; }

/**
* @brief Get the storage type (Group, Dataset, Attribute) of the object at
Expand Down Expand Up @@ -318,7 +318,7 @@ class BaseIO
* override this function to check if objects can be modified.
* @return True if the file is in a modification mode, false otherwise.
*/
virtual bool canModifyObjects();
virtual bool canModifyObjects() { return true; }

/**
* @brief Creates an extendable dataset with a given base data type, size,
Expand Down Expand Up @@ -389,20 +389,20 @@ class BaseIO
* @brief Returns true if the file is open.
* @return True if the file is open, false otherwise.
*/
bool isOpen() const;
inline bool isOpen() const { return m_opened; }

/**
* @brief Returns true if the file is able to be opened.
* @return True if the file is able to be opened, false otherwise.
*/
bool isReadyToOpen() const;
inline bool isReadyToOpen() const { return m_readyToOpen; }

protected:
/**
* @brief The name of the file.
*/
const std::string filename;
const std::string m_filename;

protected:
/**
* @brief Creates a new group if it does not already exist.
* @param path The location of the group in the file.
Expand All @@ -413,12 +413,12 @@ class BaseIO
/**
* @brief Whether the file is ready to be opened.
*/
bool readyToOpen;
bool m_readyToOpen;

/**
* @brief Whether the file is currently open.
*/
bool opened;
bool m_opened;
};

/**
Expand Down
Loading

0 comments on commit dd01ad3

Please sign in to comment.