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

Example program to test JEEP::JScale_t enumeration. More...

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

Go to the source code of this file.

Macros

#define PRINT(out, scale)
 

Functions

int main (int argc, char *argv[])
 

Detailed Description

Example program to test JEEP::JScale_t enumeration.

Author
mdejong

Definition in file JScale.cc.

Macro Definition Documentation

#define PRINT (   out,
  scale 
)
Value:
{\
out << setw(8) << left << #scale << ' ' \
<< scientific << setprecision(0) << getValue(scale) << ' ' \
<< getUnit(scale) \
<< endl; \
}
double getValue(const JScale_t scale)
Get numerical value corresponding to scale.
Definition: JScale.hh:47
const char * getUnit(const int scale)
Get textual unit corresponding to scale.
Definition: JScale.hh:59
void scale(vector< double > &v, double c)
scale vector content

Definition at line 13 of file JScale.cc.

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 26 of file JScale.cc.

27 {
28  using namespace std;
29 
30  char unit;
31  int debug;
32 
33  try {
34 
35  JParser<> zap;
36 
37  zap['U'] = make_field(unit) = ' ';
38  zap['d'] = make_field(debug) = 1;
39 
40  zap(argc, argv);
41  }
42  catch(const exception &error) {
43  FATAL(error.what() << endl);
44  }
45 
46 
47  using namespace JPP;
48 
49  cout << "unit [" << unit << "] " << scientific << setprecision(0) << getValue(getScale(unit)) << endl;
50 
51  PRINT(cout, femto_t);
52  PRINT(cout, pico_t);
53  PRINT(cout, nano_t);
54  PRINT(cout, micro_t);
55  PRINT(cout, milli_t);
56  PRINT(cout, unit_t);
57  PRINT(cout, kilo_t);
58  PRINT(cout, mega_t);
59  PRINT(cout, tera_t);
60  PRINT(cout, peta_t);
61  PRINT(cout, exa_t);
62 }
Utility class to parse command line options.
Definition: JParser.hh:1517
double getValue(const JScale_t scale)
Get numerical value corresponding to scale.
Definition: JScale.hh:47
exa
Definition: JScale.hh:37
micro
Definition: JScale.hh:29
#define PRINT(out, scale)
Definition: JScale.cc:13
JScale_t getScale(const char unit)
Get scale corresponding to textual unit.
Definition: JScale.hh:111
kilo
Definition: JScale.hh:32
milli
Definition: JScale.hh:30
peta
Definition: JScale.hh:36
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
femto
Definition: JScale.hh:26
#define FATAL(A)
Definition: JMessage.hh:67
mega
Definition: JScale.hh:33
nano
Definition: JScale.hh:28
pico
Definition: JScale.hh:27
unit
Definition: JScale.hh:31
tera
Definition: JScale.hh:35
int debug
debug level