15 #ifndef __UT_ErrorManager_h__
16 #define __UT_ErrorManager_h__
36 FLAG_ERRORS_READ = 0x01,
37 FLAG_SCAN_NEEDED = 0x02,
63 {
return addMessage(
"SOP", code, msg, loc); }
66 {
return addPrompt(
"SOP", code, msg, loc); }
69 {
return addWarning(
"SOP", code, msg, loc); }
72 {
return addError(
"SOP", code, msg, loc); }
75 {
return addFatal(
"SOP", code, msg, loc); }
92 void clearAndDestroyErrors();
94 bool isEmpty()
const {
return myList.entries() <= 0; }
99 int rangestart = 0,
int rangeend = -1,
101 bool borrow_only =
false);
103 int removeError(
int index);
104 int findError(
const char *type,
int code)
const;
108 int getErrorMessages(
UT_String &messages,
110 bool use_headers =
true);
130 void pruneDuplicates();
134 return ((myFlags & FLAG_DISABLED) != 0);
139 myFlags |= FLAG_DISABLED;
141 myFlags &= ~FLAG_DISABLED;
145 return (myFlags & FLAG_NOLOG) == 0;
152 myFlags |= FLAG_NOLOG;
154 myFlags &= ~FLAG_NOLOG;
159 if (sev > mySeverity)
175 return ((myFlags & FLAG_DEADLOCK) != 0);
180 { myUniversalLoggingContextFunction = context_fn; }
184 int64 mem = inclusive ?
sizeof(*this) : 0;
185 mem += myList.getMemoryUsage(
false);
186 for (
exint i = 0; i < myList.entries(); ++i)
187 mem += myList(i)->getMemoryUsage(
true);
193 static int getErrorManagerTimestamp();
204 void setReadFlag(
bool state);
207 return (myFlags & FLAG_ERRORS_READ) != 0;
210 void setNeedScan(
bool needscan);
213 return (myFlags & FLAG_SCAN_NEEDED) != 0;
219 myFlags |= FLAG_DEADLOCK;
221 myFlags &= ~FLAG_DEADLOCK;
228 static const int MAX_ERRORS_KEPT = 40;
229 static const int MAX_ERRORS_STEAL = 400;
232 int max_errors = MAX_ERRORS_KEPT,
235 void computeSeverity();
278 { myErrorManager.setDisabled(f); }
284 bool use_headers =
true)
286 return myErrorManager.getErrorMessages(
336 UT_API void UTpopErrorManager(
int thread);
362 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_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
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)
void setUniversalLoggingContextFunction(UT_Function< UT_StringHolder()> context_fn)
UT_ErrorList::const_iterator begin() const
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
std::function< T > UT_Function
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
UT_API int UTfindError(const char *type, int code)
LeafData & operator=(const LeafData &)=delete
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.
OIIO_FORCEINLINE T log(const T &v)
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_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()
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.