Skip to content

Commit

Permalink
Handle remaining todo code comments #patch
Browse files Browse the repository at this point in the history
  • Loading branch information
orzechow committed Nov 18, 2024
1 parent 87d02fc commit 3586225
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
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

0 comments on commit 3586225

Please sign in to comment.