Project
Loading...
Searching...
No Matches
STUDecoderError.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#ifndef ALICEO2_EMCAL_STUDECODERERROR_H
12#define ALICEO2_EMCAL_STUDECODERERROR_H
13
14#include <exception>
15#include <iosfwd>
16#include <string>
17
18namespace o2::emcal
19{
20
30class STUDecoderError final : public std::exception
31{
32 public:
46
50 static int errorCodeToInt(ErrorCode_t errorcode);
51
55 static ErrorCode_t intToErrorCode(int errorcode);
56
60 static std::string getErrorCodeName(ErrorCode_t errorcode);
61
65 static std::string getErrorCodeName(int errorcode) { return getErrorCodeName(intToErrorCode(errorcode)); }
66
70 static std::string getErrorCodeTitle(ErrorCode_t errorcode);
71
75 static std::string getErrorCodeTitle(int errorcode) { return getErrorCodeTitle(intToErrorCode(errorcode)); }
76
80 STUDecoderError(int ddlID, ErrorCode_t errcode);
81
83 ~STUDecoderError() noexcept final = default;
84
87 const char* what() const noexcept final { return mMessage.data(); }
88
91 int getDDLID() const noexcept { return mDDLId; }
92
95 ErrorCode_t getErrorCode() const noexcept { return mErrorCode; }
96
101 void printStream(std::ostream& stream) const;
102
103 private:
104 int mDDLId;
105 ErrorCode_t mErrorCode;
106 std::string mMessage;
107};
108
113std::ostream& operator<<(std::ostream& stream, const STUDecoderError& error);
114
115} // namespace o2::emcal
116
117#endif
Handling of STU reconstruction errors.
ErrorCode_t
Error codes of STU decoding.
@ SHORT_PAYLOAD_SIZE_UNEXPECTED
short payload size unexpected
@ UNKNOWN
Unknown error code (needed for conversion to int)
@ INDEX_UNEXPECTED
Patch index unexpected.
@ OLD_PAYLOAD_VERSION
unsupported old payload version
@ PAGE_ERROR
Page decoding failed (missing header)
@ FEEID_UNEXPECTED
FeeID index unexpected.
@ FULL_PAYLOAD_SIZE_UNEXPECTED
full payload size unexpected
static std::string getErrorCodeName(ErrorCode_t errorcode)
Get the name of the error code.
~STUDecoderError() noexcept final=default
Destructor.
static std::string getErrorCodeName(int errorcode)
Get the name of the error code.
void printStream(std::ostream &stream) const
Print details of the error on the stream.
static ErrorCode_t intToErrorCode(int errorcode)
Convert integer to error code.
const char * what() const noexcept final
Access to error message.
ErrorCode_t getErrorCode() const noexcept
Get error code of the exception.
static std::string getErrorCodeTitle(ErrorCode_t errorcode)
Get the title of the error code.
int getDDLID() const noexcept
Get the ID of the DDL in which the exception is raised.
static int errorCodeToInt(ErrorCode_t errorcode)
Get integer representation of error code.
static std::string getErrorCodeTitle(int errorcode)
Get the title of the error code.
GLuint GLuint stream
Definition glcorearb.h:1806
std::ostream & operator<<(std::ostream &stream, const Cell &cell)
Stream operator for EMCAL cell.
Definition Cell.cxx:355