10 #include <wpi/StringRef.h> 11 #include <wpi/Twine.h> 12 #include <wpi/mutex.h> 17 #define wpi_setErrnoErrorWithContext(context) \ 18 this->SetErrnoError((context), __FILE__, __FUNCTION__, __LINE__) 19 #define wpi_setErrnoError() wpi_setErrnoErrorWithContext("") 20 #define wpi_setImaqErrorWithContext(code, context) \ 23 this->SetImaqError((code), (context), __FILE__, __FUNCTION__, __LINE__); \ 25 #define wpi_setErrorWithContext(code, context) \ 28 this->SetError((code), (context), __FILE__, __FUNCTION__, __LINE__); \ 30 #define wpi_setErrorWithContextRange(code, min, max, req, context) \ 33 this->SetErrorRange((code), (min), (max), (req), (context), __FILE__, \ 34 __FUNCTION__, __LINE__); \ 36 #define wpi_setError(code) wpi_setErrorWithContext(code, "") 37 #define wpi_setStaticErrorWithContext(object, code, context) \ 40 object->SetError((code), (context), __FILE__, __FUNCTION__, __LINE__); \ 42 #define wpi_setStaticError(object, code) \ 43 wpi_setStaticErrorWithContext(object, code, "") 44 #define wpi_setGlobalErrorWithContext(code, context) \ 47 ::frc::ErrorBase::SetGlobalError((code), (context), __FILE__, \ 48 __FUNCTION__, __LINE__); \ 50 #define wpi_setGlobalError(code) wpi_setGlobalErrorWithContext(code, "") 51 #define wpi_setWPIErrorWithContext(error, context) \ 52 this->SetWPIError((wpi_error_s_##error), (wpi_error_value_##error), \ 53 (context), __FILE__, __FUNCTION__, __LINE__) 54 #define wpi_setWPIError(error) (wpi_setWPIErrorWithContext(error, "")) 55 #define wpi_setStaticWPIErrorWithContext(object, error, context) \ 56 object->SetWPIError((wpi_error_s_##error), (context), __FILE__, \ 57 __FUNCTION__, __LINE__) 58 #define wpi_setStaticWPIError(object, error) \ 59 wpi_setStaticWPIErrorWithContext(object, error, "") 60 #define wpi_setGlobalWPIErrorWithContext(error, context) \ 61 ::frc::ErrorBase::SetGlobalWPIError((wpi_error_s_##error), (context), \ 62 __FILE__, __FUNCTION__, __LINE__) 63 #define wpi_setGlobalWPIError(error) wpi_setGlobalWPIErrorWithContext(error, "") 113 int lineNumber)
const;
127 int lineNumber)
const;
140 int lineNumber)
const;
155 virtual void SetErrorRange(Error::Code code, int32_t minRange,
156 int32_t maxRange, int32_t requestedValue,
159 int lineNumber)
const;
173 int lineNumber)
const;
175 virtual void CloneError(
const ErrorBase& rhs)
const;
184 static void SetGlobalError(Error::Code code,
const wpi::Twine& contextMessage,
188 static void SetGlobalWPIError(
const wpi::Twine& errorMessage,
199 mutable Error m_error;
202 static wpi::mutex _globalErrorMutex;
203 static Error _globalError;
Definition: Utility.cpp:119
virtual bool StatusIsFatal() const
Check if the current error code represents a fatal error.
Definition: ErrorBase.cpp:133
virtual void SetImaqError(int success, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const
Set the current error information associated from the nivision Imaq API.
Definition: ErrorBase.cpp:59
virtual void SetWPIError(const wpi::Twine &errorMessage, Error::Code code, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const
Set the current error information associated with this sensor.
Definition: ErrorBase.cpp:114
virtual Error & GetError()
Retrieve the current error.
Definition: ErrorBase.cpp:29
virtual void SetErrnoError(const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const
Set error information associated with a C library call that set an error to the "errno" global variab...
Definition: ErrorBase.cpp:35
virtual void SetErrorRange(Error::Code code, int32_t minRange, int32_t maxRange, int32_t requestedValue, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const
Set the current error information associated with this sensor.
Definition: ErrorBase.cpp:92
Base class for most objects.
Definition: ErrorBase.h:74
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
virtual void ClearError() const
Clear the current error information associated with this sensor.
Definition: ErrorBase.cpp:33
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:79
Error object represents a library error.
Definition: Error.h:32
static Error & GetGlobalError()
Retrieve the current global error.
Definition: ErrorBase.cpp:161
virtual void SetError(Error::Code code, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const
Set the current error information associated with this sensor.
Definition: ErrorBase.cpp:76