Project
Loading...
Searching...
No Matches
Error.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
18#ifndef O2_MCH_BASE_ERROR_H
19#define O2_MCH_BASE_ERROR_H
20
21#include <cstdint>
22#include <map>
23#include <string>
24
25#include <Rtypes.h>
26
27namespace o2::mch
28{
29
31enum class ErrorGroup : uint8_t {
39};
40
41namespace internal
42{
50constexpr uint32_t buildTypeGID(ErrorGroup group, uint32_t id) { return (static_cast<uint32_t>(group) << 24) + id; }
51} // namespace internal
52
61
66constexpr ErrorGroup errorGroup(ErrorType error) { return static_cast<ErrorGroup>(static_cast<uint32_t>(error) >> 24); }
67
69struct Error {
70 static const std::map<ErrorGroup, std::string> groupNames;
71 static const std::map<ErrorType, std::string> typeNames;
72 static const std::map<ErrorType, std::string> typeDescriptions;
73
75 uint32_t id0 = 0;
76 uint32_t id1 = 0;
77 uint64_t count = 0;
78
83 static const std::map<ErrorType, std::string> getTypeNames(ErrorGroup group);
84
88 std::string getGroupName() const;
90 std::string getTypeName() const;
92 std::string getTypeDescription() const;
94 std::string asString() const;
95
96 ClassDefNV(Error, 1)
97};
98
99} // namespace o2::mch
100
101#endif // O2_MCH_BASE_ERROR_H
GLint GLsizei count
Definition glcorearb.h:399
GLint GLint GLsizei GLint GLenum GLenum type
Definition glcorearb.h:275
GLboolean GLuint group
Definition glcorearb.h:3991
GLuint id
Definition glcorearb.h:650
constexpr uint32_t buildTypeGID(ErrorGroup group, uint32_t id)
helper function to construct the error type GID (not supposed to be used outside of this header)
Definition Error.h:50
constexpr ErrorGroup errorGroup(ErrorType error)
Definition Error.h:66
ErrorGroup
Definition Error.h:31
ErrorType
Definition Error.h:54
@ PreClustering_MultipleDigitsInSamePad
static const std::map< ErrorType, std::string > typeNames
names of known error type
Definition Error.h:71
std::string getTypeDescription() const
Definition Error.cxx:77
uint32_t id1
additional descriptor used for certain error types
Definition Error.h:76
static const std::map< ErrorType, std::string > getTypeNames(ErrorGroup group)
Definition Error.cxx:48
std::string getGroupName() const
Definition Error.cxx:59
ErrorGroup getGroup() const
Definition Error.h:86
uint32_t id0
additional descriptor used for certain error types
Definition Error.h:75
std::string asString() const
Definition Error.cxx:86
static const std::map< ErrorType, std::string > typeDescriptions
descriptions of known error type
Definition Error.h:72
std::string getTypeName() const
Definition Error.cxx:68
static const std::map< ErrorGroup, std::string > groupNames
names of known error group
Definition Error.h:70