Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle remaining todo code comments #patch #75

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions include/arbitration_graphs/arbitrator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ class Arbitrator : public Behavior<CommandT> {
using ConstPtr = std::shared_ptr<const Arbitrator>;

/*!
* \brief The Option struct
* \brief The Option struct holds a behavior option of the arbitrator and corresponding flags
*
* \todo explain why it is a subclass of arbitrator
* \todo explain flags implementation and usage
* - MyArbitrator::Option::Flags != Arbitrator::Option::Flags (no inheritance)
* - addOption() checks type, but hasFlag() not anymore (otherwise each inherited Option would have to
* implement a new, not overriding (because signature changed) hasFlag() -> error prone)
* This is a subclass of arbitrator, as some of the Flags could be arbitrator specific.
* For each arbitration class we have to make sure though, to derive an Option class from this Option base.
*
* \note When using addOption(), make sure to use the Flags of the correct Arbitrator.
* The compiler wouldn't notice a confusion unfortunately.
*/
struct Option {
public:
Expand All @@ -58,7 +58,6 @@ class Arbitrator : public Behavior<CommandT> {
Option(const typename Behavior<SubCommandT>::Ptr& behavior, const FlagsT& flags)
: behavior_{behavior}, flags_{flags} {
}
//! \todo document why we need this
virtual ~Option() = default;

typename Behavior<SubCommandT>::Ptr behavior_;
Expand Down
8 changes: 4 additions & 4 deletions test/cost_arbitrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,22 @@ TEST_F(CostArbitratorTest, BasicFunctionality) {

testCostArbitrator.gainControl(time);
EXPECT_EQ("mid_cost", testCostArbitrator.getCommand(time));
//! \todo This should be 0, if we estimate costs without calling getCommand (and thus gain/loseControl, see c2b2a93)
//! \note This should be 0, if we estimate costs without calling getCommand (and thus gain/loseControl, see c2b2a93)
EXPECT_EQ(1, testBehaviorMidCost->loseControlCounter_);

EXPECT_EQ("mid_cost", testCostArbitrator.getCommand(time));
//! \todo This should be 1, if we estimate costs without calling getCommand (and thus gain/loseControl, see c2b2a93)
//! \note This should be 1, if we estimate costs without calling getCommand (and thus gain/loseControl, see c2b2a93)
EXPECT_EQ(3, testBehaviorMidCost->loseControlCounter_);

testBehaviorMidCost->invocationCondition_ = false;
EXPECT_TRUE(testCostArbitrator.checkInvocationCondition(time));
EXPECT_TRUE(testCostArbitrator.checkCommitmentCondition(time));

EXPECT_EQ("high_cost", testCostArbitrator.getCommand(time));
//! \todo This should be 0, if we estimate costs without calling getCommand (and thus gain/loseControl, see c2b2a93)
//! \note This should be 0, if we estimate costs without calling getCommand (and thus gain/loseControl, see c2b2a93)
EXPECT_EQ(3, testBehaviorHighCost->loseControlCounter_);
EXPECT_EQ("high_cost", testCostArbitrator.getCommand(time));
//! \todo This should be 0, if we estimate costs without calling getCommand (and thus gain/loseControl, see c2b2a93)
//! \note This should be 0, if we estimate costs without calling getCommand (and thus gain/loseControl, see c2b2a93)
EXPECT_EQ(3, testBehaviorHighCost->loseControlCounter_);

// high_cost behavior is not interruptable -> high_cost should stay active
Expand Down