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

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

#include <iostream>
#include <iomanip>
#include <string>
#include "JTools/JAutoMap.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Namespaces

 JTOOLS
 Auxiliary classes and methods for multi-dimensional interpolations and histograms.
 

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to test JTOOLS::JAutoMap class.

Author
mdejong

Definition in file JAutoMap.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 56 of file JAutoMap.cc.

57 {
58  using namespace std;
59 
60  int debug;
61 
62  try {
63 
64  JParser<> zap("Example program to test automatic generation of map based on data types.");
65 
66  zap['d'] = make_field(debug) = 0;
67 
68  zap(argc, argv);
69  }
70  catch(const exception &error) {
71  FATAL(error.what() << endl);
72  }
73 
74 
75  using namespace JPP;
76 
77  typedef
78  JTypeList<int,
79  JTypeList<char,
80  JTypeList<double,
81  JTypeList<float> > > > JDataTypes_t;
82 
83  {
84  JAutoMap_t zmap;
85 
86  zmap.insert<JDataTypes_t>();
87 
88  cout << "First method" << endl;
89 
90  for (JAutoMap_t::const_iterator i = zmap.begin(); i != zmap.end(); ++i) {
91  cout << setw(2) << i->first << ' ' << i->second << endl;
92  }
93  }
94 
95  {
96  JAutoMap_t zmap;
97 
98  zmap.insert<JDataTypes_t>(JAutomate<JElement_t>());
99 
100  cout << "Second method" << endl;
101 
102  for (JAutoMap_t::const_iterator i = zmap.begin(); i != zmap.end(); ++i) {
103  cout << setw(2) << i->first << ' ' << i->second << endl;
104  }
105  }
106 }
Utility class to parse command line options.
Definition: JParser.hh:1500
Auxiliary class for automatic element creation.
Definition: JAutoMap.hh:46
Type list.
Definition: JTypeList.hh:22
#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