Add support for categories (domains) to
StatusCode by using typed enums and
std::error_code. This change is (mostly) backwards compatible.
This is based on the ideas presented at the last Gaudi workshop. The code still needs a bit of polishing but the design should be solid now.
A few remarks:
- I scratched the idea of re-defining the
StatusCodeenum integer values as the collateral damage would have been too large (e.g. even on the python side we assume that
- I decided against using
std::error_codedirectly as we don't really need all its flexibility and the code required to plug-in new categories is now quite a bit simpler. But the implementation is based on the same idea.
- I defined an
operator boolthat is equivalent with
isSuccess(). To be discussed if this is what we want...
- I kept the type of the
unsigned long. To be discussed if we want to change this to the enum default
- StatusCode values 0(FAILURE) and 1(SUCCESS) are "hard-coded" to success/failure and cannot be overridden. Also StatusCode comparisons using
operator==ignore the category for these two values. This means
sc==StatusCode::SUCCESSremains equivalent to
sc.isSuccessindependent of the category of
setCodewas removed. Could mark it as deprecated first...
operator long()was removed. Could mark it as deprecated first...
Some of the above points are probably best discussed during a developers meeting. But immediate feedback is highly appreciated (probably best to just look at the full
StatusCode.h file instead of the rather large diff).
The first commit in the MR implements the new StatusCode class but keeping it largely backwards compatible, i.e. implicit bool/long conversions are permitted. The second commit then allows only explicit conversions and also introduces
StatusCode::Category and scoped enums for all of our non-default StatusCodes. The latter means client code will have to be adjusted (e.g. clients of the
ConversionSvc need to change
Status::BAD_STORAGE_TYPE when checking for specific StatusCode return types).