more fix on Ec/Ev.
[gss-tcad.git] / src / include / log.h
blobda986e52b2904451bc6436e0af9650cca06a7d06
1 /*****************************************************************************/
2 /* 8888888 88888888 88888888 */
3 /* 8 8 8 */
4 /* 8 8 8 */
5 /* 8 88888888 88888888 */
6 /* 8 8888 8 8 */
7 /* 8 8 8 8 */
8 /* 888888 888888888 888888888 */
9 /* */
10 /* A Two-Dimensional General Purpose Semiconductor Simulator. */
11 /* */
12 /* GSS 0.4x */
13 /* Last update: Sep 5, 2006 */
14 /* */
15 /* Gong Ding */
16 /* gdiso@ustc.edu */
17 /* NINT, No.69 P.O.Box, Xi'an City, China */
18 /* */
19 /*****************************************************************************/
21 /* We need two streams for message output: screen and log file. */
22 /* Output Device Select */
24 #ifndef _log_h_
25 #define _log_h_
27 #include <iostream>
28 #include <fstream>
29 #include <sstream>
30 #include <string>
32 using namespace std;
34 extern char log_buf[128];
35 extern void GSS_LOG();
37 class GSS_LOG_STREAM
39 private:
40 stringstream str_buf; //the string buf for out stream.
41 ofstream log_file; //the file stream
42 public:
43 void GSS_LOG_BEGIN(char *logfile) { log_file.open(logfile,ofstream::out | ofstream::trunc); }
44 void GSS_LOG_END() { log_file.close(); }
45 stringstream & string_buf() { return str_buf;}
47 void record()
49 cout<<str_buf.str();
50 cout.flush();
51 log_file<<str_buf.str();
52 str_buf.str("");
55 GSS_LOG_STREAM()
57 str_buf.setf(ios::scientific);
61 extern GSS_LOG_STREAM gss_log;
63 #endif