Compute Library
 23.08
Status Class Reference

Status class. More...

#include <Error.h>

Public Member Functions

 Status ()
 Default Constructor. More...
 
 Status (ErrorCode error_status, std::string error_description=" ")
 Default Constructor. More...
 
 Status (const Status &)=default
 Allow instances of this class to be copy constructed. More...
 
 Status (Status &&)=default
 Allow instances of this class to be move constructed. More...
 
Statusoperator= (const Status &)=default
 Allow instances of this class to be copy assigned. More...
 
Statusoperator= (Status &&)=default
 Allow instances of this class to be move assigned. More...
 
 operator bool () const noexcept
 Explicit bool conversion operator. More...
 
ErrorCode error_code () const
 Gets error code. More...
 
std::string error_description () const
 Gets error description if any. More...
 
void throw_if_error () const
 Throws a runtime exception in case it contains a valid error status. More...
 

Detailed Description

Status class.

Definition at line 52 of file Error.h.

Constructor & Destructor Documentation

◆ Status() [1/4]

Status ( )
inline

Default Constructor.

Definition at line 56 of file Error.h.

57  : _code(ErrorCode::OK), _error_description(" ")
58  {
59  }

References arm_compute::OK.

◆ Status() [2/4]

Status ( ErrorCode  error_status,
std::string  error_description = " " 
)
inlineexplicit

Default Constructor.

Parameters
error_statusError status.
error_description(Optional) Error description if error_status is not valid.

Definition at line 65 of file Error.h.

66  : _code(error_status), _error_description(error_description)
67  {
68  }

◆ Status() [3/4]

Status ( const Status )
default

Allow instances of this class to be copy constructed.

◆ Status() [4/4]

Status ( Status &&  )
default

Allow instances of this class to be move constructed.

Member Function Documentation

◆ error_code()

ErrorCode error_code ( ) const
inline

Gets error code.

Returns
Error code.

Definition at line 89 of file Error.h.

90  {
91  return _code;
92  }

◆ error_description()

std::string error_description ( ) const
inline

Gets error description if any.

Returns
Error description.

Definition at line 97 of file Error.h.

98  {
99  return _error_description;
100  }

Referenced by arm_compute::test::validation::TEST_CASE(), arm_compute::throw_error(), and arm_compute::graph::detail::validate_all_nodes().

◆ operator bool()

operator bool ( ) const
inlineexplicitnoexcept

Explicit bool conversion operator.

Returns
True if there is no error else false

Definition at line 81 of file Error.h.

82  {
83  return _code == ErrorCode::OK;
84  }

References arm_compute::OK.

◆ operator=() [1/2]

Status& operator= ( const Status )
default

Allow instances of this class to be copy assigned.

◆ operator=() [2/2]

Status& operator= ( Status &&  )
default

Allow instances of this class to be move assigned.

◆ throw_if_error()

void throw_if_error ( ) const
inline

Throws a runtime exception in case it contains a valid error status.

Definition at line 102 of file Error.h.

103  {
104  if(!bool(*this))
105  {
106  internal_throw_on_error();
107  }
108  }

The documentation for this class was generated from the following files:
arm_compute::Status::error_description
std::string error_description() const
Gets error description if any.
Definition: Error.h:97
arm_compute::ErrorCode::OK
@ OK
No error.