00001 #ifndef FIELDWRITER_H 00002 #define FIELDWRITER_H 00003 00004 #include "SundanceDefs.h" 00005 #include "FieldWriterBase.h" 00006 #include "TSFSmartPtr.h" 00007 00008 namespace Sundance 00009 { 00010 using std::string; 00011 using std::ostream; 00012 00013 /** */ 00014 class FieldWriter 00015 { 00016 public: 00017 FieldWriter() : ptr_(0) {;} 00018 00019 FieldWriter(FieldWriterBase* ptr) : ptr_(ptr) {;} 00020 00021 void writeField(const string& name, const Expr& expr) const ; 00022 00023 void writeField(const Expr& expr) const 00024 { 00025 writeField(expr.name(), expr); 00026 } 00027 00028 void writeMesh(const Mesh& mesh) const 00029 { 00030 ptr_->writeMesh(mesh); 00031 } 00032 00033 void writeCommentLine(const string& line) const 00034 { 00035 ptr_->writeCommentLine(line); 00036 } 00037 00038 private: 00039 TSFSmartPtr<FieldWriterBase> ptr_; 00040 }; 00041 } 00042 00043 #endif