Diag-Client-Lib
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
core_type::ErrorDomain Class Referenceabstract

Encapsulation of an error domain. An error domain is the controlling entity for ErrorCode’s error code values, and defines the mapping of such error code values to textual representations. More...

#include <error_domain.h>

Inheritance diagram for core_type::ErrorDomain:
Inheritance graph
[legend]

Public Types

using IdType = std::uint64_t
 Type alias for a unique ErrorDomain identifier type. More...
 
using CodeType = std::int32_t
 Type alias for a domain-specific error code value. More...
 
using SupportDataType = std::uint8_t
 Type alias type for vendor-specific supplementary data. More...
 

Public Member Functions

 ErrorDomain (const ErrorDomain &)=delete
 Copy construction shall be disabled. More...
 
 ErrorDomain (ErrorDomain &&)=delete
 Move construction shall be disabled. More...
 
ErrorDomainoperator= (const ErrorDomain &)=delete
 Copy assignment shall be disabled. More...
 
ErrorDomainoperator= (ErrorDomain &&)=delete
 Move assignment shall be disabled. More...
 
constexpr IdType Id () const noexcept
 Return the unique domain identifier. More...
 
virtual const char * Name () const noexcept=0
 Return the name of this error domain. More...
 
virtual const char * Message (CodeType error_code) noexcept=0
 Return a textual representation of the given error code. More...
 

Protected Member Functions

 ErrorDomain (IdType id) noexcept
 Construct a new instance with the given identifier. Identifiers are expected to be system-wide unique. More...
 
virtual ~ErrorDomain () noexcept=default
 Destructor. More...
 

Private Attributes

IdType id_
 Store the unique identifier. More...
 

Detailed Description

Encapsulation of an error domain. An error domain is the controlling entity for ErrorCode’s error code values, and defines the mapping of such error code values to textual representations.

This class is a literal type, and subclasses are strongly advised to be literal types as well.

Definition at line 20 of file error_domain.h.

Member Typedef Documentation

◆ CodeType

using core_type::ErrorDomain::CodeType = std::int32_t

Type alias for a domain-specific error code value.

Definition at line 30 of file error_domain.h.

◆ IdType

using core_type::ErrorDomain::IdType = std::uint64_t

Type alias for a unique ErrorDomain identifier type.

Definition at line 25 of file error_domain.h.

◆ SupportDataType

Type alias type for vendor-specific supplementary data.

Definition at line 35 of file error_domain.h.

Constructor & Destructor Documentation

◆ ErrorDomain() [1/3]

core_type::ErrorDomain::ErrorDomain ( const ErrorDomain )
delete

Copy construction shall be disabled.

◆ ErrorDomain() [2/3]

core_type::ErrorDomain::ErrorDomain ( ErrorDomain &&  )
delete

Move construction shall be disabled.

◆ ErrorDomain() [3/3]

core_type::ErrorDomain::ErrorDomain ( ErrorDomain::IdType  id)
explicitprotectednoexcept

Construct a new instance with the given identifier. Identifiers are expected to be system-wide unique.

Parameters
[in]idThe unique identifier

Definition at line 12 of file error_domain.cpp.

12 : id_{id} {}
IdType id_
Store the unique identifier.
Definition: error_domain.h:96

◆ ~ErrorDomain()

virtual core_type::ErrorDomain::~ErrorDomain ( )
protectedvirtualdefaultnoexcept

Destructor.

This dtor is non-virtual (and trivial) so that this class can be a literal type. While this class has virtual functions, no polymorphic destruction is needed

Member Function Documentation

◆ Id()

constexpr ErrorDomain::IdType core_type::ErrorDomain::Id ( ) const
constexprnoexcept

Return the unique domain identifier.

Returns
The unique identifier

Definition at line 14 of file error_domain.cpp.

14 { return id_; }

References id_.

◆ Message()

virtual const char* core_type::ErrorDomain::Message ( CodeType  error_code)
pure virtualnoexcept

Return a textual representation of the given error code.

Parameters
[in]error_codeThe error code value
Returns
The returned pointer remains owned by the ErrorDomain subclass and shall not be freed by clients.

Implemented in doip_client::error_domain::DoipErrorDomain, and diag::client::error_domain::DmErrorDomain.

Referenced by core_type::ErrorCode::Message().

Here is the caller graph for this function:

◆ Name()

virtual const char* core_type::ErrorDomain::Name ( ) const
pure virtualnoexcept

Return the name of this error domain.

Returns
The returned pointer remains owned by class ErrorDomain and shall not be freed by clients.

Implemented in doip_client::error_domain::DoipErrorDomain, and diag::client::error_domain::DmErrorDomain.

◆ operator=() [1/2]

ErrorDomain& core_type::ErrorDomain::operator= ( const ErrorDomain )
delete

Copy assignment shall be disabled.

◆ operator=() [2/2]

ErrorDomain& core_type::ErrorDomain::operator= ( ErrorDomain &&  )
delete

Move assignment shall be disabled.

Member Data Documentation

◆ id_

IdType core_type::ErrorDomain::id_
private

Store the unique identifier.

Definition at line 96 of file error_domain.h.

Referenced by Id().


The documentation for this class was generated from the following files: