Compute Library
 21.02
compare_dimension< T > Class Template Reference

Function to compare two Dimensions objects and throw an error on mismatch. More...

#include <Validate.h>

Public Member Functions

 compare_dimension (const Dimensions< T > &dim, const char *function, const char *file, int line)
 Construct a comparison function. More...
 
arm_compute::Status operator() (const Dimensions< T > &dim)
 Compare the given object against the stored one. More...
 

Detailed Description

template<typename T>
class arm_compute::detail::compare_dimension< T >

Function to compare two Dimensions objects and throw an error on mismatch.

Parameters
[in]dimObject to compare against.
[in]functionFunction in which the error occurred.
[in]fileFile in which the error occurred.
[in]lineLine in which the error occurred.

Definition at line 72 of file Validate.h.

Constructor & Destructor Documentation

◆ compare_dimension()

compare_dimension ( const Dimensions< T > &  dim,
const char *  function,
const char *  file,
int  line 
)
inline

Construct a comparison function.

Parameters
[in]dimDimensions to compare.
[in]functionSource function. Used for error reporting.
[in]fileSource code file. Used for error reporting.
[in]lineSource code line. Used for error reporting.

Definition at line 82 of file Validate.h.

83  : _dim{ dim }, _function{ function }, _file{ file }, _line{ line }
84  {
85  }

Member Function Documentation

◆ operator()()

arm_compute::Status operator() ( const Dimensions< T > &  dim)
inline

Compare the given object against the stored one.

Parameters
[in]dimTo be compared object.
Returns
a status.

Definition at line 93 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG, and arm_compute::detail::have_different_dimensions().

94  {
95  ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(have_different_dimensions(_dim, dim, 0), _function, _file, _line,
96  "Objects have different dimensions");
97  return arm_compute::Status{};
98  }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(cond, func, file, line, msg)
If the condition is true, an error is thrown.
Definition: Error.h:283
Status class.
Definition: Error.h:52
bool have_different_dimensions(const Dimensions< T > &dim1, const Dimensions< T > &dim2, unsigned int upper_dim)
Definition: Validate.h:51

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