all cstdout uses wrapped in preprocessor defines
This commit is contained in:
@ -89,8 +89,10 @@ public:
|
||||
* @return
|
||||
*/
|
||||
virtual LocalPoolObjectBase* getPoolObjectHandle(lp_id_t localPoolId) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "HasLocalDataPoolIF::getPoolObjectHandle: Not overriden"
|
||||
<< ". Returning nullptr!" << std::endl;
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -21,15 +21,19 @@ LocalDataPoolManager::LocalDataPoolManager(HasLocalDataPoolIF* owner,
|
||||
MessageQueueIF* queueToUse, bool appendValidityBuffer):
|
||||
appendValidityBuffer(appendValidityBuffer) {
|
||||
if(owner == nullptr) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalDataPoolManager::LocalDataPoolManager: "
|
||||
<< "Invalid supplied owner!" << std::endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
this->owner = owner;
|
||||
mutex = MutexFactory::instance()->createMutex();
|
||||
if(mutex == nullptr) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalDataPoolManager::LocalDataPoolManager: "
|
||||
<< "Could not create mutex." << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
hkQueue = queueToUse;
|
||||
@ -39,17 +43,21 @@ LocalDataPoolManager::~LocalDataPoolManager() {}
|
||||
|
||||
ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse) {
|
||||
if(queueToUse == nullptr) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalDataPoolManager::initialize: "
|
||||
<< std::hex << "0x" << owner->getObjectId() << ". Supplied "
|
||||
<< "queue invalid!" << std::dec << std::endl;
|
||||
#endif
|
||||
}
|
||||
hkQueue = queueToUse;
|
||||
|
||||
ipcStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
|
||||
if(ipcStore == nullptr) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalDataPoolManager::initialize: "
|
||||
<< std::hex << "0x" << owner->getObjectId() << ": Could not "
|
||||
<< "set IPC store." <<std::dec << std::endl;
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
@ -61,8 +69,10 @@ ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse) {
|
||||
hkDestinationId = hkPacketReceiver->getHkQueue();
|
||||
}
|
||||
else {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalDataPoolManager::LocalDataPoolManager: "
|
||||
<< "Default HK destination object is invalid!" << std::endl;
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
@ -85,8 +95,10 @@ ReturnValue_t LocalDataPoolManager::initializeHousekeepingPoolEntriesOnce() {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "HousekeepingManager: The map should only be initialized "
|
||||
<< "once!" << std::endl;
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
@ -339,8 +351,10 @@ ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(sid_t sid,
|
||||
AcceptsHkPacketsIF* hkReceiverObject =
|
||||
objectManager->get<AcceptsHkPacketsIF>(packetDestination);
|
||||
if(hkReceiverObject == nullptr) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalDataPoolManager::subscribeForPeriodicPacket:"
|
||||
<< " Invalid receiver!"<< std::endl;
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
@ -369,8 +383,10 @@ ReturnValue_t LocalDataPoolManager::subscribeForUpdatePackets(sid_t sid,
|
||||
AcceptsHkPacketsIF* hkReceiverObject =
|
||||
objectManager->get<AcceptsHkPacketsIF>(packetDestination);
|
||||
if(hkReceiverObject == nullptr) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalDataPoolManager::subscribeForPeriodicPacket:"
|
||||
<< " Invalid receiver!"<< std::endl;
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
@ -575,8 +591,10 @@ ReturnValue_t LocalDataPoolManager::printPoolEntry(
|
||||
lp_id_t localPoolId) {
|
||||
auto poolIter = localPoolMap.find(localPoolId);
|
||||
if (poolIter == localPoolMap.end()) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::debug << "HousekeepingManager::fechPoolEntry:"
|
||||
<< " Pool entry not found." << std::endl;
|
||||
#endif
|
||||
return HasLocalDataPoolIF::POOL_ENTRY_NOT_FOUND;
|
||||
}
|
||||
poolIter->second->print();
|
||||
@ -596,8 +614,10 @@ ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
|
||||
MessageQueueId_t destination) {
|
||||
if(dataSet == nullptr) {
|
||||
// Configuration error.
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "HousekeepingManager::generateHousekeepingPacket:"
|
||||
<< " Set ID not found or dataset not assigned!" << std::endl;
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
@ -678,10 +698,12 @@ void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver& receiver) {
|
||||
sid, dataSet, true);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
// configuration error
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::debug << "LocalDataPoolManager::performHkOperation:"
|
||||
<< "0x" << std::hex << std::setfill('0') << std::setw(8)
|
||||
<< owner->getObjectId() << " Error generating "
|
||||
<< "HK packet" << std::setfill(' ') << std::dec << std::endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -726,8 +748,10 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid,
|
||||
// Get and check dataset first.
|
||||
LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(sid);
|
||||
if(dataSet == nullptr) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "HousekeepingManager::generateHousekeepingPacket:"
|
||||
<< " Set ID not found" << std::endl;
|
||||
#endif
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
@ -752,8 +776,10 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid,
|
||||
ReturnValue_t result = ipcStore->getFreeElement(&storeId,
|
||||
expectedSize,&storePtr);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "HousekeepingManager::generateHousekeepingPacket: "
|
||||
<< "Could not get free element from IPC store." << std::endl;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -762,8 +788,10 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid,
|
||||
result = setPacket.serialize(&storePtr, &size, expectedSize,
|
||||
SerializeIF::Endianness::BIG);
|
||||
if(expectedSize != size) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "HousekeepingManager::generateSetStructurePacket: "
|
||||
<< "Expected size is not equal to serialized size" << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Send structure reporting reply.
|
||||
|
@ -375,15 +375,19 @@ ReturnValue_t LocalDataPoolManager::fetchPoolEntry(lp_id_t localPoolId,
|
||||
PoolEntry<T> **poolEntry) {
|
||||
auto poolIter = localPoolMap.find(localPoolId);
|
||||
if (poolIter == localPoolMap.end()) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "HousekeepingManager::fechPoolEntry: Pool entry "
|
||||
"not found." << std::endl;
|
||||
#endif
|
||||
return HasLocalDataPoolIF::POOL_ENTRY_NOT_FOUND;
|
||||
}
|
||||
|
||||
*poolEntry = dynamic_cast< PoolEntry<T>* >(poolIter->second);
|
||||
if(*poolEntry == nullptr) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::debug << "HousekeepingManager::fetchPoolEntry:"
|
||||
" Pool entry not found." << std::endl;
|
||||
#endif
|
||||
return HasLocalDataPoolIF::POOL_ENTRY_TYPE_CONFLICT;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
|
@ -12,8 +12,10 @@ LocalPoolDataSetBase::LocalPoolDataSetBase(HasLocalDataPoolIF *hkOwner,
|
||||
PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) {
|
||||
if(hkOwner == nullptr) {
|
||||
// Configuration error.
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalPoolDataSetBase::LocalPoolDataSetBase: Owner "
|
||||
<< "invalid!" << std::endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
hkManager = hkOwner->getHkManagerHandle();
|
||||
@ -147,8 +149,10 @@ ReturnValue_t LocalPoolDataSetBase::serializeLocalPoolIds(uint8_t** buffer,
|
||||
auto result = SerializeAdapter::serialize(¤tPoolId, buffer,
|
||||
size, maxSize, streamEndianness);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "LocalDataSet::serializeLocalPoolIds: Serialization"
|
||||
" error!" << std::endl;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -206,8 +210,10 @@ ReturnValue_t LocalPoolDataSetBase::serialize(uint8_t **buffer, size_t *size,
|
||||
|
||||
void LocalPoolDataSetBase::bitSetter(uint8_t* byte, uint8_t position) const {
|
||||
if(position > 7) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::debug << "Pool Raw Access: Bit setting invalid position"
|
||||
<< std::endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
uint8_t shiftNumber = position + (7 - 2 * position);
|
||||
@ -256,8 +262,10 @@ sid_t LocalPoolDataSetBase::getSid() const {
|
||||
bool LocalPoolDataSetBase::bitGetter(const uint8_t* byte,
|
||||
uint8_t position) const {
|
||||
if(position > 7) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::debug << "Pool Raw Access: Bit setting invalid position"
|
||||
<< std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
uint8_t shiftNumber = position + (7 - 2 * position);
|
||||
|
@ -5,12 +5,16 @@ LocalPoolObjectBase::LocalPoolObjectBase(lp_id_t poolId,
|
||||
pool_rwm_t setReadWriteMode): localPoolId(poolId),
|
||||
readWriteMode(setReadWriteMode) {
|
||||
if(poolId == PoolVariableIF::NO_PARAMETER) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "LocalPoolVar<T>::LocalPoolVar: 0 passed as pool ID, "
|
||||
<< "which is the NO_PARAMETER value!" << std::endl;
|
||||
#endif
|
||||
}
|
||||
if(hkOwner == nullptr) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalPoolVar<T>::LocalPoolVar: The supplied pool "
|
||||
<< "owner is a invalid!" << std::endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
hkManager = hkOwner->getHkManagerHandle();
|
||||
@ -23,15 +27,19 @@ LocalPoolObjectBase::LocalPoolObjectBase(object_id_t poolOwner, lp_id_t poolId,
|
||||
DataSetIF *dataSet, pool_rwm_t setReadWriteMode): localPoolId(poolId),
|
||||
readWriteMode(setReadWriteMode) {
|
||||
if(poolId == PoolVariableIF::NO_PARAMETER) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "LocalPoolVar<T>::LocalPoolVar: 0 passed as pool ID, "
|
||||
<< "which is the NO_PARAMETER value!" << std::endl;
|
||||
#endif
|
||||
}
|
||||
HasLocalDataPoolIF* hkOwner =
|
||||
objectManager->get<HasLocalDataPoolIF>(poolOwner);
|
||||
if(hkOwner == nullptr) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalPoolVariable: The supplied pool owner did not "
|
||||
<< "implement the correct interface"
|
||||
<< " HasLocalDataPoolIF!" << std::endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
hkManager = hkOwner->getHkManagerHandle();
|
||||
|
@ -33,18 +33,22 @@ inline ReturnValue_t LocalPoolVariable<T>::read(dur_millis_t lockTimeout) {
|
||||
template<typename T>
|
||||
inline ReturnValue_t LocalPoolVariable<T>::readWithoutLock() {
|
||||
if(readWriteMode == pool_rwm_t::VAR_WRITE) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::debug << "LocalPoolVar: Invalid read write "
|
||||
"mode for read() call." << std::endl;
|
||||
#endif
|
||||
return PoolVariableIF::INVALID_READ_WRITE_MODE;
|
||||
}
|
||||
|
||||
PoolEntry<T>* poolEntry = nullptr;
|
||||
ReturnValue_t result = hkManager->fetchPoolEntry(localPoolId, &poolEntry);
|
||||
if(result != RETURN_OK or poolEntry == nullptr) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "PoolVector: Read of local pool variable of object "
|
||||
<< std::hex << std::setw(8) << std::setfill('0')
|
||||
<< hkManager->getOwner() << " and lp ID " << localPoolId
|
||||
<< std::dec << " failed." << std::setfill(' ') << std::endl;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
this->value = *(poolEntry->address);
|
||||
@ -62,17 +66,21 @@ inline ReturnValue_t LocalPoolVariable<T>::commit(dur_millis_t lockTimeout) {
|
||||
template<typename T>
|
||||
inline ReturnValue_t LocalPoolVariable<T>::commitWithoutLock() {
|
||||
if(readWriteMode == pool_rwm_t::VAR_READ) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::debug << "LocalPoolVariable: Invalid read write "
|
||||
"mode for commit() call." << std::endl;
|
||||
#endif
|
||||
return PoolVariableIF::INVALID_READ_WRITE_MODE;
|
||||
}
|
||||
PoolEntry<T>* poolEntry = nullptr;
|
||||
ReturnValue_t result = hkManager->fetchPoolEntry(localPoolId, &poolEntry);
|
||||
if(result != RETURN_OK) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "PoolVector: Read of local pool variable of object "
|
||||
"0x" << std::hex << std::setw(8) << std::setfill('0') <<
|
||||
hkManager->getOwner() << " and lp ID 0x" << localPoolId <<
|
||||
std::dec << " failed.\n" << std::flush;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
*(poolEntry->address) = this->value;
|
||||
|
@ -32,8 +32,10 @@ inline ReturnValue_t LocalPoolVector<T, vectorSize>::read(uint32_t lockTimeout)
|
||||
template<typename T, uint16_t vectorSize>
|
||||
inline ReturnValue_t LocalPoolVector<T, vectorSize>::readWithoutLock() {
|
||||
if(readWriteMode == pool_rwm_t::VAR_WRITE) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::debug << "LocalPoolVar: Invalid read write "
|
||||
"mode for read() call." << std::endl;
|
||||
#endif
|
||||
return PoolVariableIF::INVALID_READ_WRITE_MODE;
|
||||
}
|
||||
|
||||
@ -42,10 +44,12 @@ inline ReturnValue_t LocalPoolVector<T, vectorSize>::readWithoutLock() {
|
||||
memset(this->value, 0, vectorSize * sizeof(T));
|
||||
|
||||
if(result != RETURN_OK) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "PoolVector: Read of local pool variable of object "
|
||||
"0x" << std::hex << std::setw(8) << std::setfill('0') <<
|
||||
hkManager->getOwner() << "and lp ID 0x" << localPoolId <<
|
||||
std::dec << " failed." << std::endl;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
std::memcpy(this->value, poolEntry->address, poolEntry->getByteSize());
|
||||
@ -64,17 +68,21 @@ inline ReturnValue_t LocalPoolVector<T, vectorSize>::commit(
|
||||
template<typename T, uint16_t vectorSize>
|
||||
inline ReturnValue_t LocalPoolVector<T, vectorSize>::commitWithoutLock() {
|
||||
if(readWriteMode == pool_rwm_t::VAR_READ) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::debug << "LocalPoolVar: Invalid read write "
|
||||
"mode for commit() call." << std::endl;
|
||||
#endif
|
||||
return PoolVariableIF::INVALID_READ_WRITE_MODE;
|
||||
}
|
||||
PoolEntry<T>* poolEntry = nullptr;
|
||||
ReturnValue_t result = hkManager->fetchPoolEntry(localPoolId, &poolEntry);
|
||||
if(result != RETURN_OK) {
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "PoolVector: Read of local pool variable of object "
|
||||
"0x" << std::hex << std::setw(8) << std::setfill('0') <<
|
||||
hkManager->getOwner() << " and lp ID 0x" << localPoolId <<
|
||||
std::dec << " failed.\n" << std::flush;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
std::memcpy(poolEntry->address, this->value, poolEntry->getByteSize());
|
||||
@ -89,8 +97,10 @@ inline T& LocalPoolVector<T, vectorSize>::operator [](int i) {
|
||||
}
|
||||
// If this happens, I have to set some value. I consider this
|
||||
// a configuration error, but I wont exit here.
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalPoolVector: Invalid index. Setting or returning"
|
||||
" last value!" << std::endl;
|
||||
#endif
|
||||
return value[i];
|
||||
}
|
||||
|
||||
@ -101,8 +111,10 @@ inline const T& LocalPoolVector<T, vectorSize>::operator [](int i) const {
|
||||
}
|
||||
// If this happens, I have to set some value. I consider this
|
||||
// a configuration error, but I wont exit here.
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalPoolVector: Invalid index. Setting or returning"
|
||||
" last value!" << std::endl;
|
||||
#endif
|
||||
return value[i];
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,9 @@ public:
|
||||
if(readObject != nullptr) {
|
||||
readResult = readObject->read(mutexTimeout);
|
||||
#if FSFW_PRINT_VERBOSITY_LEVEL == 1
|
||||
#if CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "PoolReadHelper: Read failed!" << std::endl;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user