Jpp  15.0.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JPipe.cc File Reference

Example program to test JLANG::JPipe class. More...

#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

int main ( int  argc,
char **  argv 
)

Definition at line 66 of file JPipe.cc.

67 {
68  using namespace std;
69  using namespace JPP;
70 
71  int mod;
72  int debug;
73 
74  try {
75 
76  JParser<> zap("Example program to test object iteration using pipe.");
77 
78  zap['M'] = make_field(mod) = 2;
79  zap['d'] = make_field(debug) = 3;
80 
81  zap(argc, argv);
82  }
83  catch(const exception &error) {
84  FATAL(error.what() << endl);
85  }
86 
87 
88  typedef vector<int> buffer_type;
89 
90  buffer_type buffer;
91 
92  for (int i = 0; i != 20; ++i) {
93  buffer.push_back(i);
94  }
95 
96  JSTDObjectReader<int> in(buffer);
97 
98  if (debug >= debug_t) {
99 
100  JStreamObjectOutput<int> out(cout, "\n");
101 
102  in | JModulo(mod) | out;
103  }
104 
105  buffer_type data;
106 
107  JSTDObjectWriter<int> out(data);
108 
109  in.rewind();
110 
111  in | JModulo(mod) | out;
112 
113  ASSERT(!data.empty());
114 
115  for (buffer_type::const_iterator i = data.begin(); i != data.end(); ++i) {
116  ASSERT((*i)%mod == 0);
117  }
118 
119  return 0;
120 }
Utility class to parse command line options.
Definition: JParser.hh:1500
debug
Definition: JMessage.hh:29
Implementation of object output from STD container.
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:63
#define FATAL(A)
Definition: JMessage.hh:67
Implementation of object iteration from STD container.
Template implementation of stream output for single data type.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:41