From 55c93fe609888be73677317978959040cf35b2ff Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 19 Mar 2022 13:21:54 +0100 Subject: refactor: implement matrix iterator --- src/interfaces/matrix.hpp | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) (limited to 'src/interfaces') diff --git a/src/interfaces/matrix.hpp b/src/interfaces/matrix.hpp index 44a26ed..c22c0a7 100644 --- a/src/interfaces/matrix.hpp +++ b/src/interfaces/matrix.hpp @@ -3,45 +3,39 @@ #include "engine/data/bounds.hpp" #include "engine/data/vector2.hpp" +#include "engine/matrix_iterator.hpp" + #include template class IMatrix { public: + IMatrix() noexcept = default; + + IMatrix(const IMatrix &matrix) noexcept = default; + + IMatrix(IMatrix &&matrix) noexcept = default; + virtual ~IMatrix() noexcept = default; - /** - * Fills the matrix with a element. - * - * @param element A element - */ virtual void fill(Element element) noexcept = 0; - /** - * Returns a element of the matrix. - * - * @param pos The position of a element - */ [[nodiscard]] virtual Element get(const Vector2 &pos) const noexcept = 0; - /** - * Sets a element of the matrix. - * - * @param pos The position of a element - * @param element A new element - */ virtual void set(const Vector2 &pos, Element element) noexcept = 0; - /** - * Returns the number of rows the matrix has. - */ - [[nodiscard]] virtual uint32_t rows() const noexcept = 0; + [[nodiscard]] virtual uint32_t get_row_cnt() const noexcept = 0; + + [[nodiscard]] virtual uint32_t get_column_cnt() const noexcept = 0; + + [[nodiscard]] virtual MatrixIterator begin() const noexcept = 0; + + [[nodiscard]] virtual MatrixIterator end() const noexcept = 0; + + IMatrix &operator=(const IMatrix &matrix) noexcept = default; - /** - * Returns the number of columns the matrix has. - */ - [[nodiscard]] virtual uint32_t columns() const noexcept = 0; + IMatrix &operator=(IMatrix &&matrix) noexcept = default; }; template -- cgit v1.2.3-18-g5258