Skip to content

Commit 7b3d648

Browse files
committed
Apply suggestion from oral review
Remove eventloop
1 parent 34400c8 commit 7b3d648

File tree

3 files changed

+3
-20
lines changed

3 files changed

+3
-20
lines changed

libs/BehaviorKit/include/BehaviorKit.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@
88

99
#include "interface/Behavior.h"
1010
#include "interface/libs/BehaviorKit.h"
11-
#include "interface/libs/EventLoop.h"
1211
#include "internal/BehaviorID.h"
1312

1413
namespace leka {
1514

1615
class BehaviorKit : public interface::BehaviorKit
1716
{
1817
public:
19-
explicit BehaviorKit(interface::EventLoop &event_loop);
18+
explicit BehaviorKit() = default;
2019

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

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

2726
private:
28-
void run();
29-
30-
interface::EventLoop &_event_loop;
31-
3227
std::span<interface::Behavior *> _behaviors {};
3328
interface::Behavior *_behavior = nullptr;
3429
};

libs/BehaviorKit/source/BehaviorKit.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@
77

88
using namespace leka;
99

10-
BehaviorKit::BehaviorKit(interface::EventLoop &event_loop) : _event_loop(event_loop)
11-
{
12-
_event_loop.registerCallback([this] { run(); });
13-
}
14-
1510
void BehaviorKit::registerBehaviors(std::span<interface::Behavior *> behaviors)
1611
{
1712
_behaviors = behaviors;
@@ -32,7 +27,7 @@ void BehaviorKit::start(interface::Behavior *behavior)
3227
return;
3328
}
3429

35-
_event_loop.start();
30+
_behavior->run();
3631
}
3732

3833
void BehaviorKit::start(BehaviorID id)
@@ -49,11 +44,6 @@ void BehaviorKit::start(BehaviorID id)
4944
start(found_behavior);
5045
}
5146

52-
void BehaviorKit::run()
53-
{
54-
_behavior->run();
55-
}
56-
5747
void BehaviorKit::stop()
5848
{
5949
if (_behavior != nullptr) {

libs/BehaviorKit/tests/BehaviorKit_test.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "gmock/gmock.h"
88
#include "gtest/gtest.h"
99
#include "mocks/leka/Behavior.h"
10-
#include "stubs/leka/EventLoopKit.h"
1110

1211
using namespace leka;
1312

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

24-
stub::EventLoopKit stub_event_loop {};
25-
BehaviorKit behaviorkit {stub_event_loop};
23+
BehaviorKit behaviorkit {};
2624

2725
mock::Behavior mock_behavior_a {};
2826
mock::Behavior mock_behavior_b {};

0 commit comments

Comments
 (0)