This auxiliary class redirects the output sent to a streambuf to a wxTextCtrl object.
Uses code from http://www.devmaster.net/forums/showthread.php?t=7037 Jose Luis Blanco - Dec 2007 NOTE (10-Aug-2009): Added thread-safe support: We cannot write in a wxTextCtrl from a thread different than the main wx one, so if this object will be used by several threads, set "m_threadSafe" to true. In this mode, the object will NEVER write the text to the text control, unless the method "dumpNow()" is explicitly called FROM THE MAIN THREAD.
Definition at line 33 of file CMyRedirector.h.
#include <mrpt/gui/CMyRedirector.h>
Public Member Functions | |
CMyRedirector (wxTextCtrl *obj, bool yieldApplication=false, int bufferSize=3000, bool also_cerr=false, bool threadSafe=false, bool also_to_cout_cerr=false) | |
virtual | ~CMyRedirector () |
void | flush () |
virtual void | writeString (const std::string &str) |
void | dumpNow () |
Writes all the stored strings to the text control (only for threadSafe mode). More... | |
Protected Attributes | |
wxTextCtrl * | m_txt |
std::streambuf * | sbOld |
std::streambuf * | sbOldErr |
const bool | m_yieldApplication |
const bool | m_also_cerr |
const bool | m_threadSafe |
const bool | m_also_to_cout_cerr |
wxCriticalSection | m_cs |
std::string | m_strbuf |
Private Member Functions | |
int | overflow (int c) |
int | sync () |
|
inline |
Definition at line 48 of file CMyRedirector.h.
References m_also_cerr, sbOld, and sbOldErr.
|
inlinevirtual |
Definition at line 74 of file CMyRedirector.h.
References m_also_cerr, sbOld, sbOldErr, and sync().
|
inline |
Writes all the stored strings to the text control (only for threadSafe mode).
CALL THIS METHOD FROM THE MAIN THREAD!
Definition at line 120 of file CMyRedirector.h.
References _U, m_also_to_cout_cerr, m_cs, m_strbuf, and m_txt.
|
inline |
Definition at line 87 of file CMyRedirector.h.
References sync().
|
inlineprivate |
Definition at line 137 of file CMyRedirector.h.
References m_cs, sync(), and writeString().
|
inlineprivate |
Definition at line 157 of file CMyRedirector.h.
References m_cs, and writeString().
Referenced by flush(), overflow(), and ~CMyRedirector().
|
inlinevirtual |
Definition at line 92 of file CMyRedirector.h.
References _U, m_also_to_cout_cerr, m_strbuf, m_threadSafe, m_txt, and m_yieldApplication.
Referenced by overflow(), and sync().
|
protected |
Definition at line 40 of file CMyRedirector.h.
Referenced by CMyRedirector(), and ~CMyRedirector().
|
protected |
Definition at line 42 of file CMyRedirector.h.
Referenced by dumpNow(), and writeString().
|
protected |
Definition at line 44 of file CMyRedirector.h.
Referenced by dumpNow(), overflow(), and sync().
|
protected |
Definition at line 45 of file CMyRedirector.h.
Referenced by dumpNow(), and writeString().
|
protected |
Definition at line 41 of file CMyRedirector.h.
Referenced by writeString().
|
protected |
Definition at line 36 of file CMyRedirector.h.
Referenced by dumpNow(), and writeString().
|
protected |
Definition at line 39 of file CMyRedirector.h.
Referenced by writeString().
|
protected |
Definition at line 37 of file CMyRedirector.h.
Referenced by CMyRedirector(), and ~CMyRedirector().
|
protected |
Definition at line 38 of file CMyRedirector.h.
Referenced by CMyRedirector(), and ~CMyRedirector().
Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020 |