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

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

#include <yacppdic/factory.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 auto get(const Vector2 &pos) const noexcept -> Element = 0;

	virtual void set(const Vector2 &pos, Element element) noexcept = 0;

	[[nodiscard]] virtual auto get_row_cnt() const noexcept -> uint32_t = 0;

	[[nodiscard]] virtual auto get_column_cnt() const noexcept -> uint32_t = 0;

	[[nodiscard]] virtual auto begin() const noexcept -> MatrixIterator<Element> = 0;

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

	auto operator=(const IMatrix &matrix) noexcept -> IMatrix & = default;

	auto operator=(IMatrix &&matrix) noexcept -> IMatrix & = default;
};

template <typename Element>
using IMatrixFactory =
	yacppdic::Factory<std::unique_ptr<IMatrix<Element>>(const Bounds &bounds)>;