Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JHashCollection.cc File Reference

Example program to test JTOOLS::JHashCollection class. More...

#include <iostream>
#include <iomanip>
#include <cmath>
#include "JTools/JHashCollection.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 JTOOLS::JHashCollection class.

Author
mdejong

Definition in file JHashCollection.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 52 of file JHashCollection.cc.

53 {
54  using namespace std;
55 
56  double precision;
57  int debug;
58 
59  try {
60 
61  JParser<> zap("Example program to test hash collection.");
62 
63  zap['e'] = make_field(precision) = 1.0e-3;
64  zap['d'] = make_field(debug) = 0;
65 
66  zap(argc, argv);
67  }
68  catch(const exception &error) {
69  FATAL(error.what() << endl);
70  }
71 
72 
73  using namespace JPP;
74 
75  typedef JHashCollection<double, get_value> hash_collection;
76 
77  hash_collection buffer(precision);
78 
79  for (double x = 2.0; x >= 1.0; x -= 0.1) {
80  buffer.insert(x);
81  }
82 
83  for (hash_collection::const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
84  cout << *i << endl;
85  }
86 }
Utility class to parse command line options.
Definition: JParser.hh:1410
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1836
int debug
debug level
Definition: JSirene.cc:59
#define FATAL(A)
Definition: JMessage.hh:65