Jpp  17.3.0-rc.2
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 55 of file JAutoMap.cc.

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