Jpp  debug
the software that should make you happy
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

◆ main()

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 }
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2158
Utility class to parse command line options.
Definition: JParser.hh:1714
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::vector< JHitW0 > buffer_type
hits
Definition: JPerth.cc:70
Definition: JSTDTypes.hh:14