Changeset 1642 for XIOS/dev/branch_openmp/src/log.hpp
- Timestamp:
- 01/23/19 10:31:44 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/src/log.hpp
r1342 r1642 5 5 #include <iostream> 6 6 #include <string> 7 #include <stdio.h>8 #include <omp.h>9 7 10 8 namespace xios … … 16 14 public : 17 15 CLog(const string& name_, std::streambuf* sBuff = cout.rdbuf()) 18 : ostream(sBuff), level(0), name(name_), strBuf_(sBuff) 16 : ostream(sBuff), level(0), name(name_), strBuf_(sBuff) {} 17 CLog& operator()(int l) 19 18 { 20 omp_init_lock( &mutex ); 21 for(int i=0; i<16; i++) 22 strBuf_array[i] = sBuff; 19 if (l<=level) 20 { 21 rdbuf(strBuf_); 22 *this<<"-> "<<name<<" : " ; 23 } 24 else rdbuf(NULL) ; 25 return *this; 23 26 } 24 25 ~CLog()26 {27 omp_destroy_lock( &mutex );28 }29 30 CLog& operator()(int l);31 27 void setLevel(int l) {level=l; } 32 28 int getLevel() {return level ;} … … 50 46 * \param [in] pointer to new streambuf 51 47 */ 52 void changeStreamBuff(std::streambuf* sBuff) 53 { 54 strBuf_ = sBuff; 55 strBuf_array[omp_get_thread_num()] = sBuff; 56 rdbuf(sBuff); 57 } 48 void changeStreamBuff(std::streambuf* sBuff) { strBuf_ = sBuff; rdbuf(sBuff); } 58 49 59 50 int level ; 60 51 string name ; 61 52 std::streambuf* strBuf_; 62 std::streambuf* strBuf_array[16];63 omp_lock_t mutex;64 53 }; 65 54 … … 67 56 extern CLog report; 68 57 extern CLog error; 69 70 extern std::filebuf* info_FB[16];71 58 } 72 59 #endif
Note: See TracChangeset
for help on using the changeset viewer.