aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/matrix.hpp
blob: 8242b186bc34bde3195f9b2ed7fd5aca40957871 (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() = default;

	/**
	 * 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 Vector2 &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 Vector2 &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::shared_ptr<IMatrix<Element>> (*)(const Bounds &bounds);