Feature: Allowed Submodes Mask for Mode List Entry #130

Merged
muellerr merged 5 commits from feature_allow_submodes_mode_list_entry into develop 2023-03-07 17:20:48 +01:00
Owner
  • Also refactor the mode list entry to use the serial linked list adapter
- Also refactor the mode list entry to use the serial linked list adapter
muellerr added 2 commits 2023-03-07 16:11:31 +01:00
muellerr requested review from gaisser 2023-03-07 16:19:29 +01:00
muellerr added 1 commit 2023-03-07 16:29:17 +01:00
muellerr added 1 commit 2023-03-07 16:31:32 +01:00
gaisser requested changes 2023-03-07 17:05:59 +01:00
gaisser left a comment
Member

See comments

See comments
@ -24,2 +24,4 @@
using namespace mode;
std::map<object_id_t, ChildInfo>::iterator childIter;
auto checkSubmode = [&]() {
Member

If you have to use a lambda, which I find a nightmare to read, maybe capture &childIter explicitly.

If you have to use a lambda, which I find a nightmare to read, maybe capture &childIter explicitly.
gaisser marked this conversation as resolved
@ -26,0 +36,4 @@
return returnvalue::FAILED;
}
}
if (submodesAllowedMask) {
Member

This can be the else case of the above. Or maybe switch cases (not XX might be harder to read):

    if (submodesAllowedMask) {
      if ((childIter->second.submode | mask) != mask) {
        return returnvalue::FAILED;
      }
    }else{
      if (childIter->second.submode != submodeToCheckAgainst) {
        return returnvalue::FAILED;
      }
    }
    return returnvalue::OK;
This can be the else case of the above. Or maybe switch cases (not XX might be harder to read): ``` c++ if (submodesAllowedMask) { if ((childIter->second.submode | mask) != mask) { return returnvalue::FAILED; } }else{ if (childIter->second.submode != submodeToCheckAgainst) { return returnvalue::FAILED; } } return returnvalue::OK; ```
gaisser marked this conversation as resolved
@ -109,0 +101,4 @@
/**
* Specialization of @enableSubmodeAllowed which allows all submodes.
*/
void allowAllSubmodes() { enableSubmodeAllowed(0xff); }
Member

0xFF should be defined somewhere visible as a restricted mask.

0xFF should be defined somewhere visible as a restricted mask.
gaisser marked this conversation as resolved
muellerr added 1 commit 2023-03-07 17:15:41 +01:00
gaisser approved these changes 2023-03-07 17:19:36 +01:00
gaisser left a comment
Member

LGTM

LGTM
muellerr merged commit 7f6ba5f40b into develop 2023-03-07 17:20:48 +01:00
muellerr deleted branch feature_allow_submodes_mode_list_entry 2023-03-07 17:20:48 +01:00
Sign in to join this conversation.
No description provided.