Grail (C++)  1.3.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
EvaluationDebugData.h
1 // Copyright QED Software 2023.
2 
3 #ifndef GRAIL_EVALUATION_DEBUG_DATA_H
4 #define GRAIL_EVALUATION_DEBUG_DATA_H
5 
6 #include <string>
7 #include <vector>
8 #include "../UtilityModel/EvaluatorType.h"
9 #include "Flatbuffers/EvaluationDebugData_generated.h"
10 
11 namespace YAML
12 {
13  template <typename DataType>
14  struct convert;
15 }
16 
17 namespace grail
18 {
19 namespace data
20 {
25  {
26  friend struct YAML::convert<EvaluationDebugData>;
27  public:
34  EvaluationDebugData(EvaluatorType evaluatorType, float score, unsigned int nodeIndex);
35  EvaluationDebugData() = default;
36 
41  void AddChildNode(unsigned int childNodeIndex);
42 
47  EvaluatorType GetEvaluatorType() const;
48 
53  float GetScore() const;
54 
59  unsigned int GetNodeIndex() const;
60 
65  const std::vector<unsigned int>& GetChildNodes() const;
66 
71  const std::string& GetMetadata() const;
72 
73  void SetMetadata(const std::string& newMetadata);
74 
75  private:
76  EvaluatorType evaluatorType{};
77  float score{};
78  unsigned int nodeIndex{};
79  std::vector<unsigned int> childNodes{};
80  std::string metadata{};
81  };
82 
83  flatbuffers::Offset<generated::EvaluationDebugData> Pack(flatbuffers::FlatBufferBuilder& builder, const EvaluationDebugData& debugData);
84  EvaluationDebugData Unpack(const generated::EvaluationDebugData& debugData);
85 }
86 }
87 
88 #endif
grail::data::EvaluationDebugData
The EvaluationDebugData class - debug data describing singular evaluator.
Definition: EvaluationDebugData.h:24
grail::data::EvaluationDebugData::GetEvaluatorType
EvaluatorType GetEvaluatorType() const
GetEvaluatorType - provides type of the evalutor described by this debug data.
Definition: EvaluationDebugData.cpp:19
grail::data::EvaluationDebugData::GetMetadata
const std::string & GetMetadata() const
GetMetadata - provides a metadata string.
Definition: EvaluationDebugData.cpp:23
grail::data::EvaluationDebugData::GetScore
float GetScore() const
GetScore - provides output of the evaluator descibed by this debug data.
Definition: EvaluationDebugData.cpp:20
grail::data::EvaluationDebugData::GetNodeIndex
unsigned int GetNodeIndex() const
GetNodeIndex - provides this nodes position in debug tree.
Definition: EvaluationDebugData.cpp:21
grail::data::EvaluationDebugData::AddChildNode
void AddChildNode(unsigned int childNodeIndex)
AddChildNode - add node as leaf/child to this data node.
Definition: EvaluationDebugData.cpp:14
grail::data::EvaluationDebugData::GetChildNodes
const std::vector< unsigned int > & GetChildNodes() const
GetChildNodes - provides indexes of all nodes attached to this node as children.
Definition: EvaluationDebugData.cpp:22