/home/runner/work/HiCR/HiCR/include/hicr/core/exceptions.hpp File Reference

HiCR: /home/runner/work/HiCR/HiCR/include/hicr/core/exceptions.hpp File Reference
HiCR
exceptions.hpp File Reference

Provides a failure model and corresponding exception classes. More...

#include <cstdlib>
#include <cstdarg>
#include <stdexcept>
#include <string>
#include <cstdio>
#include <hicr/core/definitions.hpp>

Go to the source code of this file.

Classes

class  HiCR::LogicException
 
class  HiCR::RuntimeException
 
class  HiCR::FatalException
 

Macros

#define HICR_THROW_LOGIC(...)   [[unlikely]] HiCR::throwException(HiCR::exceptions::exception_t::logic, __FILE__, __LINE__, __VA_ARGS__)
 
#define HICR_THROW_RUNTIME(...)   [[unlikely]] HiCR::throwException(HiCR::exceptions::exception_t::runtime, __FILE__, __LINE__, __VA_ARGS__)
 
#define HICR_THROW_FATAL(...)   [[unlikely]] HiCR::throwException(HiCR::exceptions::exception_t::fatal, __FILE__, __LINE__, __VA_ARGS__)
 

Enumerations

enum  HiCR::exceptions::exception_t { HiCR::exceptions::logic , HiCR::exceptions::runtime , HiCR::exceptions::fatal }
 

Detailed Description

Provides a failure model and corresponding exception classes.

Author
A. N. Yzelman & Sergio Martin
Date
9/8/2023

Macro Definition Documentation

◆ HICR_THROW_FATAL

#define HICR_THROW_FATAL (   ...)    [[unlikely]] HiCR::throwException(HiCR::exceptions::exception_t::fatal, __FILE__, __LINE__, __VA_ARGS__)

Macro for throwing a fatal exception in HiCR. It automatically includes additional information in the message, such as line number and source file.

Parameters
[in]...C-Formatted string and its additional arguments

◆ HICR_THROW_LOGIC

#define HICR_THROW_LOGIC (   ...)    [[unlikely]] HiCR::throwException(HiCR::exceptions::exception_t::logic, __FILE__, __LINE__, __VA_ARGS__)

Macro for throwing a logic exception in HiCR. It includes additional information in the message, such as line number and source file.

Parameters
[in]...C-Formatted string and its additional arguments

◆ HICR_THROW_RUNTIME

#define HICR_THROW_RUNTIME (   ...)    [[unlikely]] HiCR::throwException(HiCR::exceptions::exception_t::runtime, __FILE__, __LINE__, __VA_ARGS__)

Macro for throwing a runtime exception in HiCR. It automatically includes additional information in the message, such as line number and source file.

Parameters
[in]...C-Formatted string and its additional arguments

Enumeration Type Documentation

◆ exception_t

Enumeration of different exception types in HiCR for internal use

Enumerator
logic 

Represents a logic exception

runtime 

Represents a runtime exception

fatal 

Represents a fatal exception