00001 /* 00002 * See the dyninst/COPYRIGHT file for copyright information. 00003 * 00004 * We provide the Paradyn Tools (below described as "Paradyn") 00005 * on an AS IS basis, and do not warrant its validity or performance. 00006 * We reserve the right to update, modify, or discontinue this 00007 * software at any time. We shall have no obligation to supply such 00008 * updates or modifications or any other form of support to you. 00009 * 00010 * By your use of Paradyn, you understand and agree that we (or any 00011 * other person or entity with proprietary rights in Paradyn) are 00012 * under no obligation to provide either maintenance services, 00013 * update services, notices of latent defects, or correction of 00014 * defects for Paradyn. 00015 * 00016 * This library is free software; you can redistribute it and/or 00017 * modify it under the terms of the GNU Lesser General Public 00018 * License as published by the Free Software Foundation; either 00019 * version 2.1 of the License, or (at your option) any later version. 00020 * 00021 * This library is distributed in the hope that it will be useful, 00022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00024 * Lesser General Public License for more details. 00025 * 00026 * You should have received a copy of the GNU Lesser General Public 00027 * License along with this library; if not, write to the Free Software 00028 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00029 */ 00030 00031 00032 // debugOstream.h 00033 00034 #ifndef _DEBUG_OSTREAM_H_ 00035 #define _DEBUG_OSTREAM_H_ 00036 00037 #include "common/h/std_namesp.h" 00038 #include "common/h/Types.h" 00039 00040 #ifdef NEW_TIME_TYPES 00041 class timeUnit; 00042 class timeBase; 00043 class timeLength; 00044 class timeStamp; 00045 class relTimeStamp; 00046 #endif 00047 00048 class COMMON_EXPORT debug_ostream { 00049 private: 00050 ostream &actual_ostream; // probably cerr or cout 00051 bool on; 00052 00053 public: 00054 debug_ostream(ostream &iActual, bool iOn) : actual_ostream(iActual) {on=iOn;} 00055 ~debug_ostream() {} 00056 bool isOn() { return on; } 00057 void turnOn() { on = true; } 00058 void turnOff() { on = false; } 00059 debug_ostream &operator<<(char c); 00060 debug_ostream &operator<<(unsigned char c); 00061 debug_ostream &operator<<(short s); 00062 debug_ostream &operator<<(unsigned short s); 00063 debug_ostream &operator<<(int i); 00064 debug_ostream &operator<<(unsigned i); 00065 #if !defined(TYPE64BIT) 00066 // int64_t is a long which causes multiply defined functions if this 00067 // is included 00068 debug_ostream &operator<<(long l); 00069 debug_ostream &operator<<(unsigned long l); 00070 #else 00071 // These are creating probs with gcc 3.2.3 00072 // (default gcc for fresh install on x86_64 systems) 00073 debug_ostream &operator<<(int64_t l); 00074 debug_ostream &operator<<(uint64_t l); 00075 #endif 00076 00077 debug_ostream &operator<<(const char *str); 00078 debug_ostream &operator<<(const unsigned char *str); 00079 00080 debug_ostream &operator<<(const void *ptr); 00081 00082 debug_ostream &operator<<(float f); 00083 debug_ostream &operator<<(double d); 00084 00085 debug_ostream& operator<<( ostream& (*f)(ostream&) ); 00086 #ifdef NEW_TIME_TYPES 00087 debug_ostream& operator<<(timeUnit &tu); 00088 debug_ostream& operator<<(timeBase tb); 00089 debug_ostream& operator<<(timeLength tl); 00090 debug_ostream& operator<<(timeStamp ts); 00091 debug_ostream& operator<<(relTimeStamp ts); 00092 #endif 00093 }; 00094 #endif 00095
1.6.1