some small formatting stuff

This commit is contained in:
Robin Müller 2021-02-28 13:52:07 +01:00
parent a65211be51
commit 36039266ee

View File

@ -14,8 +14,7 @@ PoolDataSetBase::PoolDataSetBase(PoolVariableIF** registeredVariablesArray,
PoolDataSetBase::~PoolDataSetBase() {} PoolDataSetBase::~PoolDataSetBase() {}
ReturnValue_t PoolDataSetBase::registerVariable( ReturnValue_t PoolDataSetBase::registerVariable(PoolVariableIF *variable) {
PoolVariableIF *variable) {
if (state != States::STATE_SET_UNINITIALISED) { if (state != States::STATE_SET_UNINITIALISED) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "DataSet::registerVariable: " sif::error << "DataSet::registerVariable: "
@ -59,10 +58,12 @@ ReturnValue_t PoolDataSetBase::read(MutexIF::TimeoutType timeoutType,
} }
else { else {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "DataSet::read(): " sif::error << "DataSet::read(): Call made in wrong position. Don't forget to commit"
"Call made in wrong position. Don't forget to commit"
" member datasets!" << std::endl; " member datasets!" << std::endl;
#endif #else
sif::printError("DataSet::read(): Call made in wrong position. Don't forget to commit"
" member datasets!\n");
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
result = SET_WAS_ALREADY_READ; result = SET_WAS_ALREADY_READ;
} }
@ -85,14 +86,10 @@ ReturnValue_t PoolDataSetBase::readVariable(uint16_t count) {
/* These checks are often performed by the respective variable implementation too, but I guess /* These checks are often performed by the respective variable implementation too, but I guess
a double check does not hurt. */ a double check does not hurt. */
if (registeredVariables[count]->getReadWriteMode() != if (registeredVariables[count]->getReadWriteMode() != PoolVariableIF::VAR_WRITE and
PoolVariableIF::VAR_WRITE and registeredVariables[count]->getDataPoolId() != PoolVariableIF::NO_PARAMETER) {
registeredVariables[count]->getDataPoolId()
!= PoolVariableIF::NO_PARAMETER)
{
if(protectEveryReadCommitCall) { if(protectEveryReadCommitCall) {
result = registeredVariables[count]->read( result = registeredVariables[count]->read(timeoutTypeForSingleVars,
timeoutTypeForSingleVars,
mutexTimeoutForSingleVars); mutexTimeoutForSingleVars);
} }
else { else {
@ -121,13 +118,10 @@ void PoolDataSetBase::handleAlreadyReadDatasetCommit(
MutexIF::TimeoutType timeoutType, uint32_t lockTimeout) { MutexIF::TimeoutType timeoutType, uint32_t lockTimeout) {
lockDataPool(timeoutType, lockTimeout); lockDataPool(timeoutType, lockTimeout);
for (uint16_t count = 0; count < fillCount; count++) { for (uint16_t count = 0; count < fillCount; count++) {
if (registeredVariables[count]->getReadWriteMode() if ((registeredVariables[count]->getReadWriteMode() != PoolVariableIF::VAR_READ) and
!= PoolVariableIF::VAR_READ (registeredVariables[count]->getDataPoolId() != PoolVariableIF::NO_PARAMETER)) {
&& registeredVariables[count]->getDataPoolId()
!= PoolVariableIF::NO_PARAMETER) {
if(protectEveryReadCommitCall) { if(protectEveryReadCommitCall) {
registeredVariables[count]->commit( registeredVariables[count]->commit(timeoutTypeForSingleVars,
timeoutTypeForSingleVars,
mutexTimeoutForSingleVars); mutexTimeoutForSingleVars);
} }
else { else {
@ -144,13 +138,10 @@ ReturnValue_t PoolDataSetBase::handleUnreadDatasetCommit(
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
lockDataPool(timeoutType, lockTimeout); lockDataPool(timeoutType, lockTimeout);
for (uint16_t count = 0; count < fillCount; count++) { for (uint16_t count = 0; count < fillCount; count++) {
if (registeredVariables[count]->getReadWriteMode() if ((registeredVariables[count]->getReadWriteMode() == PoolVariableIF::VAR_WRITE) and
== PoolVariableIF::VAR_WRITE (registeredVariables[count]->getDataPoolId() != PoolVariableIF::NO_PARAMETER)) {
&& registeredVariables[count]->getDataPoolId()
!= PoolVariableIF::NO_PARAMETER) {
if(protectEveryReadCommitCall) { if(protectEveryReadCommitCall) {
result = registeredVariables[count]->commit( result = registeredVariables[count]->commit(timeoutTypeForSingleVars,
timeoutTypeForSingleVars,
mutexTimeoutForSingleVars); mutexTimeoutForSingleVars);
} }
else { else {
@ -187,8 +178,7 @@ ReturnValue_t PoolDataSetBase::serialize(uint8_t** buffer, size_t* size,
const size_t maxSize, SerializeIF::Endianness streamEndianness) const { const size_t maxSize, SerializeIF::Endianness streamEndianness) const {
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED; ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
for (uint16_t count = 0; count < fillCount; count++) { for (uint16_t count = 0; count < fillCount; count++) {
result = registeredVariables[count]->serialize(buffer, size, maxSize, result = registeredVariables[count]->serialize(buffer, size, maxSize, streamEndianness);
streamEndianness);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }