Commit 0da5ab9a authored by Brad King's avatar Brad King 💬
Browse files

ENH: Added use of VTK_OSTREAM_SUPPORTS_LONG_LONG and...

ENH: Added use of VTK_OSTREAM_SUPPORTS_LONG_LONG and VTK_ISTREAM_SUPPORTS_LONG_LONG to configure whether ostream and istream operators for long long are defined by VTK.
parent b969ec82
......@@ -150,6 +150,7 @@ std::ostream& vtkIOStreamPrintTemplate(std::ostream& os, T value, char type)
# define VTK_TYPE_INT64_MAX_DIG 32
# endif
# if !defined(VTK_ISTREAM_SUPPORTS_LONG_LONG)
static int vtkIOStreamScanStream(istream& is, char* buffer)
{
// Prepare to write to buffer.
......@@ -273,7 +274,9 @@ istream& vtkIOStreamScanTemplate(istream& is, T& value, char type)
is.clear(state);
return is;
}
# endif
# if !defined(VTK_OSTREAM_SUPPORTS_LONG_LONG)
// Print a vtkIOStreamSLL or vtkIOStreamULL value to an output stream.
template <class T>
ostream& vtkIOStreamPrintTemplate(ostream& os, T value, char type)
......@@ -306,8 +309,10 @@ ostream& vtkIOStreamPrintTemplate(ostream& os, T value, char type)
}
return os;
}
# endif
# endif // end implementation for VTK_USE_ANSI_STDLIB not defined
# if !defined(VTK_ISTREAM_SUPPORTS_LONG_LONG)
// Implement input stream operator for vtkIOStreamSLL.
istream& vtkIOStreamScan(istream& is, vtkIOStreamSLL& value)
{
......@@ -319,7 +324,9 @@ istream& vtkIOStreamScan(istream& is, vtkIOStreamULL& value)
{
return vtkIOStreamScanTemplate(is, value, 'u');
}
#endif
# if !defined(VTK_OSTREAM_SUPPORTS_LONG_LONG)
// Implement output stream operator for vtkIOStreamSLL.
ostream& vtkIOStreamPrint(ostream& os, vtkIOStreamSLL value)
{
......@@ -331,5 +338,6 @@ ostream& vtkIOStreamPrint(ostream& os, vtkIOStreamULL value)
{
return vtkIOStreamPrintTemplate(os, value, 'u');
}
# endif
#endif
......@@ -81,38 +81,43 @@ using std::fstream;
#endif
#if defined(VTK_IOSTREAM_NEED_OPERATORS_LL)
VTK_COMMON_EXPORT istream& vtkIOStreamScan(istream&, vtkIOStreamSLL&);
VTK_COMMON_EXPORT istream& vtkIOStreamScan(istream&, vtkIOStreamULL&);
VTK_COMMON_EXPORT ostream& vtkIOStreamPrint(ostream&, vtkIOStreamSLL);
VTK_COMMON_EXPORT ostream& vtkIOStreamPrint(ostream&, vtkIOStreamULL);
# if !defined(VTK_DO_NOT_DEFINE_ISTREAM_SLL)
# if !defined(VTK_ISTREAM_SUPPORTS_LONG_LONG)
VTK_COMMON_EXPORT istream& vtkIOStreamScan(istream&, vtkIOStreamSLL&);
# if !defined(VTK_DO_NOT_DEFINE_ISTREAM_SLL)
inline istream& operator >> (istream& is, vtkIOStreamSLL& value)
{
return vtkIOStreamScan(is, value);
}
# endif
# endif
# if !defined(VTK_DO_NOT_DEFINE_ISTREAM_ULL)
VTK_COMMON_EXPORT istream& vtkIOStreamScan(istream&, vtkIOStreamULL&);
# if !defined(VTK_DO_NOT_DEFINE_ISTREAM_ULL)
inline istream& operator >> (istream& is, vtkIOStreamULL& value)
{
return vtkIOStreamScan(is, value);
}
# endif
# endif
# if !defined(VTK_DO_NOT_DEFINE_OSTREAM_SLL)
# if !defined(VTK_OSTREAM_SUPPORTS_LONG_LONG)
VTK_COMMON_EXPORT ostream& vtkIOStreamPrint(ostream&, vtkIOStreamSLL);
# if !defined(VTK_DO_NOT_DEFINE_OSTREAM_SLL)
inline ostream& operator << (ostream& os, vtkIOStreamSLL value)
{
return vtkIOStreamPrint(os, value);
}
# endif
# endif
# if !defined(VTK_DO_NOT_DEFINE_OSTREAM_ULL)
VTK_COMMON_EXPORT ostream& vtkIOStreamPrint(ostream&, vtkIOStreamULL);
# if !defined(VTK_DO_NOT_DEFINE_OSTREAM_ULL)
inline ostream& operator << (ostream& os, vtkIOStreamULL value)
{
return vtkIOStreamPrint(os, value);
}
# endif
# endif
#endif
#endif // __vtkIOStream_h
......@@ -50,6 +50,8 @@
#cmakedefine VTK_NO_ANSI_STRING_STREAM
#cmakedefine VTK_NO_STD_NAMESPACE
#cmakedefine VTK_COMPILER_HAS_BOOL
#cmakedefine VTK_ISTREAM_SUPPORTS_LONG_LONG
#cmakedefine VTK_OSTREAM_SUPPORTS_LONG_LONG
#define VTK_STREAM_EOF_SEVERITY @VTK_STREAM_EOF_SEVERITY@
/*--------------------------------------------------------------------------*/
......@@ -101,8 +103,12 @@ typedef int vtkstd_bool;
/* Provide missing streaming operators. */
#if defined(VTK_SIZEOF_LONG_LONG)
# if defined(__HP_aCC)
# if !defined(VTK_OSTREAM_SUPPORTS_LONG_LONG)
# define VTK_IOSTREAM_NEED_OPERATORS_LL
# elif !defined(VTK_ISTREAM_SUPPORTS_LONG_LONG)
# define VTK_IOSTREAM_NEED_OPERATORS_LL
# endif
# if defined(VTK_IOSTREAM_NEED_OPERATORS_LL)
typedef long long vtkIOStreamSLL;
typedef unsigned long long vtkIOStreamULL;
# endif
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment