diff options
Diffstat (limited to 'src/interfaces/matrix.hpp')
-rw-r--r-- | src/interfaces/matrix.hpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/interfaces/matrix.hpp b/src/interfaces/matrix.hpp new file mode 100644 index 0000000..5dc5f2e --- /dev/null +++ b/src/interfaces/matrix.hpp @@ -0,0 +1,48 @@ +#pragma once + +#include "interfaces/bounds.hpp" +#include "interfaces/vector2.hpp" + +#include <functional> +#include <memory> + +template <typename Element> +class IMatrix +{ +public: + /** + * Fills the matrix with a element. + * + * @param element A element + */ + virtual void fill(Element element) = 0; + + /** + * Returns a element of the matrix. + * + * @param pos The position of a element + */ + [[nodiscard]] virtual Element get(const IVector2 &pos) const = 0; + + /** + * Sets a element of the matrix. + * + * @param pos The position of a element + * @param element A new element + */ + virtual void set(const IVector2 &pos, Element element) = 0; + + /** + * Returns the number of rows the matrix has. + */ + [[nodiscard]] virtual unsigned int rows() const = 0; + + /** + * Returns the number of columns the matrix has. + */ + [[nodiscard]] virtual unsigned int columns() const = 0; +}; + +template <typename Element> +using IMatrixFactory = + std::function<std::shared_ptr<IMatrix<Element>>(const IBounds &bounds)>; |