13#ifndef ML_ERROR_OUTPUT_H
14#define ML_ERROR_OUTPUT_H
60 class ErrorOutputInfos;
378 const std::string &libraryPrefix,
379 const std::string &fPrefix,
380 const std::string &functionName,
381 const std::string &reason,
382 const std::string &handling =
"",
383 const std::string &file =
"",
393 const std::string &libraryPrefix,
394 const std::string &fPrefix,
395 const std::string &functionName,
397 const std::string &handling =
"",
398 const std::string &file =
"",
415 const std::string &libraryPrefix,
416 std::stringstream &reason,
432 const std::string &libraryPrefix,
443 friend class ML_NAMESPACE::State;
465 std::string getTraceDump()
const;
470 std::streambuf *_defaultCoutBuffer;
475 std::streambuf *_defaultCerrBuffer;
489 bool _isFullDebuggingOn;
537 std::vector<void*> _errorUserDataList;
540 std::vector<ErrorOutputCB*> _errorOutputCBList;
543 std::vector<std::string> _debugEnvStrings;
552 bool _outputMessagesInVisualStudio;
Struct which contains all information about errors, fatal errors, warnings, information or debug prin...
Class to handle all ML debug prints, errors, warnings, and information.
void sendMessagesToCout(bool on)
If on is passed as true, message sending to std::cout is enabled.
size_t getNumOutputCBs() const
Returns the number of registered callbacks.
void init()
Only to force an access to instances of this class to make the objects automatically initialized duri...
ErrorOutput(const ErrorOutput &errorOutput)
Copy constructor, only to be used by state class of ML.
void destroy()
Destroys global settings; to be called during ML or mlUtils destruction, not to be called by applicat...
void setFullDebuggingOn(bool on)
Enables/disables full debugging by passing true / false as on.
MLTerminator getTerminationType(MLMessageType level) const
Return the way how the ML shall handle messages.
char * DumpCB(const void *dumpObj, const RuntimeType *dumpObjRT)
Definition of a callback type which can be registered at the ML C-API.
bool hasErrorOutputCB(void *userData, ErrorOutputCB *callback) const
Returns true if the output function is registered, i.e., if both parameters are identical with their ...
MLuint32 getTraceDumpMessageBits() const
Returns the bit mask describing all message types which shall lead to a trace list and trace stack du...
void removeAllErrorOutputCBs()
Removes all registered error print functions from list.
ErrorOutput()
Constructor.
void setOutputMessagesInVisualStudio(bool flag)
Sets if messages should be printed in Visual Studio (turned on by default in debug mode).
~ErrorOutput()
Destructor.
void addDebugEnvName(const std::string &envName)
Adds debug environment string whose information shall be printed.
void setMaxNumTraceListDumps(MLGlobalTraceBufferType num)
Sets the maximum number of trace list entries to be shown on fatal error outputs.
const std::vector< std::string > & getDebugEnvNames() const
Returns a list of debug environment names.
bool areMessagesSentToCout() const
Messages are only sent to std::cout if this flag is true.
bool areMessagesSentToCerr() const
Messages are only sent to std::cerr if this flag is true.
void sendMessagesToCerr(bool on)
If on is passed as true message sending to std::cerr is enabled.
void setDumpCB(DumpCB *dumpCB)
Registers a dump function dumpCB which will be called by the ML to dump object structures e....
void removeDebugEnvName(const std::string &envName)
Removes a registered debug environment string whose information shall not be printed any more.
size_t getNumDebugEnvNames() const
Return number of registered debug environment names.
void setTerminationType(MLMessageType level, MLTerminator term)
Sets the way how the ML shall handle a specific message type, note that ML_ALL_MESSAGES is not a vali...
void addErrorOutputCB(void *userData, ErrorOutputCB *callback)
Registers a function called when any message is sent MLErrorOutput.
DumpCB * getDumpCB() const
Returns the currently registered dump callback. Default is NULL.
bool hasDebugEnvName(const std::string &envName) const
Returns true if the debug environment name exists.
void setMessageFilter(MLuint32 messageType)
Sets messages to be handled by MLErrorOutput as set bits in messageType.
bool shouldOutputMessagesInVisualStudio() const
Returns wheter messages should be printed in Visual Studio.
MLuint32 getMaxNumTraceStackDumps() const
Returns the maximum number of trace stack entries to be shown on fatal error outputs.
void removeErrorOutputCB(void *userData, ErrorOutputCB *callback)
Removes error print function from function list if both parameters are identical with their correspon...
void ErrorOutputCB(void *usrData, const char *errStr, const ErrorOutputInfos &infos)
Function type which can be passed to the ErrorOutput class.
void removeAllDebugEnvNames()
Removes all registered debug environment strings from list.
MLuint32 getMessageFilter()
Returns the bit mask specifying the message filter which is composed from binary ORed MLMessageTypes ...
void setMaxNumTraceStackDumps(MLGlobalTraceBufferType num)
Sets the maximum number of trace stack entries to be shown on fatal error outputs.
void setTraceDumpMessageBits(MLuint32 bitMask)
Sets the bit mask describing all message types which shall lead to a trace list and trace stack dump.
MLuint32 getMaxNumTraceListDumps() const
Reutrns the maximum number of trace list entries to be shown on fatal error outputs.
void reset()
Resets instance to construction state.
bool isFullDebuggingOn() const
Returns true if full debugging is enabled, otherwise false.
ErrorOutput & operator=(const ErrorOutput &errorOutput)
Assignment operator, only to be used by state class of ML.
RuntimeType contains type and inheritance information of a class and a static dictionary with informa...
MLint32 MLErrorCode
Type of an ML Error code.
#define ML_RESULT_OK
No error. Everything seems to be okay.
void printAndNotify(MLMessageType messageType, const std::string &libraryPrefix, const std::string &fPrefix, const std::string &functionName, const std::string &reason, const std::string &handling="", const std::string &file="", int line=-1, const void *dumpObj=nullptr, const RuntimeType *dumpObjRT=nullptr, MLErrorCode errCode=ML_RESULT_OK) const
Core error printing function used by all other functions.
boost::recursive_mutex RecursiveMutex
Defines a recursive mutex.
void handleDebugPrint(const std::string &envVar, const std::string &libraryPrefix, const char *reason, const char *file, int line) const
Function called from mlDebugPrint.
void handleDebugPrint(const std::string &envVar, const std::string &libraryPrefix, std::stringstream &reason, const char *file, int line) const
Function called from mlDebugPrint.
void printAndNotify(MLMessageType messageType, const std::string &libraryPrefix, const std::string &fPrefix, const std::string &functionName, MLErrorCode reason, const std::string &handling="", const std::string &file="", int line=-1, const void *dumpObj=nullptr, const RuntimeType *dumpObjRT=nullptr) const
Like the other printAndNotify() function with the difference that reason is an MLErrorCode which is a...
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
MLTerminator
Termination types for error handling.
MLMessageType
Message types handled by the ErrorOutput class.
#define ML_UTILS_EXPORT
Defines platform dependent DLL export macro for mlUtils.
ML_UTILS_EXPORT ErrorOutput MLErrorOutput
This is a singleton used for all ML Error input and output;.
MLuint16 MLGlobalTraceBufferType
The type used in the MLGlobalTraceBuffer.
MLEXPORT std::ostream & operator<<(std::ostream &s, const ml::Field &v)
Overloads the operator "<<" for stream output of Field objects.