-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathComputerRepository.hh
46 lines (35 loc) · 1.05 KB
/
ComputerRepository.hh
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
#pragma once
#include "AbstractRepository.hh"
#include "EntityKind.hh"
#include "Uuid.hh"
#include <core_utils/TimeUtils.hh>
#include <memory>
#include <optional>
#include <unordered_set>
namespace bsgo {
struct Computer
{
Uuid id{};
std::string name{};
bool offensive{};
float powerCost{};
std::optional<float> range{};
utils::Duration reloadTime{};
std::optional<utils::Duration> duration{};
std::optional<std::unordered_set<EntityKind>> allowedTargets{};
std::optional<float> damageModifier{};
};
class ComputerRepository : public AbstractRepository
{
public:
ComputerRepository(const DbConnectionShPtr &connection);
~ComputerRepository() override = default;
void initialize() override;
auto findAll() const -> std::unordered_set<Uuid>;
auto findOneById(const Uuid computer) const -> Computer;
private:
auto fetchComputerBase(const Uuid computer) const -> Computer;
void fetchAllowedTargets(const Uuid computer, Computer &out) const;
};
using ComputerRepositoryShPtr = std::shared_ptr<ComputerRepository>;
} // namespace bsgo