Jpp
Functions
JPipe.cc File Reference
#include <string>
#include <iostream>
#include <iomanip>
#include <vector>
#include "JLang/JSTDObjectReader.hh"
#include "JLang/JSTDObjectWriter.hh"
#include "JLang/JStreamObjectOutput.hh"
#include "JLang/JObjectSelector.hh"
#include "JLang/JPipe.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to test JLANG::JPipe class.

Author
mdejong

Definition in file JPipe.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 66 of file JPipe.cc.

67 {
68  using namespace std;
69 
70  int mod;
71  int debug;
72 
73  try {
74 
75  JParser<> zap("Example program to test object iteration using pipe.");
76 
77  zap['M'] = make_field(mod) = 2;
78  zap['d'] = make_field(debug) = 3;
79 
80  zap(argc, argv);
81  }
82  catch(const exception &error) {
83  FATAL(error.what() << endl);
84  }
85 
86 
87  using namespace JPP;
88 
89  typedef vector<int> buffer_type;
90 
91  buffer_type buffer;
92 
93  for (int i = 0; i != 20; ++i) {
94  buffer.push_back(i);
95  }
96 
97  JSTDObjectReader<int> in(buffer);
98 
99  if (debug >= debug_t) {
100 
101  JStreamObjectOutput<int> out(cout, "\n");
102 
103  in | JModulo(mod) | out;
104  }
105 
106  buffer_type data;
107 
108  JSTDObjectWriter<int> out(data);
109 
110  in.rewind();
111 
112  in | JModulo(mod) | out;
113 
114  ASSERT(!data.empty());
115 
116  for (buffer_type::const_iterator i = data.begin(); i != data.end(); ++i) {
117  ASSERT((*i)%mod == 0);
118  }
119 }
ASSERT
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
std::vector< int >
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JLANG::JStreamObjectOutput
Template implementation of stream output for single data type.
Definition: JStreamObjectOutput.hh:28
debug
int debug
debug level
Definition: JSirene.cc:59
JLANG::JSTDObjectReader
Implementation of object iteration from STD container.
Definition: JSTDObjectReader.hh:24
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
std
Definition: jaanetDictionary.h:36
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
JLANG::JSTDObjectWriter
Implementation of object output from STD container.
Definition: JSTDObjectWriter.hh:24
JEEP::debug_t
debug
Definition: JMessage.hh:29