improved const correctness

This commit is contained in:
Robin Müller 2020-05-27 21:33:34 +02:00
parent c4e60946d3
commit 95bf5c1071
7 changed files with 8 additions and 9 deletions

View File

@ -63,7 +63,7 @@ TaskHandle_t BinarySemaphoreUsingTask::getTaskHandle() {
return handle;
}
uint8_t BinarySemaphoreUsingTask::getSemaphoreCounter() {
uint8_t BinarySemaphoreUsingTask::getSemaphoreCounter() const {
uint32_t notificationValue;
xTaskNotifyAndQuery(handle, 0, eNoAction, &notificationValue);
return notificationValue;

View File

@ -26,7 +26,7 @@ public:
ReturnValue_t acquire(uint32_t timeoutMs =
SemaphoreIF::NO_TIMEOUT) override;
ReturnValue_t release() override;
uint8_t getSemaphoreCounter() override;
uint8_t getSemaphoreCounter() const override;
/**
* Take the binary semaphore.

View File

@ -82,7 +82,7 @@ ReturnValue_t BinarySemaphore::release() {
}
}
uint8_t BinarySemaphore::getSemaphoreCounter() {
uint8_t BinarySemaphore::getSemaphoreCounter() const {
return uxSemaphoreGetCount(handle);
}

View File

@ -43,7 +43,7 @@ public:
//! @brief Destructor
virtual ~BinarySemaphore();
uint8_t getSemaphoreCounter() override;
uint8_t getSemaphoreCounter() const override;
/**
* Take the binary semaphore.

View File

@ -16,8 +16,7 @@ CountingSemaphoreUsingTask::CountingSemaphoreUsingTask(uint8_t maxCount,
}
}
ReturnValue_t CountingSemaphoreUsingTask::acquire(
uint32_t timeoutMs) {
ReturnValue_t CountingSemaphoreUsingTask::acquire(uint32_t timeoutMs) {
return HasReturnvaluesIF::RETURN_OK;
}
@ -25,6 +24,6 @@ ReturnValue_t CountingSemaphoreUsingTask::release() {
return HasReturnvaluesIF::RETURN_OK;
}
uint8_t CountingSemaphoreUsingTask::getSemaphoreCounter() {
uint8_t CountingSemaphoreUsingTask::getSemaphoreCounter() const {
return 0;
}

View File

@ -15,7 +15,7 @@ public:
ReturnValue_t acquire(uint32_t timeoutMs) override;
ReturnValue_t release() override;
uint8_t getSemaphoreCounter() override;
uint8_t getSemaphoreCounter() const override;
private:
TaskHandle_t handle;

View File

@ -55,7 +55,7 @@ public:
* is returned if the semaphore is available, and 0 is returned if the
* semaphore is not available.
*/
virtual uint8_t getSemaphoreCounter() = 0;
virtual uint8_t getSemaphoreCounter() const = 0;
};
#endif /* FRAMEWORK_TASKS_SEMAPHOREIF_H_ */