Skip to content

Commit

Permalink
Apply suggestion from oral review
Browse files Browse the repository at this point in the history
Remove eventloop
  • Loading branch information
YannLocatelli committed Jan 23, 2024
1 parent f59d064 commit 9e2cbba
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 20 deletions.
7 changes: 1 addition & 6 deletions libs/BehaviorKit/include/BehaviorKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@

#include "interface/Behavior.h"
#include "interface/libs/BehaviorKit.h"
#include "interface/libs/EventLoop.h"
#include "internal/BehaviorID.h"

namespace leka {

class BehaviorKit : public interface::BehaviorKit
{
public:
explicit BehaviorKit(interface::EventLoop &event_loop);
explicit BehaviorKit() = default;

void registerBehaviors(std::span<interface::Behavior *> behaviors) final;

Expand All @@ -25,10 +24,6 @@ class BehaviorKit : public interface::BehaviorKit
void stop() final;

private:
void run();

interface::EventLoop &_event_loop;

std::span<interface::Behavior *> _behaviors {};
interface::Behavior *_behavior = nullptr;
};
Expand Down
12 changes: 1 addition & 11 deletions libs/BehaviorKit/source/BehaviorKit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@

using namespace leka;

BehaviorKit::BehaviorKit(interface::EventLoop &event_loop) : _event_loop(event_loop)
{
_event_loop.registerCallback([this] { run(); });
}

void BehaviorKit::registerBehaviors(std::span<interface::Behavior *> behaviors)
{
_behaviors = behaviors;
Expand All @@ -32,7 +27,7 @@ void BehaviorKit::start(interface::Behavior *behavior)
return;
}

_event_loop.start();
_behavior->run();
}

void BehaviorKit::start(BehaviorID id)
Expand All @@ -49,11 +44,6 @@ void BehaviorKit::start(BehaviorID id)
start(found_behavior);
}

void BehaviorKit::run()
{
_behavior->run();
}

void BehaviorKit::stop()
{
if (_behavior != nullptr) {
Expand Down
4 changes: 1 addition & 3 deletions libs/BehaviorKit/tests/BehaviorKit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "mocks/leka/Behavior.h"
#include "stubs/leka/EventLoopKit.h"

using namespace leka;

Expand All @@ -21,8 +20,7 @@ class BehaviorKitTest : public ::testing::Test
// void SetUp() override {}
// void TearDown() override {}

stub::EventLoopKit stub_event_loop {};
BehaviorKit behaviorkit {stub_event_loop};
BehaviorKit behaviorkit {};

mock::Behavior mock_behavior_a {};
mock::Behavior mock_behavior_b {};
Expand Down

0 comments on commit 9e2cbba

Please sign in to comment.