15 #ifndef __UT_ErrorManager_h__
16 #define __UT_ErrorManager_h__
30 FLAG_ERRORS_READ = 0x01,
31 FLAG_SCAN_NEEDED = 0x02,
54 {
return addMessage(
"SOP", code, msg, loc); }
57 {
return addPrompt(
"SOP", code, msg, loc); }
60 {
return addWarning(
"SOP", code, msg, loc); }
63 {
return addError(
"SOP", code, msg, loc); }
66 {
return addFatal(
"SOP", code, msg, loc); }
83 void clearAndDestroyErrors();
85 bool isEmpty()
const {
return myList.entries() <= 0; }
90 int rangestart = 0,
int rangeend = -1,
92 bool borrow_only =
false);
94 int removeError(
int index);
95 int findError(
const char *type,
int code)
const;
101 bool use_headers =
true);
120 void pruneDuplicates();
124 return ((myFlags & FLAG_DISABLED) != 0);
129 myFlags |= FLAG_DISABLED;
131 myFlags &= ~FLAG_DISABLED;
135 return (myFlags & FLAG_NOLOG) == 0;
142 myFlags |= FLAG_NOLOG;
144 myFlags &= ~FLAG_NOLOG;
149 if (sev > mySeverity)
165 return ((myFlags & FLAG_DEADLOCK) != 0);
170 { myUniversalLoggingContextFunction = context_fn; }
174 int64 mem = inclusive ?
sizeof(*this) : 0;
175 mem += myList.getMemoryUsage(
false);
176 for (
exint i = 0; i < myList.entries(); ++i)
177 mem += myList(i)->getMemoryUsage(
true);
183 static int getErrorManagerTimestamp();
194 void setReadFlag(
bool state);
197 return (myFlags & FLAG_ERRORS_READ) != 0;
200 void setNeedScan(
bool needscan);
203 return (myFlags & FLAG_SCAN_NEEDED) != 0;
209 myFlags |= FLAG_DEADLOCK;
211 myFlags &= ~FLAG_DEADLOCK;
218 static const int MAX_ERRORS_KEPT = 40;
219 static const int MAX_ERRORS_STEAL = 400;
222 int max_errors = MAX_ERRORS_KEPT,
225 void computeSeverity();
227 std::function<UT_StringHolder()> myUniversalLoggingContextFunction;
244 explicit Scope(
int thread);
266 { myErrorManager.setDisabled(f); }
272 bool use_headers =
true)
274 return myErrorManager.getErrorMessages(
317 UT_API void UTpopErrorManager(
int thread);
343 const char *type,
int code,
const UT_Error & getError(int index) const
UT_ErrorSeverity getSeverity()
int getErrorMessages(UT_String &messages, UT_ErrorSeverity severity=UT_ERROR_NONE, bool use_headers=true)
Get error messages.
UT_API void UTpopErrorManager()
UT_ErrorSeverity sopAddMessage(int code, const char *msg=0, const UT_SourceLocation *loc=0)
Scope(DelayTag)
Construct scope which has not begun yet. Call begin() to start.
UT_API UT_ErrorSeverity UTaddFatal(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0)
GLsizei const GLchar *const * path
UT_API UT_ErrorManager * UTgetErrorManager()
void setErrorLogging(bool f)
UT_ErrorList::const_iterator end() const
UT_ErrorManager & getErrorManager()
UT_API UT_ErrorSeverity UTaddMessage(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0)
void setDeadlockError(bool onoff)
UT_API UT_ErrorSeverity UTaddSystemError(const char *msg=0)
UT_API UT_ErrorSeverity UTgetErrorSeverity()
#define SYS_DEPRECATED_REPLACE(__V__, __R__)
UT_ErrorSeverity updateSeverity(UT_ErrorSeverity sev)
bool hasDeadlockError() const
GLint GLint GLsizei GLint GLenum GLenum type
UT_API int UTcheckOutStream(std::ostream &os, const char *m, const char *path=0)
UT_API UT_ErrorSeverity UTaddPrompt(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0)
UT_ErrorList::const_iterator begin() const
UT_ErrorSeverity sopAddWarning(int code, const char *msg=0, const UT_SourceLocation *loc=0)
UT_API UT_ErrorSeverity UTaddCommonError(UT_CommonErrorCode what, const char *msg=0)
UT_ErrorSeverity sopAddError(int code, const char *msg=0, const UT_SourceLocation *loc=0)
int64 getMemoryUsage(bool inclusive) const
**Note that the tasks the is the thread number *for the or if it s being executed by a non pool thread(this *can happen in cases where the whole pool is occupied and the calling *thread contributes to running the work load).**Thread pool.Have fun
void setUniversalLoggingContextFunction(std::function< UT_StringHolder()> context_fn)
UT_API int UTfindError(const char *type, int code)
UT_API UT_ErrorSeverity UTaddWarning(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0)
A global error manager scope.
base_iterator< const UT_Error *, true > const_iterator
UT_API UT_ErrorSeverity UTaddDeadlockError()
UT_API UT_ErrorSeverity UTaddCommonWarning(UT_CommonErrorCode what, const char *msg=0)
UT_ErrorManager::Scope UT_AutoErrorManager
Alias UT_AutoErrorManager as UT_ErrorManager::Scope.
~Scope()
Ends error scope if needed.
UT_API UT_ErrorSeverity UTaddGeneric(UT_ErrorSeverity sev, const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0)
Add a generic error message to the global error manager.
UT_ValArray< UT_Error * > UT_ErrorList
UT_API void UTpushErrorManager()
UT_ErrorSeverity sopAddFatal(int code, const char *msg=0, const UT_SourceLocation *loc=0)
UT_API UT_ErrorSeverity UTaddError(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0)
UT_ErrorSeverity sopAddPrompt(int code, const char *msg=0, const UT_SourceLocation *loc=0)
UT_ErrorSeverity getErrorState()