replace std::set by std::multiset

so there can be multiple entries with same pollignTime
This commit is contained in:
Robin Müller 2020-03-28 00:09:15 +01:00
parent 5d071a1cf1
commit 93678adc5a
3 changed files with 16 additions and 9 deletions

View File

@ -104,11 +104,14 @@ ReturnValue_t FixedSlotSequence::checkSequence() const {
count++;
} else {
// All ok, print slot.
// (*slotIt)->print();
//info << "Current slot polling time: " << std::endl;
//info << std::dec << slotIt->pollingTimeMs << std::endl;
}
time = slotIt->pollingTimeMs;
slotIt++;
}
//info << "Number of elements in slot list: "
// << slotList.size() << std::endl;
if (count > 0) {
return HasReturnvaluesIF::RETURN_FAILED;
}

View File

@ -6,8 +6,8 @@
#include <list>
#include <set>
using SlotList = std::set<FixedSequenceSlot>;
using SlotListIter = std::set<FixedSequenceSlot>::iterator;
using SlotList = std::multiset<FixedSequenceSlot>;
using SlotListIter = std::multiset<FixedSequenceSlot>::iterator;
/**
* @brief This class is the representation of a Polling Sequence Table in software.
@ -69,11 +69,14 @@ public:
/**
* \brief This method returns the time until the next software component is invoked.
*
* \details This method is vitally important for the operation of the PST. By fetching the polling time
* of the current slot and that of the next one (or the first one, if the list end is reached)
* it calculates and returns the interval in milliseconds within which the handler execution
* shall take place. If the next slot has the same time as the current one, it is ignored until
* a slot with different time or the end of the PST is found.
* \details
* This method is vitally important for the operation of the PST.
* By fetching the polling time of the current slot and that of the
* next one (or the first one, if the list end is reached)
* it calculates and returns the interval in milliseconds within
* which the handler execution shall take place.
* If the next slot has the same time as the current one, it is ignored
* until a slot with different time or the end of the PST is found.
*/
uint32_t getIntervalToNextSlotMs();

View File

@ -12,7 +12,8 @@ class FixedTimeslotTaskIF : public PeriodicTaskIF {
public:
virtual ~FixedTimeslotTaskIF() {}
virtual ReturnValue_t addSlot(object_id_t componentId, uint32_t slotTimeMs, int8_t executionStep) = 0;
virtual ReturnValue_t addSlot(object_id_t componentId,
uint32_t slotTimeMs, int8_t executionStep) = 0;
virtual ReturnValue_t checkSequence() const = 0;
};