19{
22
23 string command;
24 bool use_cin;
25 bool revert;
26
27 try {
28
29 JParser<> zap(
"Example for testing inter-process communication.");
30
34
35 zap(argc, argv);
36 }
37 catch(const exception &error) {
38 FATAL(error.what() << endl);
39 }
40
41
42 try {
43
45
46 if (!use_cin) {
47
48 istream in(process.getInputStreamBuffer());
49
50 for (
string buffer;
getline(in, buffer); ) {
51 cout << buffer << endl;
52 }
53
54 } else {
55
56 ostream out(process.getOutputStreamBuffer());
57 istream in (process.getInputStreamBuffer());
58
59 for (
string buffer;
getline(cin, buffer) && buffer !=
""; ) {
60
61 out << buffer << endl;
62
64
65 if (revert) {
66 reverse(buffer.begin(), buffer.end());
67 }
68
69 cout << buffer << endl;
70 }
71 }
72 }
74 cerr << error.
what() << endl;
75 }
76}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
virtual const char * what() const override
Get error message.
Utility class to parse command line options.
Streaming of input and output from Linux command.
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).