Merge branch 'mueller/master' of https://egit.irs.uni-stuttgart.de/KSat/fsfw into mueller/master

This commit is contained in:
Robin Müller 2020-09-02 17:59:45 +02:00
commit 631b2ca705
6 changed files with 28 additions and 26 deletions

View File

@ -1,7 +1,7 @@
#ifndef FRAMEWORK_CONTAINER_DYNAMICFIFO_H_ #ifndef FSFW_CONTAINER_DYNAMICFIFO_H_
#define FRAMEWORK_CONTAINER_DYNAMICFIFO_H_ #define FSFW_CONTAINER_DYNAMICFIFO_H_
#include "../container/FIFOBase.h" #include "FIFOBase.h"
#include <vector> #include <vector>
/** /**
@ -22,7 +22,7 @@ public:
// trying to pass the pointer of the uninitialized vector // trying to pass the pointer of the uninitialized vector
// to the FIFOBase constructor directly lead to a super evil bug. // to the FIFOBase constructor directly lead to a super evil bug.
// So we do it like this now. // So we do it like this now.
this->setData(fifoVector.data()); this->setContainer(fifoVector.data());
}; };
/** /**
@ -31,7 +31,7 @@ public:
*/ */
DynamicFIFO(const DynamicFIFO& other): FIFOBase<T>(other), DynamicFIFO(const DynamicFIFO& other): FIFOBase<T>(other),
fifoVector(other.maxCapacity) { fifoVector(other.maxCapacity) {
this->setData(fifoVector.data()); this->setContainer(fifoVector.data());
} }
@ -39,4 +39,4 @@ private:
std::vector<T> fifoVector; std::vector<T> fifoVector;
}; };
#endif /* FRAMEWORK_CONTAINER_DYNAMICFIFO_H_ */ #endif /* FSFW_CONTAINER_DYNAMICFIFO_H_ */

View File

@ -1,8 +1,7 @@
#ifndef FRAMEWORK_CONTAINER_FIFO_H_ #ifndef FSFW_CONTAINER_FIFO_H_
#define FRAMEWORK_CONTAINER_FIFO_H_ #define FSFW_CONTAINER_FIFO_H_
#include "../returnvalues/HasReturnvaluesIF.h" #include "FIFOBase.h"
#include "../container/FIFOBase.h"
#include <array> #include <array>
/** /**
@ -17,18 +16,20 @@
template<typename T, size_t capacity> template<typename T, size_t capacity>
class FIFO: public FIFOBase<T> { class FIFO: public FIFOBase<T> {
public: public:
FIFO(): FIFOBase<T>(fifoArray.data(), capacity) {}; FIFO(): FIFOBase<T>(nullptr, capacity) {
this->setContainer(fifoArray.data());
};
/** /**
* @brief Custom copy constructor to set pointer correctly. * @brief Custom copy constructor to set pointer correctly.
* @param other * @param other
*/ */
FIFO(const FIFO& other): FIFOBase<T>(other) { FIFO(const FIFO& other): FIFOBase<T>(other) {
this->setData(fifoArray.data()); this->setContainer(fifoArray.data());
} }
private: private:
std::array<T, capacity> fifoArray; std::array<T, capacity> fifoArray;
}; };
#endif /* FRAMEWORK_CONTAINERS_STATICFIFO_H_ */ #endif /* FSFW_CONTAINER_FIFO_H_ */

View File

@ -1,5 +1,5 @@
#ifndef FRAMEWORK_CONTAINER_FIFOBASE_H_ #ifndef FSFW_CONTAINER_FIFOBASE_H_
#define FRAMEWORK_CONTAINER_FIFOBASE_H_ #define FSFW_CONTAINER_FIFOBASE_H_
#include "../returnvalues/HasReturnvaluesIF.h" #include "../returnvalues/HasReturnvaluesIF.h"
#include <cstddef> #include <cstddef>
@ -48,7 +48,7 @@ public:
size_t getMaxCapacity() const; size_t getMaxCapacity() const;
protected: protected:
void setData(T* data); void setContainer(T* data);
size_t maxCapacity = 0; size_t maxCapacity = 0;
T* values; T* values;
@ -60,6 +60,6 @@ protected:
size_t next(size_t current); size_t next(size_t current);
}; };
#include "../container/FIFOBase.tpp" #include "FIFOBase.tpp"
#endif /* FRAMEWORK_CONTAINER_FIFOBASE_H_ */ #endif /* FSFW_CONTAINER_FIFOBASE_H_ */

View File

@ -1,7 +1,7 @@
#ifndef FRAMEWORK_CONTAINER_FIFOBASE_TPP_ #ifndef FSFW_CONTAINER_FIFOBASE_TPP_
#define FRAMEWORK_CONTAINER_FIFOBASE_TPP_ #define FSFW_CONTAINER_FIFOBASE_TPP_
#ifndef FRAMEWORK_CONTAINER_FIFOBASE_H_ #ifndef FSFW_CONTAINER_FIFOBASE_H_
#error Include FIFOBase.h before FIFOBase.tpp! #error Include FIFOBase.h before FIFOBase.tpp!
#endif #endif
@ -80,7 +80,7 @@ inline size_t FIFOBase<T>::getMaxCapacity() const {
template<typename T> template<typename T>
inline void FIFOBase<T>::setData(T *data) { inline void FIFOBase<T>::setContainer(T *data) {
this->values = data; this->values = data;
} }

View File

@ -270,7 +270,8 @@ ReturnValue_t ParameterWrapper::copyFrom(const ParameterWrapper *from,
//need a type to do arithmetic //need a type to do arithmetic
uint8_t* typedData = static_cast<uint8_t*>(data); uint8_t* typedData = static_cast<uint8_t*>(data);
for (uint8_t fromRow = 0; fromRow < from->rows; fromRow++) { for (uint8_t fromRow = 0; fromRow < from->rows; fromRow++) {
uint8_t offset = (((startingRow + fromRow) * columns) + startingColumn) * typeSize; size_t offset = (((startingRow + fromRow) * columns) +
startingColumn) * typeSize;
std::memcpy(typedData + offset, from->readonlyData, std::memcpy(typedData + offset, from->readonlyData,
typeSize * from->columns); typeSize * from->columns);
} }

View File

@ -1,5 +1,5 @@
#ifndef FRAMEWORK_TMTCSERVICES_COMMANDINGSERVICEBASE_H_ #ifndef FSFW_TMTCSERVICES_COMMANDINGSERVICEBASE_H_
#define FRAMEWORK_TMTCSERVICES_COMMANDINGSERVICEBASE_H_ #define FSFW_TMTCSERVICES_COMMANDINGSERVICEBASE_H_
#include "../objectmanager/SystemObject.h" #include "../objectmanager/SystemObject.h"
#include "../storagemanager/StorageManagerIF.h" #include "../storagemanager/StorageManagerIF.h"
@ -345,4 +345,4 @@ private:
void checkTimeout(); void checkTimeout();
}; };
#endif /* COMMANDINGSERVICEBASE_H_ */ #endif /* FSFW_TMTCSERVICES_COMMANDINGSERVICEBASE_H_ */