aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/matrix.hpp
blob: 44a26ed6ada23b89a04490c159b9f67b2b0e80ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once

#include "engine/data/bounds.hpp"
#include "engine/data/vector2.hpp"

#include <memory>

template <typename Element>
class IMatrix
{
public:
	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;

	/**
	 * Returns the number of columns the matrix has.
	 */
	[[nodiscard]] virtual uint32_t columns() const noexcept = 0;
};

template <typename Element>
using IMatrixFactory = std::shared_ptr<IMatrix<Element>> (*)(const Bounds &bounds);