fsfw/src/fsfw/osal/linux/SemaphoreFactory.cpp
Robin Mueller ddcac2bbac
All checks were successful
fsfw/fsfw/pipeline/pr-development This commit looks good
reapply clang format
2022-02-02 10:29:30 +01:00

29 lines
915 B
C++

#include "fsfw/tasks/SemaphoreFactory.h"
#include "fsfw/osal/linux/BinarySemaphore.h"
#include "fsfw/osal/linux/CountingSemaphore.h"
SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr;
SemaphoreFactory::SemaphoreFactory() {}
SemaphoreFactory::~SemaphoreFactory() { delete factoryInstance; }
SemaphoreFactory* SemaphoreFactory::instance() {
if (factoryInstance == nullptr) {
factoryInstance = new SemaphoreFactory();
}
return SemaphoreFactory::factoryInstance;
}
SemaphoreIF* SemaphoreFactory::createBinarySemaphore(uint32_t arguments) {
return new BinarySemaphore();
}
SemaphoreIF* SemaphoreFactory::createCountingSemaphore(const uint8_t maxCount, uint8_t initCount,
uint32_t arguments) {
return new CountingSemaphore(maxCount, initCount);
}
void SemaphoreFactory::deleteSemaphore(SemaphoreIF* semaphore) { delete semaphore; }