Public Member Functions | |
virtual | ~OFConsole () |
destructor. | |
ostream & | lockCout () |
acquires a lock on the cout stream and returns a reference to the stream. | |
void | unlockCout () |
releases the lock on the cout stream. | |
ostream & | getCout () |
returns a reference to the current cout stream. | |
ostream * | setCout (ostream *newCout=NULL) |
exchanges the cout stream object. | |
ostream & | lockCerr () |
acquires a lock on the cerr stream and returns a reference to the stream. | |
ostream & | getCerr () |
returns a reference to the current cerr stream. | |
void | unlockCerr () |
releases the lock on the cerr stream. | |
ostream * | setCerr (ostream *newCerr=NULL) |
exchanges the cerr stream object. | |
void | join () |
combines the cerr and cout streams. | |
void | split () |
splits combined cerr and cout streams. | |
OFBool | isJoined () |
Checks whether cout and cerr are currently combined. | |
Static Public Member Functions | |
static OFConsole & | instance () |
returns the singleton instance of this class. | |
Private Member Functions | |
OFConsole () | |
default constructor. | |
OFConsole (const OFConsole &arg) | |
private undefined copy constructor | |
OFConsole & | operator= (const OFConsole &arg) |
private undefined assignment operator | |
Private Attributes | |
ostream * | currentCout |
pointer to current cout stream, never NULL | |
ostream * | currentCerr |
pointer to current cerr stream, never NULL | |
int | joined |
true if streams are combined, false otherwise | |
Friends | |
class | OFConsoleDummyFriend |
Allows multiple threads to concurrently create output even if that output is redirected to file or memory. Protection is implemented if the module is compiled with -D_REENTRANT and is based on Mutexes. Use of the singleton prior to start of main (i.e. from global constructors) is allowed, but any use after the end of main is undefined.
Definition at line 83 of file ofconsol.h.
|
default constructor. After construction, the cout methods refer to the standard output stream and the cerr methods refer to the standard error stream. If compiled with -DDCMTK_GUI, string streams named COUT and CERR are used instead. |
|
returns a reference to the current cerr stream. This method neither locks nor unlocks the stream - the called must ensure that the stream is locked and unlocked appropriately.
Definition at line 159 of file ofconsol.h. References currentCerr, currentCout, and joined. |
|
returns a reference to the current cout stream. This method neither locks nor unlocks the stream - the called must ensure that the stream is locked and unlocked appropriately.
Definition at line 117 of file ofconsol.h. References currentCout. |
|
returns the singleton instance of this class. May be called before main() but not after end of main |
|
Checks whether cout and cerr are currently combined. This method acquires its own locks. Neither cout nor cerr may be locked by the calling thread, otherwise a deadlock may occur.
|
|
combines the cerr and cout streams. After a call to this method, both cout and cerr related methods lock, unlock and return the cout stream. This method acquires its own locks. Neither cout nor cerr may be locked by the calling thread, otherwise a deadlock may occur. |
|
acquires a lock on the cerr stream and returns a reference to the stream.
Definition at line 139 of file ofconsol.h. References currentCerr, currentCout, and joined. |
|
acquires a lock on the cout stream and returns a reference to the stream.
Definition at line 95 of file ofconsol.h. References currentCout. |
|
exchanges the cerr stream object. This method acquires its own lock. Cerr must not be locked by the calling thread, otherwise a deadlock may occur. The caller must ensure that the same stream object is not set both as cout and cerr because this might result in a conflict if one thread locks and uses cout, and another one locks and uses cerr. Use the join() method instead, see below.
|
|
exchanges the cout stream object. This method acquires its own lock. Cout must not be locked by the calling thread, otherwise a deadlock may occur. The caller must ensure that the same stream object is not set both as cout and cerr because this might result in a conflict if one thread locks and uses cout, and another one locks and uses cerr. Use the join() method instead, see below.
|
|
splits combined cerr and cout streams. After a call to this method, cout and cerr related methods again lock, unlock and return different cout and cerr objects. This method acquires its own locks. Neither cout nor cerr may be locked by the calling thread, otherwise a deadlock may occur. |