replyMap insertion improvements

This commit is contained in:
Robin Müller 2020-05-17 15:47:17 +02:00
parent 7ceb6f3c96
commit f4ad38f07f
2 changed files with 6 additions and 7 deletions

View File

@ -354,8 +354,8 @@ ReturnValue_t DeviceHandlerBase::insertInReplyMap(DeviceCommandId_t replyId,
info.delayCycles = 0; info.delayCycles = 0;
info.replyLen = replyLen; info.replyLen = replyLen;
info.command = deviceCommandMap.end(); info.command = deviceCommandMap.end();
std::pair<DeviceReplyIter, bool> result = deviceReplyMap.emplace(replyId, info); auto resultPair = deviceReplyMap.emplace(replyId, info);
if (result.second) { if (resultPair.second) {
return RETURN_OK; return RETURN_OK;
} else { } else {
return RETURN_FAILED; return RETURN_FAILED;
@ -367,11 +367,8 @@ ReturnValue_t DeviceHandlerBase::insertInCommandMap(DeviceCommandId_t deviceComm
info.expectedReplies = 0; info.expectedReplies = 0;
info.isExecuting = false; info.isExecuting = false;
info.sendReplyTo = NO_COMMANDER; info.sendReplyTo = NO_COMMANDER;
std::pair<std::map<DeviceCommandId_t, DeviceCommandInfo>::iterator, bool> returnValue; auto resultPair = deviceCommandMap.emplace(deviceCommand, info);
returnValue = deviceCommandMap.insert( if (resultPair.second) {
std::pair<DeviceCommandId_t, DeviceCommandInfo>(deviceCommand,
info));
if (returnValue.second) {
return RETURN_OK; return RETURN_OK;
} else { } else {
return RETURN_FAILED; return RETURN_FAILED;

View File

@ -481,9 +481,11 @@ public:
*/ */
virtual void setParentQueue(MessageQueueId_t parentQueueId); virtual void setParentQueue(MessageQueueId_t parentQueueId);
/** @brief Implementation required for HasActionIF */
ReturnValue_t executeAction(ActionId_t actionId, ReturnValue_t executeAction(ActionId_t actionId,
MessageQueueId_t commandedBy, const uint8_t* data, MessageQueueId_t commandedBy, const uint8_t* data,
uint32_t size) override; uint32_t size) override;
Mode_t getTransitionSourceMode() const; Mode_t getTransitionSourceMode() const;
Submode_t getTransitionSourceSubMode() const; Submode_t getTransitionSourceSubMode() const;
virtual void getMode(Mode_t *mode, Submode_t *submode); virtual void getMode(Mode_t *mode, Submode_t *submode);