aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/matrix.hpp
blob: 010138f45306268c4f3769e43938593e256dc012 (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
#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>
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
class IMatrix
{
public:
	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;
};

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