Feature: Allowed Submodes Mask for Mode List Entry #130
@ -25,13 +25,18 @@ ReturnValue_t SubsystemBase::checkStateAgainstTable(HybridIterator<ModeListEntry
|
||||
std::map<object_id_t, ChildInfo>::iterator childIter;
|
||||
|
||||
auto checkSubmode = [&]() {
|
||||
gaisser marked this conversation as resolved
Outdated
|
||||
uint8_t mask;
|
||||
bool submodesAllowedMask = tableIter.value->submodesAllowed(&mask);
|
||||
uint8_t submodeToCheckAgainst = tableIter.value->getSubmode();
|
||||
if (tableIter.value->inheritSubmode()) {
|
||||
if (childIter->second.submode != targetSubmode) {
|
||||
submodeToCheckAgainst = targetSubmode;
|
||||
}
|
||||
if (not submodesAllowedMask) {
|
||||
if (childIter->second.submode != submodeToCheckAgainst) {
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
}
|
||||
uint8_t mask;
|
||||
if (tableIter.value->submodesAllowed(&mask)) {
|
||||
if (submodesAllowedMask) {
|
||||
gaisser marked this conversation as resolved
Outdated
gaisser
commented
This can be the else case of the above. Or maybe switch cases (not XX might be harder to read):
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;
```
|
||||
if ((childIter->second.submode | mask) != mask) {
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user
If you have to use a lambda, which I find a nightmare to read, maybe capture &childIter explicitly.