Sierra Toolkit  Version of the Day
WriterExt.cpp
1 /*------------------------------------------------------------------------*/
2 /* Copyright 2010 Sandia Corporation. */
3 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */
4 /* license for use of this work by or on behalf of the U.S. Government. */
5 /* Export of this program may require a license from the */
6 /* United States Government. */
7 /*------------------------------------------------------------------------*/
8 
9 #include <cstdlib>
10 #include <cstring>
11 #include <string>
12 #include <iomanip>
13 #include <sstream>
14 #include <fstream>
15 #include <list>
16 
17 #include <stk_util/diag/WriterExt.hpp>
18 #include <stk_util/diag/Writer.hpp>
19 #include <stk_util/environment/Demangle.hpp>
20 #include <stk_util/diag/Trace.hpp>
21 #include <stk_util/diag/Option.hpp>
22 #include <stk_util/diag/String.hpp>
23 #include <stk_util/diag/StringUtil.hpp>
24 #include <stk_util/util/Null_Streambuf.hpp>
25 
26 
27 namespace stk_classic {
28 namespace diag {
29 
30 Writer &
31 operator<<(
32  Writer & dout,
33  const std::type_info & t)
34 {
35  if (dout.shouldPrint())
36  dout << stk_classic::demangle(t.name());
37  return dout;
38 }
39 
40 
41 Writer &
42 operator<<(
43  Writer & dout,
44  const sierra::String & s)
45 {
46  if (dout.shouldPrint())
47  dout << s.c_str();
48  return dout;
49 }
50 
51 
52 Writer &
53 operator<<(
54  Writer & dout,
55  const sierra::Identifier & s)
56 {
57  if (dout.shouldPrint())
58  dout << s.c_str();
59  return dout;
60 }
61 
62 
63 #if defined( STK_HAS_MPI )
64 Writer &
65 operator<<(
66  Writer & dout,
67  const sierra::MPI::Loc<int> & loc)
68 {
69  if (dout.shouldPrint())
70  dout << loc.m_value << "@" << loc.m_loc;
71  return dout;
72 }
73 
74 
75 Writer &
76 operator<<(
77  Writer & dout,
78  const sierra::MPI::Loc<double> & loc)
79 {
80  if (dout.shouldPrint())
81  dout << loc.m_value << "@" << loc.m_loc;
82  return dout;
83 }
84 
85 
86 Writer &
87 operator<<(
88  Writer & dout,
89  const sierra::MPI::Loc<float> & loc)
90 {
91  if (dout.shouldPrint())
92  dout << loc.m_value << "@" << loc.m_loc;
93  return dout;
94 }
95 
96 
97 Writer &
98 operator<<(
99  Writer & dout,
100  const sierra::MPI::TempLoc & loc)
101 {
102  if (dout.shouldPrint())
103  dout << loc.m_value << " " << loc.m_other << "@" << loc.m_loc;
104  return dout;
105 }
106 
107 #endif // if defined( STK_HAS_MPI )
108 
109 } // namespace diag
110 } // namespace stk_classic
Sierra Toolkit.
Class Writer implements a runtime selectable diagnostic output writer to aid in the development and d...
Definition: Writer.hpp:49
const char * demangle(const char *symbol)
Function demangle returns the demangled C++ symbol from the mangled C++ symbol. The mangled named is ...
Definition: Demangle.cpp:103
Template class loc implements the data structure for the MINLOC and MAXLOC data types.
Definition: MPI.hpp:105