Display_Lib_RPI 2.3.0
A C++ Library to connect electronic displays to Linux single board computers.
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
rdlib_log::logData< DATA_T > Class Template Reference

Exception class template for handling and logging errors. More...

#include <utility_data_RDL.hpp>

Public Member Functions

 logData (std::string str, DATA_T data, const std::source_location &loc=std::source_location::current())
 Constructs an OmegaException with an error message and user data.
 
std::string & what ()
 Retrieves the error message.
 
const std::string & what () const noexcept
 Retrieves the error message (const version).
 
const std::source_location & where () const noexcept
 Retrieves the source location of the exception.
 
DATA_T & data ()
 Retrieves the user-defined data.
 
const DATA_T & data () const noexcept
 Retrieves the user-defined data (const version).
 

Private Member Functions

void logError () const
 Logs the error message to a file. If the logfile cannot be opened, an error message is printed to std::cerr.
 

Private Attributes

std::string errorString
 
DATA_T userData
 
const std::source_location errorLocation
 

Detailed Description

template<typename DATA_T>
class rdlib_log::logData< DATA_T >

Exception class template for handling and logging errors.

Template Parameters
DATA_TType of additional data to store with the error.

Constructor & Destructor Documentation

◆ logData()

template<typename DATA_T >
rdlib_log::logData< DATA_T >::logData ( std::string  str,
DATA_T  data,
const std::source_location &  loc = std::source_location::current() 
)
inline

Constructs an OmegaException with an error message and user data.

Parameters
strThe error message.
dataAdditional user data related to the error.
locSource location of the error (defaults to current location).

Member Function Documentation

◆ data() [1/2]

template<typename DATA_T >
DATA_T & rdlib_log::logData< DATA_T >::data ( )
inline

Retrieves the user-defined data.

Returns
A reference to the user data.

◆ data() [2/2]

template<typename DATA_T >
const DATA_T & rdlib_log::logData< DATA_T >::data ( ) const
inlinenoexcept

Retrieves the user-defined data (const version).

Returns
A constant reference to the user data.

◆ what() [1/2]

template<typename DATA_T >
std::string & rdlib_log::logData< DATA_T >::what ( )
inline

Retrieves the error message.

Returns
A reference to the error message string.

◆ what() [2/2]

template<typename DATA_T >
const std::string & rdlib_log::logData< DATA_T >::what ( ) const
inlinenoexcept

Retrieves the error message (const version).

Returns
A constant reference to the error message string.

◆ where()

template<typename DATA_T >
const std::source_location & rdlib_log::logData< DATA_T >::where ( ) const
inlinenoexcept

Retrieves the source location of the exception.

Returns
A constant reference to the source location.

Member Data Documentation

◆ errorLocation

template<typename DATA_T >
const std::source_location rdlib_log::logData< DATA_T >::errorLocation
private

The source location of the error.

◆ errorString

template<typename DATA_T >
std::string rdlib_log::logData< DATA_T >::errorString
private

The error message

◆ userData

template<typename DATA_T >
DATA_T rdlib_log::logData< DATA_T >::userData
private

Additional data associated with the error.


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