00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkOStreamWrapper.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00026 #ifndef __vtkOStreamWrapper_h 00027 #define __vtkOStreamWrapper_h 00028 00029 #ifndef __VTK_SYSTEM_INCLUDES__INSIDE 00030 Do_not_include_vtkOStreamWrapper_directly__vtkSystemIncludes_includes_it; 00031 #endif 00032 00033 class vtkIndent; 00034 class vtkObjectBase; 00035 class vtkLargeInteger; 00036 class vtkSmartPointerBase; 00037 00038 class VTK_COMMON_EXPORT vtkOStreamWrapper 00039 { 00040 public: 00042 00044 vtkOStreamWrapper(ostream& os); 00045 vtkOStreamWrapper(vtkOStreamWrapper& r); 00047 00048 virtual ~vtkOStreamWrapper(); 00049 00051 struct EndlType {}; 00052 00054 00055 vtkOStreamWrapper& operator << (const EndlType&); 00056 vtkOStreamWrapper& operator << (const vtkIndent&); 00057 vtkOStreamWrapper& operator << (vtkObjectBase&); 00058 vtkOStreamWrapper& operator << (const vtkLargeInteger&); 00059 vtkOStreamWrapper& operator << (const vtkSmartPointerBase&); 00060 vtkOStreamWrapper& operator << (ostream&); 00061 vtkOStreamWrapper& operator << (const char*); 00062 vtkOStreamWrapper& operator << (void*); 00063 vtkOStreamWrapper& operator << (char); 00064 vtkOStreamWrapper& operator << (short); 00065 vtkOStreamWrapper& operator << (int); 00066 vtkOStreamWrapper& operator << (long); 00067 vtkOStreamWrapper& operator << (unsigned char); 00068 vtkOStreamWrapper& operator << (unsigned short); 00069 vtkOStreamWrapper& operator << (unsigned int); 00070 vtkOStreamWrapper& operator << (unsigned long); 00071 vtkOStreamWrapper& operator << (float); 00072 vtkOStreamWrapper& operator << (double); 00073 #if defined(VTK_TYPE_USE_LONG_LONG) 00074 vtkOStreamWrapper& operator << (long long); 00075 vtkOStreamWrapper& operator << (unsigned long long); 00077 #endif 00078 #if defined(VTK_TYPE_USE___INT64) 00079 vtkOStreamWrapper& operator << (__int64); 00080 vtkOStreamWrapper& operator << (unsigned __int64); 00081 #endif 00082 00083 // Need to switch on bool type because this wrapper is supposed to 00084 // be as transparent as possible to user code. This example should 00085 // not be used to justify using bool elsewhere in VTK. 00086 #ifdef VTK_COMPILER_HAS_BOOL 00087 vtkOStreamWrapper& operator << (bool); 00088 #endif 00089 00090 // Work-around for IBM Visual Age bug in overload resolution. 00091 #if defined(__IBMCPP__) 00092 vtkOStreamWrapper& WriteInternal(const char*); 00093 vtkOStreamWrapper& WriteInternal(void*); 00094 template <typename T> 00095 vtkOStreamWrapper& operator << (T* p) 00096 { 00097 return this->WriteInternal(p); 00098 } 00099 #endif 00100 00101 vtkOStreamWrapper& operator << (void (*)(void*)); 00102 vtkOStreamWrapper& operator << (void* (*)(void*)); 00103 vtkOStreamWrapper& operator << (int (*)(void*)); 00104 vtkOStreamWrapper& operator << (int* (*)(void*)); 00105 vtkOStreamWrapper& operator << (float* (*)(void*)); 00106 vtkOStreamWrapper& operator << (const char* (*)(void*)); 00107 vtkOStreamWrapper& operator << (void (*)(void*, int*)); 00108 00110 vtkOStreamWrapper& write(const char*, unsigned long); 00111 00113 ostream& GetOStream(); 00114 00118 operator ostream&(); 00119 00121 operator int(); 00122 00124 void flush(); 00125 00128 static void UseEndl(const EndlType&) {} 00129 protected: 00130 // Reference to the real ostream. 00131 ostream& ostr; 00132 private: 00133 vtkOStreamWrapper& operator=(const vtkOStreamWrapper& r); // Not Implemented. 00134 }; 00135 00136 #endif