Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
error_domain.h
1#ifndef ERROR_DOMAIN_H
2#define ERROR_DOMAIN_H
3
4#include <stdint.h>
5
6namespace ara
7{
9 namespace core
10 {
14 {
15 public:
17 using IdType = uint64_t;
19 using CodeType = uint32_t;
20
21 private:
22 IdType mId;
23
24 public:
27 explicit constexpr ErrorDomain(IdType id) noexcept : mId{id}
28 {
29 }
30
31 ~ErrorDomain() noexcept = default;
32
33 ErrorDomain(const ErrorDomain &) = delete;
34 ErrorDomain(ErrorDomain &&) = delete;
35 ErrorDomain &operator=(const ErrorDomain &) = delete;
36 ErrorDomain &operator=(ErrorDomain &&) = delete;
37
38 constexpr bool operator==(const ErrorDomain &other) const noexcept
39 {
40 return mId == other.mId;
41 }
42
43 constexpr bool operator!=(const ErrorDomain &other) const noexcept
44 {
45 return mId != other.mId;
46 }
47
50 constexpr IdType Id() const noexcept
51 {
52 return mId;
53 }
54
57 virtual const char *Name() const noexcept = 0;
58
62 virtual const char *Message(CodeType errorCode) const noexcept = 0;
63 };
64 }
65}
66
67#endif
A class that defines the domain of an ErrorCode to avoid code interferences.
Definition: error_domain.h:14
uint64_t IdType
Alias type of the domain ID.
Definition: error_domain.h:17
virtual const char * Name() const noexcept=0
Get the domain's name.
constexpr IdType Id() const noexcept
Get the domain ID.
Definition: error_domain.h:50
uint32_t CodeType
Alias type of the error code.
Definition: error_domain.h:19
virtual const char * Message(CodeType errorCode) const noexcept=0
Get error message of a specific error code.
constexpr ErrorDomain(IdType id) noexcept
Constructor.
Definition: error_domain.h:27