aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/matrix.hpp
blob: 5dc5f2e4eb640cf2b29f6b715a30213c9d276b76 (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 "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)>;