39 #define NCBI_USE_ERRCODE_X Corelib_Message
64 "Unbalanced PushListener/PopListener calls: "
65 "listener index " <<
depth <<
" has been already removed");
71 "Unbalanced PushListener/PopListener calls: "
72 "removing " << sz -
depth <<
" lost listeners");
124 s_Listeners.SetValue(ls, CTlsBase::DefaultCleanup<CMessageListener_Stack>);
void PopListener(size_t depth=0)
CMessageListener_Stack(void)
size_t PushListener(IMessageListener &listener, IMessageListener::EListenFlag flag)
list< SListenerNode > TListenerStack
IMessageListener::EPostResult Post(const IMessage &message)
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
Default IProgressMessage implementation.
static unsigned char depth[2 *(256+1+29)+1]
std::ofstream out("events_result.xml")
main entry point for tests
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#define ERR_POST_X_ONCE(err_subcode, message)
Error posting only once during program execution with default error code and given error subcode.
static const char * SeverityName(EDiagSev sev)
Get a common symbolic name for the severity levels.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
EDiagSev
Severity level for the posted diagnostics.
void Warning(CExceptionArgs_Base &args)
static bool HaveListeners(void)
Check if there are any listeners installed in the current thread.
EPostResult
Result of PostXXXX() operation.
virtual IMessage * Clone(void) const =0
Create a copy of the message.
virtual void Write(CNcbiOstream &out) const
Print the message and any additional information to the stream.
virtual string GetText(void) const
Get text message.
virtual size_t Count(void) const
Get total number of collected messages.
virtual string Compose(void) const
Get the whole composed message as string.
static EPostResult Post(const IMessage &message)
Post the message to listener(s), if any.
virtual EPostResult PostProgress(const IProgressMessage &progress)
Report progress.
virtual CProgressMessage_Basic * Clone(void) const
Create a copy of the message.
virtual Uint8 GetCurrent(void) const
Get current progress value (e.g. % or bytes written).
virtual int GetSubCode(void) const
Get error subcode. Zero = not set.
CMessage_Basic(const string &txt, EDiagSev sev, int err_code=0, int sub_code=0)
virtual const IMessage & GetMessage(size_t index) const
Get a previously collected message.
virtual void Write(CNcbiOstream &out) const
Print the message and any additional information to the stream.
virtual EDiagSev GetSeverity(void) const
Get message severity.
virtual IMessage * Clone(void) const
Create a copy of the message.
virtual string Compose(void) const
Get the whole composed message as string.
virtual void Clear(void)
Clear all collected messages.
virtual Uint8 GetTotal(void) const
Get total progress value (e.g. 100% or file size).
virtual string GetText(void) const
Get text message.
CProgressMessage_Basic(const string &txt, Uint8 current, Uint8 total)
EListenFlag
Which messages should be passed to the listener.
static size_t PushListener(IMessageListener &listener, EListenFlag flag=eListen_Unhandled)
Push a new listener to the stack in the current thread.
virtual int GetCode(void) const
Get error code. Zero = not set.
static void PopListener(size_t depth=0)
Remove listener(s) from the current thread's stack.
virtual EPostResult PostMessage(const IMessage &message)
Post new message to the listener.
@ eHandled
The message was successfully handled and will not be passed to other listeners installed with eListen...
@ eUnhandled
The message was not handled and should be passed to other listeners.
@ eListen_Unhandled
Default flag.
uint64_t Uint8
8-byte (64-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition of all error codes used in corelib (xncbi.lib).
where both of them are integers Note
CMessageListener_Stack & s_GetListenerStack(void)
static CStaticTls< CMessageListener_Stack > s_Listeners
IMessage/IMessageListener interfaces and basic implementations.
Multi-threading – classes, functions, and features.