10 #include <llvm/StringRef.h> 11 #include <llvm/Twine.h> 12 #include <support/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, "") 87 int lineNumber)
const;
90 int lineNumber)
const;
93 int lineNumber)
const;
94 virtual void SetErrorRange(Error::Code code, int32_t minRange,
95 int32_t maxRange, int32_t requestedValue,
98 int lineNumber)
const;
102 int lineNumber)
const;
103 virtual void CloneError(
const ErrorBase& rhs)
const;
106 static void SetGlobalError(Error::Code code,
110 static void SetGlobalWPIError(
const llvm::Twine& errorMessage,
117 mutable Error m_error;
120 static wpi::mutex _globalErrorMutex;
121 static Error _globalError;
virtual void SetErrorRange(Error::Code code, int32_t minRange, int32_t maxRange, int32_t requestedValue, const llvm::Twine &contextMessage, llvm::StringRef filename, llvm::StringRef function, int lineNumber) const
Set the current error information associated with this sensor.
Definition: ErrorBase.cpp:141
Definition: RobotController.cpp:14
virtual void SetWPIError(const llvm::Twine &errorMessage, Error::Code code, const llvm::Twine &contextMessage, llvm::StringRef filename, llvm::StringRef function, int lineNumber) const
Set the current error information associated with this sensor.
Definition: ErrorBase.cpp:172
virtual void SetErrnoError(const llvm::Twine &contextMessage, llvm::StringRef filename, llvm::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:52
virtual bool StatusIsFatal() const
Check if the current error code represents a fatal error.
Definition: ErrorBase.cpp:196
virtual void SetError(Error::Code code, const llvm::Twine &contextMessage, llvm::StringRef filename, llvm::StringRef function, int lineNumber) const
Set the current error information associated with this sensor.
Definition: ErrorBase.cpp:112
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:79
virtual void SetImaqError(int success, const llvm::Twine &contextMessage, llvm::StringRef filename, llvm::StringRef function, int lineNumber) const
Set the current error information associated from the nivision Imaq API.
Definition: ErrorBase.cpp:86
virtual Error & GetError()
Retrieve the current error.
Definition: ErrorBase.cpp:34
Base class for most objects.
Definition: ErrorBase.h:74
virtual void ClearError() const
Clear the current error information associated with this sensor.
Definition: ErrorBase.cpp:41
Error object represents a library error.
Definition: Error.h:32
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:42
static Error & GetGlobalError()
Retrieve the current global error.
Definition: ErrorBase.cpp:227