aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/matrix.hpp
blob: 2b33342fb11c06593ddd701a774bef56f190a8da (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
#pragma once

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

#include "engine/matrix_iterator.hpp"

#include <memory>

template <typename Element>
class IMatrix
{
public:
	IMatrix() noexcept = default;

	IMatrix(const IMatrix &matrix) noexcept = default;

	IMatrix(IMatrix &&matrix) noexcept = default;

	virtual ~IMatrix() noexcept = default;

	virtual void fill(Element element) noexcept = 0;

	[[nodiscard]] virtual Element get(const Vector2 &pos) const noexcept = 0;

	virtual void set(const Vector2 &pos, Element element) 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<Element> begin() const noexcept = 0;

	[[nodiscard]] virtual MatrixIterator<Element> end() const noexcept = 0;

	IMatrix &operator=(const IMatrix &matrix) noexcept = default;

	IMatrix &operator=(IMatrix &&matrix) noexcept = default;
};

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