Sierra Toolkit Version of the Day
DiagWriter.hpp
00001 #ifndef stk_mesh_DiagWriter_h
00002 #define stk_mesh_DiagWriter_h
00003 
00004 #ifdef STK_MESH_TRACE_ENABLED
00005 
00006 #include <stk_util/diag/Trace.hpp>
00007 #include <stk_util/diag/Writer.hpp>
00008 #include <stk_util/diag/WriterOStream.hpp>
00009 #include <stk_util/diag/WriterParser.hpp>
00010 
00011 #include <stk_mesh/base/DiagWriter_fwd.hpp>
00012 #include <stk_mesh/base/Part.hpp>
00013 
00014 // Note, this classes/functions in this header are for internal use only.
00015 // The API for tracing is defined in Trace.hpp
00016 
00017 namespace stk {
00018 namespace mesh {
00019 
00020 class Part;
00021 class Entity;
00022 union EntityKey;
00023 
00024 // Must be called before theDiagWriter/meshlog
00025 void initDiagWriter(std::ostream& stream);
00026 
00027 stk::diag::Writer &theDiagWriter();
00028 #define meshlog stk::mesh::theDiagWriter()
00029 
00030 class DiagWriterParser : public diag::WriterParser
00031 {
00032 public:
00033   DiagWriterParser();
00034 };
00035 
00036 DiagWriterParser &theDiagWriterParser();
00037 
00038 typedef diag::Tracespec Tracespec;
00039 typedef diag::Traceback Traceback;
00040 
00046 class Trace : public diag::Trace
00047 {
00048 public:
00049   explicit Trace(const char *message)
00050     : diag::Trace(meshlog, message)
00051   {}
00052 
00053   Trace(const char *message, int print_mask)
00054     : diag::Trace(meshlog, message, print_mask)
00055   {}
00056 
00057   Trace(const char *message, int print_mask, bool do_trace)
00058     : diag::Trace(meshlog, message, print_mask, do_trace)
00059   {}
00060 };
00061 
00062 // If Writer does not know how to output an object you want to trace, you
00063 // can address that here by defining an operator<< for that object. Note
00064 // that Writer handles vectors and pointers automatically.
00065 
00066 stk::diag::Writer& operator<<(stk::diag::Writer& writer, const Part& part);
00067 
00068 stk::diag::Writer& operator<<(stk::diag::Writer& writer, const Entity& entity);
00069 
00070 stk::diag::Writer& operator<<(stk::diag::Writer& writer, const EntityKey& key);
00071 
00072 stk::diag::Writer& operator<<(stk::diag::Writer& writer, const EntityProc& entity_proc);
00073 
00074 } // namespace mesh
00075 } // namespace stk
00076 
00077 #endif // STKMESH_TRACE_ENABLED
00078 
00079 #endif // stk_mesh_DiagWriter_h
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends