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

#include <memory>
#include <yacppdic/factory.hpp>

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

template <typename ElementType>
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
class IMatrix
{
public:
	using Element = ElementType;

	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 -> std::uint32_t = 0;

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

	[[nodiscard]] virtual auto get_size() const noexcept -> Bounds = 0;

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

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

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