Last change
on this file since 1572 was
300,
checked in by ymipsl, 13 years ago
|
nouvelle version de developpement de xios
- nouvelle interface fortran
- recodage complet de la couche de communication
- et bien d'autres choses...
YM
|
-
Property svn:eol-style set to
native
|
File size:
621 bytes
|
Line | |
---|
1 | #include <iostream> |
---|
2 | #include <sstream> |
---|
3 | #include <string> |
---|
4 | |
---|
5 | using namespace std ; |
---|
6 | |
---|
7 | |
---|
8 | class CLog : public ostream |
---|
9 | { |
---|
10 | public : |
---|
11 | CLog() : ostream(NULL),level(0) {} |
---|
12 | CLog& operator()(int l) {if (l<=level) rdbuf(cout.rdbuf()) ; else rdbuf(NULL) ; return *this;} |
---|
13 | void setLevel(int l) {level=l; } |
---|
14 | int level ; |
---|
15 | // ostringstream& getStream() { return *(ostringstream*)(this) ; } |
---|
16 | // ~CLog(void) { cout<<"info message "<< this->str();} |
---|
17 | }; |
---|
18 | |
---|
19 | |
---|
20 | int main(void) |
---|
21 | { |
---|
22 | CLog out ; |
---|
23 | cout<<string("toto")<<endl ; |
---|
24 | out<<"123"<<endl ; |
---|
25 | out.setLevel(5) ; |
---|
26 | out(7)<<"coucou 1"<<endl ; |
---|
27 | out(3)<<"coucou 2"<<endl<<"i23"<<endl ; |
---|
28 | |
---|
29 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.