Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkOStreamWrapper.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkOStreamWrapper.h,v $
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 =========================================================================*/
00036 #ifndef __vtkOStreamWrapper_h
00037 #define __vtkOStreamWrapper_h
00038 
00039 #ifndef __VTK_SYSTEM_INCLUDES__INSIDE
00040 Do_not_include_vtkOStreamWrapper_directly__vtkSystemIncludes_includes_it;
00041 #endif
00042 
00043 class vtkIndent;
00044 class vtkObjectBase;
00045 class vtkLargeInteger;
00046 class vtkSmartPointerBase;
00047 
00048 class VTK_COMMON_EXPORT vtkOStreamWrapper
00049 {
00050 public:
00052 
00054   vtkOStreamWrapper(ostream& os);
00055   vtkOStreamWrapper(vtkOStreamWrapper& r);
00057 
00058   virtual ~vtkOStreamWrapper();
00059 
00061   struct EndlType {};
00062   
00064 
00065   vtkOStreamWrapper& operator << (const EndlType&);
00066   vtkOStreamWrapper& operator << (const vtkIndent&);
00067   vtkOStreamWrapper& operator << (vtkObjectBase&);
00068   vtkOStreamWrapper& operator << (const vtkLargeInteger&);
00069   vtkOStreamWrapper& operator << (const vtkSmartPointerBase&);
00070   vtkOStreamWrapper& operator << (ostream&);
00071   vtkOStreamWrapper& operator << (const char*);
00072   vtkOStreamWrapper& operator << (void*);
00073   vtkOStreamWrapper& operator << (char);
00074   vtkOStreamWrapper& operator << (short);
00075   vtkOStreamWrapper& operator << (int);
00076   vtkOStreamWrapper& operator << (long);
00077   vtkOStreamWrapper& operator << (unsigned char);
00078   vtkOStreamWrapper& operator << (unsigned short);
00079   vtkOStreamWrapper& operator << (unsigned int);
00080   vtkOStreamWrapper& operator << (unsigned long);
00081   vtkOStreamWrapper& operator << (float);
00082   vtkOStreamWrapper& operator << (double);
00083 #if defined(VTK_SIZEOF_LONG_LONG)
00084   vtkOStreamWrapper& operator << (long long);
00085   vtkOStreamWrapper& operator << (unsigned long long);
00087 #endif
00088 #if defined( VTK_SIZEOF___INT64 ) && !defined( VTK_SIZEOF_LONG_LONG )
00089   vtkOStreamWrapper& operator << (__int64);
00090   vtkOStreamWrapper& operator << (unsigned __int64);
00091 #endif
00092 
00093   // Need to switch on bool type because this wrapper is supposed to
00094   // be as transparent as possible to user code.  This example should
00095   // not be used to justify using bool elsewhere in VTK.
00096 #ifdef VTK_COMPILER_HAS_BOOL
00097   vtkOStreamWrapper& operator << (bool);
00098 #endif
00099 
00100   // Work-around for IBM Visual Age bug in overload resolution.
00101 #if defined(__IBMCPP__)
00102   vtkOStreamWrapper& WriteInternal(const char*);
00103   vtkOStreamWrapper& WriteInternal(void*);
00104   template <typename T>
00105   vtkOStreamWrapper& operator << (T* p)
00106     {
00107     return this->WriteInternal(p);
00108     }
00109 #endif
00110 
00111   vtkOStreamWrapper& operator << (void (*)(void*));
00112   vtkOStreamWrapper& operator << (void* (*)(void*));
00113   vtkOStreamWrapper& operator << (int (*)(void*));
00114   vtkOStreamWrapper& operator << (int* (*)(void*));
00115   vtkOStreamWrapper& operator << (float* (*)(void*));
00116   vtkOStreamWrapper& operator << (const char* (*)(void*));
00117   vtkOStreamWrapper& operator << (void (*)(void*, int*));
00118   
00120   vtkOStreamWrapper& write(const char*, unsigned long);
00121   
00123   ostream& GetOStream();
00124 
00128   operator ostream&();
00129 
00131   operator int();
00132   
00134   void flush();
00135   
00138   static void UseEndl(const EndlType&) {}
00139 protected:
00140   // Reference to the real ostream.
00141   ostream& ostr;
00142 private:
00143   vtkOStreamWrapper& operator=(const vtkOStreamWrapper& r); // Not Implemented.
00144 };
00145 
00146 #endif