FEI Version of the Day
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_ENDL std::endl
00035 #elif defined(FEI_HAVE_IOSTREAM_H)
00036 #include <iostream.h>
00037 #define FEI_OSTREAM ostream
00038 #define FEI_ISTREAM istream
00039 #define FEI_COUT cout
00040 #define FEI_ENDL endl
00041 #else
00042 #error "must have <iostream> or <iostream.h>"
00043 #endif
00044 //endif for ifdef FEI_HAVE_IOSTREAM
00045 
00046 #ifdef FEI_HAVE_IOMANIP
00047 #include <iomanip>
00048 #elif defined (FEI_HAVE_IOMANIP_H)
00049 #include <iomanip.h>
00050 #endif
00051 
00052 #ifdef FEI_HAVE_STD_IOS_FMTFLAGS
00053 
00054 #define IOS_FMTFLAGS std::ios_base::fmtflags
00055 #define IOS_SCIENTIFIC std::ios_base::scientific
00056 #define IOS_FLOATFIELD std::ios_base::floatfield
00057 #define IOS_FIXED std::ios_base::fixed
00058 #define IOS_APP std::ios_base::app
00059 #define IOS_OUT std::ios_base::out
00060 
00061 #else
00062 
00063 #define IOS_FMTFLAGS long
00064 #define IOS_SCIENTIFIC ios::scientific
00065 #define IOS_FLOATFIELD ios::floatfield
00066 #define IOS_FIXED ios::fixed
00067 #define IOS_APP ios::app
00068 #define IOS_OUT ios::out
00069 
00070 #ifdef FEI_IOS_FMTFLAGS
00071 #undef IOS_FMTFLAGS
00072 #define IOS_FMTFLAGS ios::fmtflags
00073 #endif
00074 
00075 #endif
00076 //endif for ifdef FEI_HAVE_STD_IOS_FMTFLAGS
00077 
00078 #include <fei_console_ostream.hpp>
00079 #endif
00080 //endif for ifndef _fei_iostream_hpp_
00081 
00082 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends