CommonIO.h File Reference

More...

#include <iostream>
#include <fstream>
#include <iomanip>
#include "_generic.h"
#include <strstream>
#include "utilib_dll.h"

Go to the source code of this file.

Compounds

class  CommonIO
 Class that provides globally accessible stream definitions. More...


Defines

#define USING_COMMONIO
#define DEBUG_COMMONIO
#define ucout   (**CommonIO::MapCout)
 Definition for ucout masks the standard definition of the cout stream, redirecting I/O through the CommonIO method outs.

#define ucerr   (**CommonIO::MapCerr)
 Definition for ucerr masks the standard definition of the cerr stream, redirecting I/O through the CommonIO method errs.

#define ucin   (**CommonIO::MapCin)
 Definition for ucin masks the standard definition of the cin stream, redirecting I/O through the CommonIO method ins.

#define stdcout   (*CommonIO::std_cout)
 A macro that is always maps to the standard cout stream.

#define stdcerr   (*CommonIO::std_cerr)
 A macro that is always maps to the standard cerr stream.

#define stdcin   (*CommonIO::std_cin)
 A macro that is always maps to the standard cin stream.

#define DEBUGPR(dlevel, cmd)   if (verbosity(dlevel)) {cmd; CommonIO::flush();}
 Executes cmd if verbosity(dlevel) is true.

#define DEBUGPRP(dlevel, cmd)   if (verbosity(dlevel)) { cmd; }
 Similar to DEBUGPR but does not flush the output.

#define DEBUGPRX(dlevel, ptr, stuff)   if (ptr->verbosity(dlevel)) { ucout << stuff; CommonIO::flush(); }
 Similar to DEBUGPR, but uses a pointer to another CommonIO-based class. More...

#define DEBUGPRXP(dlevel, ptr, stuff)   if (ptr->verbosity(dlevel)) { ucout << stuff; }
 Similar to DEBUGPRX, but does not flush the output.

#define REFER_DEBUG(pointer)   virtual int verbosity(int level) { return pointer->verbosity(level); };
 Declares that the debug level of the class should be taken from the object pointed to by pointer.


Functions

void cout_print (const char *str)
 Generic function for printing a stream to cout. More...

void cerr_print (const char *str)
 Generic function for printing a stream to cerr. More...

UTILIB_API void clear_print_marker_queue ()
 TODO.

UTILIB_API void set_sync_print (const int flag)
 TODO.

UTILIB_API void get_print_marker ()
 TODO.

UTILIB_API void return_print_marker ()
 TODO.

UTILIB_API ostream & Flush (ostream &outstr)
 TODO.


Variables

CommonIO global_CommonIO
 The globally defined CommonIO object that is used for functions. More...


Detailed Description

Author:
William E. Hart

Define Documentation

#define DEBUGPRX dlevel,
ptr,
stuff       if (ptr->verbosity(dlevel)) { ucout << stuff; CommonIO::flush(); }
 

Similar to DEBUGPR, but uses a pointer to another CommonIO-based class.

It can be used to debug output from a class not based on CommonIO, provided the verbosity method is defined for that class.


Function Documentation

void cerr_print const char *    str
 

Generic function for printing a stream to cerr.

Useful for writing C code that uses C++ streams without tieing stdio and C++ streams directly.

void cout_print const char *    str
 

Generic function for printing a stream to cout.

Useful for writing C code that uses C++ streams without tieing stdio and C++ streams directly.


Variable Documentation

CommonIO global_CommonIO
 

The globally defined CommonIO object that is used for functions.

This is currently not defined because of problems with static initialization with streams.