Skip to content

Commit 0b55f0b

Browse files
committed
added InfoLoggerErrorCodes.h to reserve specific ranges for each o2 module
1 parent 8504ede commit 0b55f0b

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

src/InfoLoggerErrorCodes.h

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
12+
// This file is used to define the error codes used in InfoLogger
13+
// Some ranges are reserved for each external module making use of error codes.
14+
// Error codes are referenced and documented centrally here.
15+
16+
17+
namespace AliceO2
18+
{
19+
namespace InfoLogger
20+
{
21+
22+
23+
// Structure to describe the ranges of error codes
24+
typedef struct {
25+
const int errorCodeMin; // minimum error code
26+
const int errorCodeMax; // maximum error code max
27+
const char *component; // component associated to this error code range
28+
const char *url; // link to corresponding troubleshooting documentation
29+
} ErrorCodeRange;
30+
31+
// Static array defining reserved error code ranges to be used by the o2 modules.
32+
// Error code definitions within each range is left to the corresponding package.
33+
// Terminated by a null entry
34+
static constexpr ErrorCodeRange errorCodeRanges[]={
35+
{ 0, 999, "reserved for general purpose", "" },
36+
{ 1000, 1999, "infoLogger", "" },
37+
{ 2000, 2999, "aliECS", "" },
38+
{ 0, 0, nullptr, nullptr}
39+
};
40+
41+
// Constant giving the number of error code ranges defined in errorCodeRanges[]
42+
static int numberOfErrorCodeRanges = sizeof(errorCodeRanges)/sizeof(ErrorCodeRange)-1;
43+
44+
// Structure to describe each error code
45+
typedef struct {
46+
const int errorCode; // minimum error code
47+
const char *description; // short description of the error / hint
48+
const char *url; // link to corresponding troubleshooting documentation
49+
} ErrorCode;
50+
51+
// Static array defining available error codes
52+
// Terminated by a null entry
53+
static constexpr ErrorCode errorCodes[]={
54+
{ 0, nullptr, nullptr}
55+
};
56+
57+
// Constant giving the number of error codes defined in errorCodes[]
58+
static int numberOfErrorCodes = sizeof(errorCodes)/sizeof(ErrorCode)-1;
59+
60+
61+
// end namespace InfoLogger
62+
}
63+
// end namespace AliceO2
64+
}

0 commit comments

Comments
 (0)