00001 /*************************************************************************** 00002 *cr 00003 *cr (C) Copyright 1995-2011 The Board of Trustees of the 00004 *cr University of Illinois 00005 *cr All Rights Reserved 00006 *cr 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * RCS INFORMATION: 00011 * 00012 * $RCSfile: Inform.h,v $ 00013 * $Author: johns $ $Locker: $ $State: Exp $ 00014 * $Revision: 1.29 $ $Date: 2011/11/20 00:49:49 $ 00015 * 00016 *************************************************************************** 00017 * DESCRIPTION: 00018 * 00019 * Inform - takes messages and displays them to the given ostream. 00020 * 00021 ***************************************************************************/ 00022 #ifndef INFORM_H 00023 #define INFORM_H 00024 00025 // largest message (in bytes) that can be kept 00026 #define MAX_MSG_SIZE (1024 * 8) 00027 00028 00033 class Inform { 00034 private: 00035 char *name; 00036 char buf[MAX_MSG_SIZE+1]; 00037 char tmpbuf[128]; 00038 #if defined(VMDTKCON) 00039 int loglvl; 00040 #endif 00041 int muted; 00042 00043 public: 00044 #if defined(VMDTKCON) 00045 Inform(const char *, int lvl); 00046 #else 00047 Inform(const char *); 00048 #endif 00049 ~Inform(); 00050 Inform &send(); 00051 Inform &reset(); 00052 00054 Inform& operator<<(const char *); 00055 Inform& operator<<(char); 00056 Inform& operator<<(int); 00057 Inform& operator<<(long); 00058 Inform& operator<<(unsigned long); 00059 Inform& operator<<(double); 00060 Inform& operator<<(Inform& (*f)(Inform &)); 00061 00062 void mute() { muted = 1; } 00063 void unmute() { muted = 0; } 00064 00066 const char *text() const { 00067 return buf; 00068 } 00069 }; 00070 00071 extern Inform& sendmsg(Inform&); 00072 extern Inform& ends(Inform&); 00073 00074 // XXX these are global 00075 extern Inform msgInfo; 00076 extern Inform msgWarn; 00077 extern Inform msgErr; 00078 00079 #endif // INFORM_H 00080
1.2.14 written by Dimitri van Heesch,
© 1997-2002