Example program to test JLANG::JRedirectStream class.
More...
#include <string>
#include <iostream>
#include <sstream>
#include <iomanip>
#include "JLang/JRedirectStream.hh"
#include "JLang/JNullStream.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
Go to the source code of this file.
|
int | main (int argc, char **argv) |
|
Example program to test JLANG::JRedirectStream class.
- Author
- mdejong
Definition in file JRedirectStream.cc.
◆ main()
int main |
( |
int | argc, |
|
|
char ** | argv ) |
Definition at line 20 of file JRedirectStream.cc.
21{
23
25
26 try {
27
28 JParser<> zap(
"Example program to test redirection of I/O streams.");
29
31
32 zap(argc, argv);
33 }
34 catch(const exception &error) {
35 FATAL(error.what() << endl);
36 }
37
38
40
41 string message = "hello world";
42
44
45 ostringstream os;
46
47 {
48 NOTICE(
"The message <" << message <<
"> is re-directed to <null> if debug < " <<
JEEP::debug_t << endl);
49
51
52 cout << message << flush;
53 }
54
55 NOTICE(
"result <" << os.str() <<
">" << endl);
56
58
59 istringstream is;
60
61 {
62 NOTICE(
"The following input message is re-directed to <null> if debug < " <<
JEEP::debug_t << endl);
63
65
67
68 DEBUG(
"message <" << message <<
">" << endl);
69 }
70
71 NOTICE(
"result <" << is.str() <<
">" << endl);
72
74
75 return 0;
76}
#define DEBUG(A)
Message macros.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
This class can be used to temporarily redirect one output (input) stream to another output (input) st...
Utility class to parse command line options.
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).