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

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

#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <algorithm>
#include "JLang/JComparable.hh"
#include "JLang/JMultiComparable.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::JComparible class.

Author
mdejong

Definition in file JMultiComparable.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 101 of file JMultiComparable.cc.

102 {
103  using namespace std;
104  using namespace JPP;
105 
106  typedef vector<__C__> buffer_type;
107 
108  buffer_type buffer;
109  int debug;
110 
111  try {
112 
113  JParser<> zap("Example program to test hierarchical comparisons of objects.");
114 
115  zap['i'] = make_field(buffer);
116  zap['d'] = make_field(debug) = 0;
117 
118  zap(argc, argv);
119  }
120  catch(const exception &error) {
121  FATAL(error.what() << endl);
122  }
123 
124  DEBUG("before:" << endl);
125  for (buffer_type::const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
126  DEBUG(*i << endl);
127  }
128 
129  sort(buffer.begin(), buffer.end());
130 
131  DEBUG("after:" << endl);
132  for (buffer_type::const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
133  DEBUG(*i << endl);
134  }
135 
136  ASSERT(buffer.size() > 1);
137 
138  for (buffer_type::const_iterator q = buffer.begin(), p = q++; q != buffer.end(); ++p, ++q) {
139  ASSERT((static_cast<const __A__&>(*p) < static_cast<const __A__&>(*q)) ||
140  (static_cast<const __A__&>(*p) == static_cast<const __A__&>(*q) &&
141  static_cast<const __B__&>(*p) < static_cast<const __B__&>(*q)));
142  }
143 }
Utility class to parse command line options.
Definition: JParser.hh:1500
#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
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG