Skip to content

GMR 514: Add category support to StatusCode

Charles Leggett requested to merge leggett/AtlasGaudi:dev/SC into atlas/v30r1

see gaudi/Gaudi!514 (merged)

The StatusCode now consists of a value and category/domain. By default StatusCodes are created within a "default category". But users can define new categories and StatusCodes using typed enums. The design is mainly borrowed from std::error_code.

Main changes:

  • StatusCode::setCode has been removed
  • No implicit conversions from/to bool or int anymore. This greatly increases type safety.
  • Converted all unscoped enums in Gaudi to their own StatusCode category (Clients will have to adjust their code to the scoped enum names (e.g. ERR -> Status::ERR)
  • Added operator bool() that is equivalent to isSuccess()
  • Added ternary (bitwise) AND(&) and OR(|) operators to combine StatusCodes according to three-valued logic
  • Added extensive unit tests for all StatusCode features

Impact on clients:

  • Code that relies on the implicit StatusCode<->bool/int conversion has to be changed to explicitly construct/convert StatusCodes via either the constructor, operator bool() or getCode().
  • Clients using Gaudi StatusCodes need to adjust to using the scoped enums. E.g. clients of the ConversionSvc need to change BAD_STORAGE_TYPE to Status::BAD_STORAGE_TYPE when checking for specific StatusCode return types.

Merge request reports