Example program to test JIO::JByteArrayReader and JIO::JByteArrayWriter.
More...
#include <string>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <list>
#include "JIO/JByteArrayIO.hh"
#include "JIO/JSTDIO.hh"
#include "JLang/JObjectID.hh"
#include "Jeep/JStreamToolkit.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 JIO::JByteArrayReader and JIO::JByteArrayWriter.
- Author
- mdejong
Definition in file JByteArrayIO.cc.
◆ main()
int main |
( |
int | argc, |
|
|
char ** | argv ) |
Definition at line 24 of file JByteArrayIO.cc.
25{
28
30
31 try {
32
33 JParser<> zap(
"Example program to test byte array I/O.");
34
36
37 zap(argc, argv);
38 }
39 catch(const exception &error) {
40 FATAL(error.what() << endl);
41 }
42
43
44 int i1 = 999;
45 double x1 = 123.456;
46 string s1 = "hello world";
47 JObjectID o1 = 999;
48
50
51 for (
double x = 0.0;
x < 10.5;
x += 1.0) {
52 v1.push_back(x);
53 }
54
56
57 l1.push_back("hello");
58 l1.push_back("world");
59
61
62 m1[1] = 1;
63 m1[2] = 4;
64 m1[3] = 9;
65
67
68 out << i1 << x1 << s1 << v1 << l1 << m1 << o1;
69
70 DEBUG(
"Buffer size " << out.size() << endl);
71
73
74 int i2 = 0;
75 double x2 = 0.0;
76 string s2 = "";
77 JObjectID o2 = -1;
78
80
82
84
85 in >> i2 >> x2 >> s2 >> v2 >> l2 >> m2 >> o2;
86
94
95 return 0;
96}
#define DEBUG(A)
Message macros.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Byte array binary output.
Utility class to parse command line options.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).