Skip to content

Commit

Permalink
Add example evaluator
Browse files Browse the repository at this point in the history
  • Loading branch information
MatheusPaixaoG committed Oct 27, 2024
1 parent 6263783 commit 3a4c760
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ robocin_cpp_library(
HDRS decision_processor.h
SRCS decision_processor.cpp
DEPS common::output
coach
evaluators
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace decision {

Coach::Coach() = default;
Coach::Coach() { example_evaluator_ = makeEvaluator<ExampleEvaluator>(); }

void Coach::process() {
for (auto evaluator : evaluators_) {
Expand All @@ -20,6 +20,8 @@ void Coach::reset() {

TacticalPlan Coach::getTacticalPlan() { return tactical_plan_; }

void Coach::setTacticalPlan() { tactical_plan_; }
void Coach::setTacticalPlan() {
tactical_plan_.example_evaluator_result_ = example_evaluator_->getExampleEvaluatorResult();
}

} // namespace decision
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class Coach : public ICoach {
private:
std::vector<IEvaluator*> evaluators_;
TacticalPlan tactical_plan_;

std::unique_ptr<ExampleEvaluator> example_evaluator_;
};

} // namespace decision
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
#ifndef DECISION_PROCESSING_COACH_TACTICAL_PLAN_TACTICAL_PLAN_H
#define DECISION_PROCESSING_COACH_TACTICAL_PLAN_TACTICAL_PLAN_H

#include "decision/processing/evaluators/example_evaluator.h"
namespace decision {

class TacticalPlan {
public:
TacticalPlan();

ExampleEvaluatorResult example_evaluator_result_;
};

} // namespace decision
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
robocin_cpp_library(
NAME evaluators
HDRS ievaluator.h
example_evaluator.h
SRCS ievaluator.cpp
example_evaluator.cpp
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include "decision/processing/evaluators/example_evaluator.h"

#include <robocin/output/log.h>

namespace decision {

ExampleEvaluatorResult::ExampleEvaluatorResult() = default;

ExampleEvaluator::ExampleEvaluator() { reset(); }

void ExampleEvaluator::process() { robocin::ilog("EXAMPLE EVALUATOR WORKING"); }

void ExampleEvaluator::reset() { example_evaluator_result_ = ExampleEvaluatorResult{}; }

ExampleEvaluatorResult ExampleEvaluator::getExampleEvaluatorResult() const {
// return example_evaluator_result_;
return {};
}

} // namespace decision
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef DECISION_PROCESSING_EVALUATORS_EXAMPLE_EVALUATOR_H
#define DECISION_PROCESSING_EVALUATORS_EXAMPLE_EVALUATOR_H

#include "decision/processing/evaluators/ievaluator.h"

namespace decision {

class ExampleEvaluatorResult {
public:
ExampleEvaluatorResult();
};

class ExampleEvaluator : public IEvaluator {
public:
ExampleEvaluator();

void process() override;
void reset() override;

[[nodiscard]] ExampleEvaluatorResult getExampleEvaluatorResult() const;

private:
ExampleEvaluatorResult example_evaluator_result_;
};

} // namespace decision

#endif /* DECISION_PROCESSING_EVALUATORS_EXAMPLE_EVALUATOR_H */

0 comments on commit 3a4c760

Please sign in to comment.