feat(dobj): added error tracking to DObject
DObject now includes an error code so that errors can be tracked with return values from functions
This commit is contained in:
@@ -48,6 +48,19 @@ bool DObject::isDebuggingEnabled() const noexcept {
|
||||
return debugEnabled_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @breif Sets an error code and returns the old one
|
||||
*/
|
||||
int DObject::setErrorCode(int code) noexcept {
|
||||
int oldCode = errorCode_;
|
||||
errorCode_ = code;
|
||||
return oldCode;
|
||||
}
|
||||
|
||||
int DObject::getErrorCode() const noexcept {
|
||||
return errorCode_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Registers a plugin with the DObject.
|
||||
*/
|
||||
@@ -203,4 +216,4 @@ std::ostream& operator<<(std::ostream& os, const DObject& obj) {
|
||||
os << "\n Data Type: " << obj.dataTypeMap.at(obj.data_.index());
|
||||
os << "\n Plugins Registered: " << obj.plugins_.size() << "\n";
|
||||
return os;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user