Kata Tournament Runner  0.1.00
 All Classes Namespaces Functions Variables Enumerations Groups Pages
kataround_scores.h
1 #ifndef TOURNAMENT_RUNNER_KATAROUND_SCORES_H_
2 #define TOURNAMENT_RUNNER_KATAROUND_SCORES_H_
3 
4 #include <cstdint>
5 #include <vector>
6 #include <array>
7 
8 #include <boost/serialization/access.hpp>
9 #include <boost/serialization/nvp.hpp>
10 #include <boost/serialization/array.hpp>
11 
12 using boost::array;
13 using boost::serialization::make_nvp;
14 
15 namespace TournamentRunner
16 {
17 
22 
24 {
25 public:
26  using ScoreVectorType = std::vector<float>;
27 
28  void add_kata_score (float score);
29  void add_deduction (float deduction);
30  float get_overall_score () const;
31  float get_maximum_score () const;
32  float get_minimum_score () const;
33  ScoreVectorType get_scores () const;
34  float get_deduction () const;
35 
36 private:
37  friend class boost::serialization::access;
38 
42  template<class Archive>
43  void serialize (Archive& archive, const unsigned int version);
44 
45  float deduction_{};
46  array<float, number_of_kata_scores_per_round> kata_scores_;
47  uint8_t current_score_{};
48 };
49 
50 
51 inline void KataRoundScores::add_deduction (float deduction)
52 {
53  deduction_ = deduction;
54 }
55 
56 inline float KataRoundScores::get_deduction() const
57 {
58  return deduction_;
59 }
60 
61 template<class Archive>
62 void KataRoundScores::serialize (Archive& archive,
63  const unsigned int)
64 {
65  archive & make_nvp("Scores", kata_scores_);
66  archive & make_nvp("Deduction", deduction_);
67  archive & make_nvp("CurrentScore", current_score_);
68 }
69 
70 } //namespace TournamentRunner
71 
72 #endif // TOURNAMENT_RUNNER_KATAROUND_SCORES_H_
Definition: kataround_scores.h:23
const uint8_t number_of_kata_scores_per_round
Number of kata scores per round (5)
Definition: kataround_scores.h:21