slight improvements for diagnositc output

This commit is contained in:
Robin Müller 2020-06-06 13:04:29 +02:00
parent 4b5bb0b3be
commit d387daa9d6

View File

@ -58,44 +58,43 @@ ObjectManager::ObjectManager() : produceObjects(nullptr) {
void ObjectManager::initialize() { void ObjectManager::initialize() {
if(produceObjects == nullptr) { if(produceObjects == nullptr) {
sif::error << "ObjectManager: Passed produceObjects functions is" sif::error << "ObjectManager::initialize: Passed produceObjects "
"nullptr!" << std::endl; "functions is nullptr!" << std::endl;
return; return;
} }
this->produceObjects(); this->produceObjects();
ReturnValue_t return_value = RETURN_FAILED; ReturnValue_t result = RETURN_FAILED;
uint32_t error_count = 0; uint32_t errorCount = 0;
for (auto const& it : objectList) { for (auto const& it : objectList) {
return_value = it.second->initialize(); result = it.second->initialize();
if ( return_value != RETURN_OK ) { if ( result != RETURN_OK ) {
object_id_t var = it.first; object_id_t var = it.first;
sif::error << "Object 0x" << std::hex << std::setw(8) << sif::error << "ObjectManager::initialize: Object 0x" << std::hex <<
std::setfill('0') << var << " failed to initialize " << std::setw(8) << std::setfill('0')<< var << " failed to "
"with code 0x" << return_value << std::dec << "initialize with code 0x" << result << std::dec <<
std::setfill(' ') << std::endl; std::setfill(' ') << std::endl;
error_count++; errorCount++;
} }
} }
if (error_count > 0) { if (errorCount > 0) {
sif::error << "ObjectManager::ObjectManager: Counted " << error_count sif::error << "ObjectManager::ObjectManager: Counted " << errorCount
<< " failed initializations." << std::endl; << " failed initializations." << std::endl;
} }
//Init was successful. Now check successful interconnections. //Init was successful. Now check successful interconnections.
error_count = 0; errorCount = 0;
for (auto const& it : objectList) { for (auto const& it : objectList) {
return_value = it.second->checkObjectConnections(); result = it.second->checkObjectConnections();
if ( return_value != RETURN_OK ) { if ( result != RETURN_OK ) {
sif::error << "Object " << std::hex << (int) it.first sif::error << "ObjectManager::ObjectManager: Object " << std::hex <<
<< " connection check failed with code 0x" << return_value (int) it.first << " connection check failed with code 0x"
<< std::dec << std::endl; << result << std::dec << std::endl;
error_count++; errorCount++;
} }
} }
if (error_count > 0) { if (errorCount > 0) {
sif::error << "ObjectManager::ObjectManager: Counted " << error_count sif::error << "ObjectManager::ObjectManager: Counted " << errorCount
<< " failed connection checks." << std::endl; << " failed connection checks." << std::endl;
} }
} }
void ObjectManager::printList() { void ObjectManager::printList() {