EHM DAL 0.2.5
Data abstraction layer for Eastside Hockey Manager
Loading...
Searching...
No Matches
schedule_club.h
1#pragma once
2
3// Qt headers
4#include <QtGlobal>
5#include <vector>
6
7// --- Schedule generator club item --- //
8namespace ehm_dal::tools::schedule_template_generator {
13{
14public:
15 ScheduleClub(const qint32 generator_club_id = 0, const qint32 encoded_division_club_id = 0);
16
17 // Get data - ids
18 inline qint32 clubId() const { return generator_club_id_; }
19 inline qint32 clubEncodedId() const { return encoded_division_club_id_; }
20
21 // Get data - scheduling
22 bool hasGamesToAllocate() const;
23 std::pair<qint32, qint32> take();
24
25 // Home game counts for schedule generation - get data
26 qint32 homeGameCount() const;
27 qint32 homeGameCount(const qint32 club_id) const;
28 void initHomeGameCounts(const qint32 club_count, const qint32 default_games_played);
29 void resetUnallocatedHomeGames();
30 qint32 unallocatedHomeGameCount() const;
31
32 // Home game counts for schedule generation - set data
33 void setHomeGameCount(const qint32 club_id, const qint32 home_game_count);
34
35 // Set data
36 inline void setClubEncodedId(const qint32 encoded_division_club_id)
37 {
38 encoded_division_club_id_ = encoded_division_club_id;
39 }
40
41 // Operator overloading
42 inline auto operator<=>(const ScheduleClub &rhs) const
43 {
44 return clubEncodedId() <=> rhs.clubEncodedId();
45 }
46 inline bool operator==(const ScheduleClub &rhs) const
47 {
48 return clubEncodedId() == rhs.clubEncodedId();
49 }
50
51 enum ENUM_FLAGS { INVALID_CLUB_ID = -1, PAIR_ROAD_CLUB_INDEX = 0, PAIR_HOME_CLUB_INDEX = 1 };
52
53private:
54 // Ids
55 qint32 generator_club_id_{0};
56 qint32 encoded_division_club_id_{0};
57
58 // Get data - scheduling
59 std::pair<qint32, qint32> take(const qint32 road_club_id);
60
61 // Home game counts
62 std::vector<qint32> game_counts_; // Total number of home games to play vs each club
63 std::vector<qint32> unallocated_games_; // Number of home games remaining to be allocated
64
65 // Scheduling
66 qint32 nextClubToTake();
67 qint32 next_club_to_take_{0};
68};
69} // namespace ehm_dal::tools::schedule_template_generator
The ScheduleClub class represents a club within ScheduleTemplateGenerator.
Definition: schedule_club.h:13