FEI Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fei_iostream.hpp
Go to the documentation of this file.
1 /*--------------------------------------------------------------------*/
2 /* Copyright 2005 Sandia Corporation. */
3 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
4 /* non-exclusive license for use of this work by or on behalf */
5 /* of the U.S. Government. Export of this program may require */
6 /* a license from the United States Government. */
7 /*--------------------------------------------------------------------*/
8 
9 #ifndef _fei_iostream_hpp_
10 #define _fei_iostream_hpp_
11 
12 #include "fei_macros.hpp"
13 
14 //
15 //The stuff in this file somewhat protects us from the fact that some
16 //platforms may not put stream-related stuff in the std namespace,
17 //even though most do.
18 //These days (2007) perhaps all platforms do put everything in std and
19 //perhaps no platforms still have iostream.h without having <iostream>, etc.
20 //But historically we've had to account for these possibilities and I see
21 //little to be gained from removing this flexibility at this point.
22 //
23 //The basic mechanism here is to use macros that are defined differently
24 //for certain situations. An alternative approach would be to import
25 //symbols into our namespace, but we choose not to do that since it is
26 //a well-known sin to perform namespace pollution from within a header.
27 //
28 
29 #ifdef FEI_HAVE_IOSTREAM
30 #include <iostream>
31 #define FEI_OSTREAM std::ostream
32 #define FEI_ISTREAM std::istream
33 #define FEI_COUT std::cout
34 #define FEI_ENDL std::endl
35 #elif defined(FEI_HAVE_IOSTREAM_H)
36 #include <iostream.h>
37 #define FEI_OSTREAM ostream
38 #define FEI_ISTREAM istream
39 #define FEI_COUT cout
40 #define FEI_ENDL endl
41 #else
42 #error "must have <iostream> or <iostream.h>"
43 #endif
44 //endif for ifdef FEI_HAVE_IOSTREAM
45 
46 #ifdef FEI_HAVE_IOMANIP
47 #include <iomanip>
48 #elif defined (FEI_HAVE_IOMANIP_H)
49 #include <iomanip.h>
50 #endif
51 
52 #ifdef FEI_HAVE_STD_IOS_FMTFLAGS
53 
54 #define IOS_FMTFLAGS std::ios_base::fmtflags
55 #define IOS_SCIENTIFIC std::ios_base::scientific
56 #define IOS_FLOATFIELD std::ios_base::floatfield
57 #define IOS_FIXED std::ios_base::fixed
58 #define IOS_APP std::ios_base::app
59 #define IOS_OUT std::ios_base::out
60 
61 #else
62 
63 #define IOS_FMTFLAGS long
64 #define IOS_SCIENTIFIC ios::scientific
65 #define IOS_FLOATFIELD ios::floatfield
66 #define IOS_FIXED ios::fixed
67 #define IOS_APP ios::app
68 #define IOS_OUT ios::out
69 
70 #ifdef FEI_IOS_FMTFLAGS
71 #undef IOS_FMTFLAGS
72 #define IOS_FMTFLAGS ios::fmtflags
73 #endif
74 
75 #endif
76 //endif for ifdef FEI_HAVE_STD_IOS_FMTFLAGS
77 
78 #include <fei_console_ostream.hpp>
79 #endif
80 //endif for ifndef _fei_iostream_hpp_
81 
82