Merge branch 'mueller_localPoolNeat' into mueller_StoreAccessor

This commit is contained in:
Robin Müller 2020-05-29 17:07:48 +02:00
commit 023af149df
15 changed files with 37 additions and 25 deletions

View File

@ -49,7 +49,7 @@ void ActionHelper::setQueueToUse(MessageQueueIF* queue) {
void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId,
store_address_t dataAddress) {
const uint8_t* dataPtr = NULL;
uint32_t size = 0;
size_t size = 0;
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
if (result != HasReturnvaluesIF::RETURN_OK) {
CommandMessage reply;

View File

@ -113,7 +113,7 @@ uint8_t CommandActionHelper::getCommandCount() const {
void CommandActionHelper::extractDataForOwner(ActionId_t actionId, store_address_t storeId) {
const uint8_t * data = NULL;
uint32_t size = 0;
size_t size = 0;
ReturnValue_t result = ipcStore->getData(storeId, &data, &size);
if (result != HasReturnvaluesIF::RETURN_OK) {
return;

View File

@ -44,7 +44,7 @@ void SimpleActionHelper::prepareExecution(MessageQueueId_t commandedBy,
queueToUse->sendMessage(commandedBy, &reply);
}
const uint8_t* dataPtr = NULL;
uint32_t size = 0;
size_t size = 0;
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
if (result != HasReturnvaluesIF::RETURN_OK) {
ActionMessage::setStepReply(&reply, actionId, 0, result);

View File

@ -215,7 +215,7 @@ ReturnValue_t DataPoolAdmin::handleParameterCommand(CommandMessage* command) {
ParameterMessage::getParameterId(command));
const uint8_t *storedStream;
uint32_t storedStreamSize;
size_t storedStreamSize;
result = storage->getData(ParameterMessage::getStoreId(command),
&storedStream, &storedStreamSize);
if (result != HasReturnvaluesIF::RETURN_OK) {

View File

@ -558,7 +558,7 @@ void DeviceHandlerBase::doGetRead() {
ReturnValue_t DeviceHandlerBase::getStorageData(store_address_t storageAddress,
uint8_t * *data, uint32_t * len) {
uint32_t lenTmp;
size_t lenTmp;
if (IPCStore == NULL) {
*data = NULL;

View File

@ -152,7 +152,7 @@ void MemoryHelper::handleMemoryLoad(CommandMessage* message) {
ipcAddress = MemoryMessage::getStoreID(message);
const uint8_t* p_data = NULL;
uint8_t* dataPointer = NULL;
uint32_t size = 0;
size_t size = 0;
ReturnValue_t returnCode = ipcStore->getData(ipcAddress, &p_data, &size);
if (returnCode == RETURN_OK) {
returnCode = workOnThis->handleMemoryLoad(address, p_data, size,

View File

@ -8,10 +8,11 @@
#ifndef OBJECTMANAGERIF_H_
#define OBJECTMANAGERIF_H_
#include "systemObjectList.h"
#include <framework/objectmanager/frameworkObjects.h>
#include <config/objects/systemObjectList.h>
#include <framework/objectmanager/SystemObjectIF.h>
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
/**
* @brief This class provides an interface to the global object manager.
@ -24,9 +25,12 @@
*/
class ObjectManagerIF : public HasReturnvaluesIF {
public:
static const uint8_t INTERFACE_ID = CLASS_ID::OBJECT_MANAGER_IF;
static const ReturnValue_t INSERTION_FAILED = MAKE_RETURN_CODE( 1 );
static const ReturnValue_t NOT_FOUND = MAKE_RETURN_CODE( 2 );
static constexpr uint8_t INTERFACE_ID = CLASS_ID::OBJECT_MANAGER_IF;
static constexpr ReturnValue_t INSERTION_FAILED = MAKE_RETURN_CODE( 1 );
static constexpr ReturnValue_t NOT_FOUND = MAKE_RETURN_CODE( 2 );
static constexpr ReturnValue_t CHILD_INIT_FAILED = MAKE_RETURN_CODE( 3 );
static constexpr ReturnValue_t INTERNAL_ERR_REPORTER_UNINIT = MAKE_RETURN_CODE( 4 );
protected:
/**
* @brief This method is used to hide the template-based get call from
@ -78,15 +82,22 @@ public:
virtual void printList() = 0;
};
template <typename T>
T* ObjectManagerIF::get( object_id_t id ) {
SystemObjectIF* temp = this->getSystemObject(id);
return dynamic_cast<T*>(temp);
}
/**
* @brief This is the forward declaration of the global objectManager instance.
*/
extern ObjectManagerIF *objectManager;
/*Documentation can be found in the class method declaration above.*/
template <typename T>
T* ObjectManagerIF::get( object_id_t id ) {
if(objectManager == nullptr) {
sif::error << "ObjectManagerIF: Global object manager has not "
"been initialized yet!" << std::endl;
std::exit(0);
}
SystemObjectIF* temp = this->getSystemObject(id);
return dynamic_cast<T*>(temp);
}
#endif /* OBJECTMANAGERIF_H_ */

View File

@ -97,7 +97,8 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
bool ignoreFault) {
message->setSender(sentFrom);
BaseType_t result = xQueueSendToBack(reinterpret_cast<void*>(sendTo),reinterpret_cast<const void*>(message->getBuffer()), 0);
BaseType_t result = xQueueSendToBack(reinterpret_cast<QueueHandle_t>(sendTo),
reinterpret_cast<const void*>(message->getBuffer()), 0);
if (result != pdPASS) {
if (!ignoreFault) {
InternalErrorReporterIF* internalErrorReporter = objectManager->get<InternalErrorReporterIF>(

View File

@ -37,7 +37,7 @@ ReturnValue_t ParameterHelper::handleParameterMessage(CommandMessage *message) {
ParameterMessage::getParameterId(message));
const uint8_t *storedStream;
uint32_t storedStreamSize;
size_t storedStreamSize;
result = storage->getData(
ParameterMessage::getStoreId(message), &storedStream,
&storedStreamSize);

View File

@ -48,4 +48,3 @@ inline ReturnValue_t PoolManager<NUMBER_OF_POOLS>::deleteData(uint8_t* buffer,
}
#endif

View File

@ -11,7 +11,6 @@
using AccessorPair = std::pair<ReturnValue_t, StorageAccessor>;
using ConstAccessorPair = std::pair<ReturnValue_t, ConstStorageAccessor>;
/**
* @brief This class provides an interface for intermediate data storage.
* @details The Storage manager classes shall be used to store larger chunks of
@ -80,6 +79,7 @@ public:
virtual ReturnValue_t deleteData(uint8_t* buffer, size_t size,
store_address_t* storeId = nullptr) = 0;
/**
* @brief Access the data by supplying a store ID.
* @details
@ -100,6 +100,7 @@ public:
virtual ReturnValue_t getData(store_address_t storeId,
ConstStorageAccessor& constAccessor) = 0;
/**
* @brief getData returns an address to data and the size of the data
* for a given packet_id.

View File

@ -162,7 +162,7 @@ ReturnValue_t Subsystem::handleCommandMessage(CommandMessage* message) {
case ModeSequenceMessage::ADD_SEQUENCE: {
FixedArrayList<ModeListEntry, MAX_LENGTH_OF_TABLE_OR_SEQUENCE> sequence;
const uint8_t *pointer;
uint32_t sizeRead;
size_t sizeRead;
result = IPCStore->getData(
ModeSequenceMessage::getStoreAddress(message), &pointer,
&sizeRead);
@ -188,7 +188,7 @@ ReturnValue_t Subsystem::handleCommandMessage(CommandMessage* message) {
case ModeSequenceMessage::ADD_TABLE: {
FixedArrayList<ModeListEntry, MAX_LENGTH_OF_TABLE_OR_SEQUENCE> table;
const uint8_t *pointer;
uint32_t sizeRead;
size_t sizeRead;
result = IPCStore->getData(
ModeSequenceMessage::getStoreAddress(message), &pointer,
&sizeRead);

View File

@ -13,7 +13,7 @@ CCSDSDistributor::~CCSDSDistributor() {
iterator_t CCSDSDistributor::selectDestination() {
// debug << "CCSDSDistributor::selectDestination received: " << this->currentMessage.getStorageId().pool_index << ", " << this->currentMessage.getStorageId().packet_index << std::endl;
const uint8_t* p_packet = NULL;
uint32_t size = 0;
size_t size = 0;
//TODO check returncode?
this->tcStore->getData( this->currentMessage.getStorageId(), &p_packet, &size );
SpacePacketBase current_packet( p_packet );

View File

@ -59,7 +59,7 @@ bool TcPacketStored::checkAndSetStore() {
void TcPacketStored::setStoreAddress(store_address_t setAddress) {
this->storeAddress = setAddress;
const uint8_t* temp_data = NULL;
uint32_t temp_size;
size_t temp_size;
ReturnValue_t status = StorageManagerIF::RETURN_FAILED;
if (this->checkAndSetStore()) {
status = this->store->getData(this->storeAddress, &temp_data,
@ -79,7 +79,7 @@ store_address_t TcPacketStored::getStoreAddress() {
bool TcPacketStored::isSizeCorrect() {
const uint8_t* temp_data = NULL;
uint32_t temp_size;
size_t temp_size;
ReturnValue_t status = this->store->getData(this->storeAddress, &temp_data,
&temp_size);
if (status == StorageManagerIF::RETURN_OK) {

View File

@ -81,7 +81,7 @@ void TmPacketStored::deletePacket() {
void TmPacketStored::setStoreAddress(store_address_t setAddress) {
storeAddress = setAddress;
const uint8_t* temp_data = NULL;
uint32_t temp_size;
size_t temp_size;
if (!checkAndSetStore()) {
return;
}