fsfw/osal/linux/QueueFactory.cpp
2020-09-22 15:31:15 +02:00

45 lines
1.0 KiB
C++

#include "../../ipc/QueueFactory.h"
#include "MessageQueue.h"
#include "../../ipc/messageQueueDefinitions.h"
#include "../../ipc/MessageQueueSenderIF.h"
#include "../../serviceinterface/ServiceInterfaceStream.h"
#include <mqueue.h>
#include <errno.h>
#include <cstring>
QueueFactory* QueueFactory::factoryInstance = nullptr;
ReturnValue_t MessageQueueSenderIF::sendMessage(MessageQueueId_t sendTo,
MessageQueueMessage* message, MessageQueueId_t sentFrom,
bool ignoreFault) {
return MessageQueue::sendMessageFromMessageQueue(sendTo,message,
sentFrom,ignoreFault);
}
QueueFactory* QueueFactory::instance() {
if (factoryInstance == nullptr) {
factoryInstance = new QueueFactory;
}
return factoryInstance;
}
QueueFactory::QueueFactory() {
}
QueueFactory::~QueueFactory() {
}
MessageQueueIF* QueueFactory::createMessageQueue(uint32_t messageDepth,
size_t maxMessageSize) {
return new MessageQueue(messageDepth, maxMessageSize);
}
void QueueFactory::deleteMessageQueue(MessageQueueIF* queue) {
delete queue;
}