small improvements for object manager.cpp

exit removed for get function
This commit is contained in:
Robin Müller 2020-06-04 21:05:08 +02:00
parent 93ef4eb56b
commit 365f9f8434
2 changed files with 5 additions and 6 deletions

View File

@ -23,8 +23,8 @@ ReturnValue_t ObjectManager::insert( object_id_t id, SystemObjectIF* object) {
} else { } else {
sif::error << "ObjectManager::insert: Object id " << std::hex sif::error << "ObjectManager::insert: Object id " << std::hex
<< (int)id << std::dec << " is already in use!" << std::endl; << (int)id << std::dec << " is already in use!" << std::endl;
exit(0); //This is very severe and difficult to handle in other places. //This is very severe and difficult to handle in other places.
return this->INSERTION_FAILED; std::exit(INSERTION_FAILED);
} }
} }
@ -67,9 +67,9 @@ void ObjectManager::initialize() {
return_value = it->second->initialize(); return_value = it->second->initialize();
if ( return_value != RETURN_OK ) { if ( return_value != RETURN_OK ) {
object_id_t var = it->first; object_id_t var = it->first;
sif::error << "Object " << std::hex << (int) var sif::error << "Object 0x" << std::hex << std::setw(8) <<
<< " failed to initialize with code 0x" << return_value std::setfill('0')<< var << " failed to initialize " <<
<< std::dec << std::endl; "with code 0x" << return_value << std::dec << std::endl;
error_count++; error_count++;
} }
} }

View File

@ -87,7 +87,6 @@ T* ObjectManagerIF::get( object_id_t id ) {
if(objectManager == nullptr) { if(objectManager == nullptr) {
sif::error << "ObjectManagerIF: Global object manager has not " sif::error << "ObjectManagerIF: Global object manager has not "
"been initialized yet!" << std::endl; "been initialized yet!" << std::endl;
std::exit(1);
} }
SystemObjectIF* temp = this->getSystemObject(id); SystemObjectIF* temp = this->getSystemObject(id);
return dynamic_cast<T*>(temp); return dynamic_cast<T*>(temp);