mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2026-01-21 02:06:43 +01:00
renamed _get_data() to data()
This commit is contained in:
@@ -26,22 +26,23 @@ class Frame {
|
||||
Frame(ssize_t rows, ssize_t cols, ssize_t m_bitdepth);
|
||||
Frame(std::byte *fp, ssize_t rows, ssize_t cols, ssize_t m_bitdepth);
|
||||
std::byte *get(int row, int col);
|
||||
// template <typename T> void set(int row, int col, T data);
|
||||
|
||||
|
||||
//TODO! can we, or even want to remove the template?
|
||||
template <typename T>
|
||||
void set(int row, int col, T data) {
|
||||
assert(sizeof(T) == m_bitdepth/8);
|
||||
if (row < 0 || row >= m_rows || col < 0 || col >= m_cols) {
|
||||
std::cerr << "Invalid row or column index" << std::endl;
|
||||
return;
|
||||
}
|
||||
std::memcpy(m_data+(row*m_cols + col)*(m_bitdepth/8), &data, m_bitdepth/8);
|
||||
}
|
||||
throw std::out_of_range("Invalid row or column index");
|
||||
}
|
||||
std::memcpy(m_data+(row*m_cols + col)*(m_bitdepth/8), &data, m_bitdepth/8);
|
||||
}
|
||||
|
||||
ssize_t rows() const { return m_rows; }
|
||||
ssize_t cols() const { return m_cols; }
|
||||
ssize_t bitdepth() const { return m_bitdepth; }
|
||||
ssize_t size() const { return m_rows * m_cols * m_bitdepth / 8; }
|
||||
std::byte *_get_data() { return m_data; }
|
||||
std::byte *data() { return m_data; }
|
||||
|
||||
Frame &operator=(Frame &other) {
|
||||
m_rows = other.rows();
|
||||
|
||||
Reference in New Issue
Block a user