deleted copy ans assignment ctor

This commit is contained in:
Robin Müller 2020-05-18 17:38:19 +02:00
parent d1500a7868
commit f8614e23a8
2 changed files with 20 additions and 14 deletions

View File

@ -7,11 +7,10 @@
// As a first step towards this, introduces system context variable which needs
// to be switched manually
// Haven't found function to find system context.
MessageQueue::MessageQueue(size_t messageDepth, size_t maxMessageSize) :
defaultDestination(0),lastPartner(0), callContext(CallContext::task) {
MessageQueue::MessageQueue(size_t messageDepth, size_t maxMessageSize) {
handle = xQueueCreate(messageDepth, maxMessageSize);
if (handle == NULL) {
sif::error << "MessageQueue creation failed" << std::endl;
sif::error << "MessageQueue: Creation failed" << std::endl;
}
}
@ -57,11 +56,11 @@ ReturnValue_t MessageQueue::sendMessageFrom(MessageQueueId_t sendTo,
ReturnValue_t MessageQueue::handleSendResult(BaseType_t result, bool ignoreFault) {
if (result != pdPASS) {
if (!ignoreFault) {
if (not ignoreFault) {
InternalErrorReporterIF* internalErrorReporter =
objectManager->get<InternalErrorReporterIF>(
objects::INTERNAL_ERROR_REPORTER);
if (internalErrorReporter != NULL) {
if (internalErrorReporter != nullptr) {
internalErrorReporter->queueMessageNotSent();
}
}
@ -106,6 +105,7 @@ MessageQueueId_t MessageQueue::getId() const {
}
void MessageQueue::setDefaultDestination(MessageQueueId_t defaultDestination) {
defaultDestinationSet = true;
this->defaultDestination = defaultDestination;
}
@ -114,7 +114,7 @@ MessageQueueId_t MessageQueue::getDefaultDestination() const {
}
bool MessageQueue::isDefaultDestinationSet() const {
return 0;
return defaultDestinationSet;
}
@ -129,9 +129,9 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
static_cast<const void*>(message->getBuffer()), 0);
}
else {
// If the call context is from an interrupt,
// request a context switch if a higher priority task
// was blocked by the interrupt.
/* If the call context is from an interrupt,
* request a context switch if a higher priority task
* was blocked by the interrupt. */
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
result = xQueueSendFromISR(reinterpret_cast<QueueHandle_t>(sendTo),
static_cast<const void*>(message->getBuffer()),

View File

@ -56,8 +56,12 @@ public:
* With this parameter, the maximum message size can be adjusted.
* This should be left default.
*/
MessageQueue( size_t message_depth = 3,
size_t max_message_size = MessageQueueMessage::MAX_MESSAGE_SIZE );
MessageQueue( size_t messageDepth = 3,
size_t maxMessageSize = MessageQueueMessage::MAX_MESSAGE_SIZE );
/** Copying message queues forbidden */
MessageQueue(const MessageQueue&) = delete;
MessageQueue& operator=(const MessageQueue&) = delete;
/**
* @brief The destructor deletes the formerly created message queue.
@ -189,10 +193,12 @@ protected:
static ReturnValue_t handleSendResult(BaseType_t result, bool ignoreFault);
private:
bool defaultDestinationSet = false;
QueueHandle_t handle;
MessageQueueId_t defaultDestination;
MessageQueueId_t lastPartner;
CallContext callContext; //!< Stores the current system context
MessageQueueId_t defaultDestination = 0;
MessageQueueId_t lastPartner = 0;
//!< Stores the current system context
CallContext callContext = CallContext::task;
};
#endif /* MESSAGEQUEUE_H_ */