fei_iostream.hpp

00001 /*--------------------------------------------------------------------*/
00002 /*    Copyright 2005 Sandia Corporation.                              */
00003 /*    Under the terms of Contract DE-AC04-94AL85000, there is a       */
00004 /*    non-exclusive license for use of this work by or on behalf      */
00005 /*    of the U.S. Government.  Export of this program may require     */
00006 /*    a license from the United States Government.                    */
00007 /*--------------------------------------------------------------------*/
00008 
00009 #ifndef _fei_iostream_hpp_
00010 #define _fei_iostream_hpp_
00011 
00012 #include "fei_macros.hpp"
00013 
00014 //
00015 //The stuff in this file somewhat protects us from the fact that some
00016 //platforms may not put stream-related stuff in the std namespace,
00017 //even though most do.
00018 //These days (2007) perhaps all platforms do put everything in std and
00019 //perhaps no platforms still have iostream.h without having <iostream>, etc.
00020 //But historically we've had to account for these possibilities and I see
00021 //little to be gained from removing this flexibility at this point.
00022 //
00023 //The basic mechanism here is to use macros that are defined differently
00024 //for certain situations. An alternative approach would be to import
00025 //symbols into our namespace, but we choose not to do that since it is
00026 //a well-known sin to perform namespace pollution from within a header.
00027 //
00028 
00029 #ifdef FEI_HAVE_IOSTREAM
00030 #include <iostream>
00031 #define FEI_OSTREAM std::ostream
00032 #define FEI_ISTREAM std::istream
00033 #define FEI_COUT std::cout
00034 #define FEI_CERR std::cerr
00035 #define FEI_ENDL std::endl
00036 #elif defined(FEI_HAVE_IOSTREAM_H)
00037 #include <iostream.h>
00038 #define FEI_OSTREAM ostream
00039 #define FEI_ISTREAM istream
00040 #define FEI_COUT cout
00041 #define FEI_CERR cerr
00042 #define FEI_ENDL endl
00043 #else
00044 #error "must have <iostream> or <iostream.h>"
00045 #endif
00046 //endif for ifdef FEI_HAVE_IOSTREAM
00047 
00048 #ifdef FEI_HAVE_IOMANIP
00049 #include <iomanip>
00050 #elif defined (FEI_HAVE_IOMANIP_H)
00051 #include <iomanip.h>
00052 #endif
00053 
00054 #ifdef FEI_HAVE_STD_IOS_FMTFLAGS
00055 
00056 #define IOS_FMTFLAGS std::ios_base::fmtflags
00057 #define IOS_SCIENTIFIC std::ios_base::scientific
00058 #define IOS_FLOATFIELD std::ios_base::floatfield
00059 #define IOS_FIXED std::ios_base::fixed
00060 #define IOS_APP std::ios_base::app
00061 #define IOS_OUT std::ios_base::out
00062 
00063 #else
00064 
00065 #define IOS_FMTFLAGS long
00066 #define IOS_SCIENTIFIC ios::scientific
00067 #define IOS_FLOATFIELD ios::floatfield
00068 #define IOS_FIXED ios::fixed
00069 #define IOS_APP ios::app
00070 #define IOS_OUT ios::out
00071 
00072 #ifdef FEI_IOS_FMTFLAGS
00073 #undef IOS_FMTFLAGS
00074 #define IOS_FMTFLAGS ios::fmtflags
00075 #endif
00076 
00077 #endif
00078 //endif for ifdef FEI_HAVE_STD_IOS_FMTFLAGS
00079 
00080 #endif
00081 //endif for ifndef _fei_iostream_hpp_
00082 
00083 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends
Generated on Wed Apr 13 10:08:23 2011 for FEI by  doxygen 1.6.3