sequence count operator overloading
This commit is contained in:
parent
186b3565e0
commit
d4ade5e885
@ -4,21 +4,32 @@
|
|||||||
#include "../tmtcpacket/SpacePacketBase.h"
|
#include "../tmtcpacket/SpacePacketBase.h"
|
||||||
|
|
||||||
class SourceSequenceCounter {
|
class SourceSequenceCounter {
|
||||||
private:
|
private:
|
||||||
uint16_t sequenceCount;
|
uint16_t sequenceCount;
|
||||||
public:
|
|
||||||
SourceSequenceCounter() : sequenceCount(0) {}
|
public:
|
||||||
void increment() {
|
SourceSequenceCounter() : sequenceCount(0) {}
|
||||||
sequenceCount = (sequenceCount+1) % (SpacePacketBase::LIMIT_SEQUENCE_COUNT);
|
void increment() {
|
||||||
}
|
sequenceCount = (sequenceCount + 1) % (SpacePacketBase::LIMIT_SEQUENCE_COUNT);
|
||||||
void decrement() {
|
}
|
||||||
sequenceCount = (sequenceCount-1) % (SpacePacketBase::LIMIT_SEQUENCE_COUNT);
|
void decrement() {
|
||||||
}
|
sequenceCount = (sequenceCount - 1) % (SpacePacketBase::LIMIT_SEQUENCE_COUNT);
|
||||||
uint16_t get() { return this->sequenceCount; }
|
}
|
||||||
void reset(uint16_t toValue = 0) {
|
uint16_t get() { return this->sequenceCount; }
|
||||||
sequenceCount = toValue % (SpacePacketBase::LIMIT_SEQUENCE_COUNT);
|
void reset(uint16_t toValue = 0) {
|
||||||
}
|
sequenceCount = toValue % (SpacePacketBase::LIMIT_SEQUENCE_COUNT);
|
||||||
|
}
|
||||||
|
SourceSequenceCounter& operator++(int) {
|
||||||
|
this->increment();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
SourceSequenceCounter& operator=(const uint16_t& newCount) {
|
||||||
|
sequenceCount = newCount;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
operator uint16_t() {
|
||||||
|
return this->get();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFW_TMTCSERVICES_SOURCESEQUENCECOUNTER_H_ */
|
#endif /* FSFW_TMTCSERVICES_SOURCESEQUENCECOUNTER_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user