Sierra Toolkit Version of the Day
WriterExt.cpp
00001 /*------------------------------------------------------------------------*/
00002 /*                 Copyright 2010 Sandia Corporation.                     */
00003 /*  Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive   */
00004 /*  license for use of this work by or on behalf of the U.S. Government.  */
00005 /*  Export of this program may require a license from the                 */
00006 /*  United States Government.                                             */
00007 /*------------------------------------------------------------------------*/
00008 
00009 #include <cstdlib>
00010 #include <cstring>
00011 #include <string>
00012 #include <iomanip>
00013 #include <sstream>
00014 #include <fstream>
00015 #include <list>
00016 
00017 #include <stk_util/diag/WriterExt.hpp>
00018 #include <stk_util/diag/Writer.hpp>
00019 #include <stk_util/environment/Demangle.hpp>
00020 #include <stk_util/diag/Trace.hpp>
00021 #include <stk_util/diag/Option.hpp>
00022 #include <stk_util/diag/String.hpp>
00023 #include <stk_util/diag/StringUtil.hpp>
00024 #include <stk_util/util/Null_Streambuf.hpp>
00025 
00026 
00027 namespace stk {
00028 namespace diag {
00029 
00030 Writer &
00031 operator<<(
00032   Writer &                      dout,
00033   const std::type_info &        t)
00034 {
00035   if (dout.shouldPrint())
00036     dout << stk::demangle(t.name());
00037   return dout;
00038 }
00039 
00040 
00041 Writer &
00042 operator<<(
00043   Writer &                      dout,
00044   const sierra::String &        s)
00045 {
00046   if (dout.shouldPrint()) 
00047     dout << s.c_str();
00048   return dout;
00049 }
00050 
00051 
00052 Writer &
00053 operator<<(
00054   Writer &                      dout,
00055   const sierra::Identifier &    s)
00056 {
00057   if (dout.shouldPrint())
00058     dout << s.c_str();
00059   return dout;
00060 }
00061 
00062 
00063 #if defined( STK_HAS_MPI )
00064 Writer &
00065 operator<<(
00066   Writer &        dout,
00067   const sierra::MPI::Loc<int> &      loc) 
00068 {
00069   if (dout.shouldPrint()) 
00070     dout << loc.m_value << "@" << loc.m_loc;
00071   return dout;
00072 }
00073 
00074 
00075 Writer &
00076 operator<<(
00077   Writer &        dout,
00078   const sierra::MPI::Loc<double> &   loc)
00079 {
00080   if (dout.shouldPrint())
00081     dout << loc.m_value << "@" << loc.m_loc;
00082   return dout;
00083 }
00084 
00085 
00086 Writer &
00087 operator<<(
00088   Writer &        dout,
00089   const sierra::MPI::Loc<float> &    loc)
00090 {
00091   if (dout.shouldPrint())
00092     dout << loc.m_value << "@" << loc.m_loc;
00093   return dout;
00094 }
00095 
00096   
00097 Writer &
00098 operator<<(
00099   Writer &        dout,
00100   const sierra::MPI::TempLoc &   loc)
00101 {
00102   if (dout.shouldPrint())
00103     dout << loc.m_value << " " << loc.m_other << "@" << loc.m_loc;
00104   return dout;
00105 }
00106 
00107 #endif // if defined( STK_HAS_MPI )
00108 
00109 } // namespace diag
00110 } // namespace stk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines