all cstdout uses wrapped in preprocessor defines
This commit is contained in:
@ -46,7 +46,9 @@ const uint8_t* ConstStorageAccessor::data() const {
|
||||
|
||||
size_t ConstStorageAccessor::size() const {
|
||||
if(internalState == AccessState::UNINIT) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "StorageAccessor: Not initialized!" << std::endl;
|
||||
#endif
|
||||
}
|
||||
return size_;
|
||||
}
|
||||
@ -54,12 +56,16 @@ size_t ConstStorageAccessor::size() const {
|
||||
ReturnValue_t ConstStorageAccessor::getDataCopy(uint8_t *pointer,
|
||||
size_t maxSize) {
|
||||
if(internalState == AccessState::UNINIT) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "StorageAccessor: Not initialized!" << std::endl;
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
if(size_ > maxSize) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "StorageAccessor: Supplied buffer not large enough"
|
||||
<< std::endl;
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
std::copy(constDataPointer, constDataPointer + size_, pointer);
|
||||
@ -76,7 +82,9 @@ store_address_t ConstStorageAccessor::getId() const {
|
||||
|
||||
void ConstStorageAccessor::print() const {
|
||||
if(internalState == AccessState::UNINIT or constDataPointer == nullptr) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "StorageAccessor: Not initialized!" << std::endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
arrayprinter::print(constDataPointer, size_);
|
||||
|
@ -8,8 +8,10 @@ LocalPool::LocalPool(object_id_t setObjectId, const LocalPoolConfig& poolConfig,
|
||||
NUMBER_OF_POOLS(poolConfig.size()),
|
||||
spillsToHigherPools(spillsToHigherPools) {
|
||||
if(NUMBER_OF_POOLS == 0) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalPool::LocalPool: Passed pool configuration is "
|
||||
<< " invalid!" << std::endl;
|
||||
#endif
|
||||
}
|
||||
max_pools_t index = 0;
|
||||
for (const auto& currentPoolConfig: poolConfig) {
|
||||
@ -118,8 +120,10 @@ ReturnValue_t LocalPool::modifyData(store_address_t storeId,
|
||||
|
||||
ReturnValue_t LocalPool::deleteData(store_address_t storeId) {
|
||||
#if FSFW_VERBOSE_PRINTOUT == 2
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::debug << "Delete: Pool: " << std::dec << storeId.poolIndex
|
||||
<< " Index: " << storeId.packetIndex << std::endl;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
ReturnValue_t status = RETURN_OK;
|
||||
@ -134,8 +138,10 @@ ReturnValue_t LocalPool::deleteData(store_address_t storeId) {
|
||||
}
|
||||
else {
|
||||
//pool_index or packet_index is too large
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalPool::deleteData: Illegal store ID, no deletion!"
|
||||
<< std::endl;
|
||||
#endif
|
||||
status = ILLEGAL_STORAGE_ID;
|
||||
}
|
||||
return status;
|
||||
@ -158,8 +164,10 @@ ReturnValue_t LocalPool::deleteData(uint8_t *ptr, size_t size,
|
||||
result = deleteData(localId);
|
||||
#if FSFW_VERBOSE_PRINTOUT == 2
|
||||
if (deltaAddress % elementSizes[n] != 0) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalPool::deleteData: Address not aligned!"
|
||||
<< std::endl;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
@ -186,8 +194,10 @@ ReturnValue_t LocalPool::initialize() {
|
||||
//Check if any pool size is large than the maximum allowed.
|
||||
for (uint8_t count = 0; count < NUMBER_OF_POOLS; count++) {
|
||||
if (elementSizes[count] >= STORAGE_FREE) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalPool::initialize: Pool is too large! "
|
||||
"Max. allowed size is: " << (STORAGE_FREE - 1) << std::endl;
|
||||
#endif
|
||||
return StorageManagerIF::POOL_TOO_LARGE;
|
||||
}
|
||||
}
|
||||
@ -209,8 +219,10 @@ ReturnValue_t LocalPool::reserveSpace(const size_t size,
|
||||
store_address_t *storeId, bool ignoreFault) {
|
||||
ReturnValue_t status = getPoolIndex(size, &storeId->poolIndex);
|
||||
if (status != RETURN_OK) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalPool( " << std::hex << getObjectId() << std::dec
|
||||
<< " )::reserveSpace: Packet too large." << std::endl;
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
status = findEmpty(storeId->poolIndex, &storeId->packetIndex);
|
||||
@ -224,9 +236,11 @@ ReturnValue_t LocalPool::reserveSpace(const size_t size,
|
||||
}
|
||||
if (status == RETURN_OK) {
|
||||
#if FSFW_VERBOSE_PRINTOUT == 2
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::debug << "Reserve: Pool: " << std::dec
|
||||
<< storeId->poolIndex << " Index: " << storeId->packetIndex
|
||||
<< std::endl;
|
||||
#endif
|
||||
#endif
|
||||
sizeLists[storeId->poolIndex][storeId->packetIndex] = size;
|
||||
}
|
||||
@ -266,8 +280,10 @@ ReturnValue_t LocalPool::getPoolIndex(size_t packetSize, uint16_t *poolIndex,
|
||||
uint16_t startAtIndex) {
|
||||
for (uint16_t n = startAtIndex; n < NUMBER_OF_POOLS; n++) {
|
||||
#if FSFW_VERBOSE_PRINTOUT == 2
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::debug << "LocalPool " << getObjectId() << "::getPoolIndex: Pool: "
|
||||
<< n << ", Element Size: " << elementSizes[n] << std::endl;
|
||||
#endif
|
||||
#endif
|
||||
if (elementSizes[n] >= packetSize) {
|
||||
*poolIndex = n;
|
||||
|
@ -26,9 +26,11 @@ ReturnValue_t PoolManager::reserveSpace(const size_t size,
|
||||
ReturnValue_t PoolManager::deleteData(
|
||||
store_address_t storeId) {
|
||||
#if FSFW_VERBOSE_PRINTOUT == 2
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::debug << "PoolManager( " << translateObject(getObjectId()) <<
|
||||
" )::deleteData from store " << storeId.poolIndex <<
|
||||
". id is "<< storeId.packetIndex << std::endl;
|
||||
#endif
|
||||
#endif
|
||||
MutexHelper mutexHelper(mutex, MutexIF::TimeoutType::WAITING,
|
||||
mutexTimeoutMs);
|
||||
|
@ -26,12 +26,16 @@ StorageAccessor::StorageAccessor(StorageAccessor&& other):
|
||||
|
||||
ReturnValue_t StorageAccessor::getDataCopy(uint8_t *pointer, size_t maxSize) {
|
||||
if(internalState == AccessState::UNINIT) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "StorageAccessor: Not initialized!" << std::endl;
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
if(size_ > maxSize) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "StorageAccessor: Supplied buffer not large "
|
||||
"enough" << std::endl;
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
std::copy(dataPointer, dataPointer + size_, pointer);
|
||||
@ -40,7 +44,9 @@ ReturnValue_t StorageAccessor::getDataCopy(uint8_t *pointer, size_t maxSize) {
|
||||
|
||||
uint8_t* StorageAccessor::data() {
|
||||
if(internalState == AccessState::UNINIT) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "StorageAccessor: Not initialized!" << std::endl;
|
||||
#endif
|
||||
}
|
||||
return dataPointer;
|
||||
}
|
||||
@ -48,12 +54,16 @@ uint8_t* StorageAccessor::data() {
|
||||
ReturnValue_t StorageAccessor::write(uint8_t *data, size_t size,
|
||||
uint16_t offset) {
|
||||
if(internalState == AccessState::UNINIT) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "StorageAccessor: Not initialized!" << std::endl;
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
if(offset + size > size_) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "StorageAccessor: Data too large for pool "
|
||||
"entry!" << std::endl;
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
std::copy(data, data + size, dataPointer + offset);
|
||||
|
Reference in New Issue
Block a user