ImFusion C++ SDK 4.4.0
ErrorInheritanceHelper< T, Base > Class Template Reference

#include <RoboticsPlugin/Include/ImFusion/Robotics/Error.h>

Auxiliary type intended to implement a user defined specialization of ErrorInterface. More...

Inheritance diagram for ErrorInheritanceHelper< T, Base >:

Detailed Description

template<typename T, typename Base = ErrorInterface>
class ErrorInheritanceHelper< T, Base >

Auxiliary type intended to implement a user defined specialization of ErrorInterface.

It includes a generic clone() method necessary for error composition.

Usage example:

struct MyError: Robotics::ErrorInheritanceHelper<Error> { /* ... */ }
Expected<int> myFunction()
{
if (success)
return 0;
else
return MyError();
}
Expected<int> myRes = myFunction();
if (!myRes)
{
LOG_ERROR(myRes.error().message());
return myRes;
}
int myVar = myRes.value() - 3;
#define LOG_ERROR(...)
Emits a log message of Log::Level::Error, optionally with a category.
Definition Log.h:257

Public Member Functions

 ~ErrorInheritanceHelper () override=default
 Override destructor.
 ErrorInheritanceHelper (const ErrorInterface &ei)
std::unique_ptr< T > clone () const &
 Creates a copy of the current instance.

Member Function Documentation

◆ clone()

template<typename T, typename Base = ErrorInterface>
std::unique_ptr< T > ErrorInheritanceHelper< T, Base >::clone ( ) const &
inlinenodiscard

Creates a copy of the current instance.

This method performs a deep copy of the current instance and returns a new dynamically allocated instance that is a clone of this object.

Returns
A unique pointer to the newly cloned instance.

The documentation for this class was generated from the following file:
  • RoboticsPlugin/Include/ImFusion/Robotics/Error.h
Search Tab / S to search, Esc to close