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

Auxiliary program to modify tripod configuration. More...

#include <iostream>
#include <iomanip>
#include <vector>
#include "JDetector/JTripod.hh"
#include "JSupport/JMeta.hh"
#include "Jeep/JContainer.hh"
#include "Jeep/JPrint.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

Auxiliary program to modify tripod configuration.

Syntax:

    -T "<tripod identifier>     (set|add|sub) east north z"
Author
mdejong

Definition in file JEditTripod.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 98 of file JEditTripod.cc.

99 {
100  using namespace std;
101  using namespace JPP;
102 
103  typedef JContainer< vector<JTripod> > container_type;
104 
105  string file_name;
106  vector<JModifier> mod;
107  int debug;
108 
109  try {
110 
111  JParser<> zap("Auxiliary program to modify tripod configuration.");
112 
113  zap['f'] = make_field(file_name, "tripod file");
114  zap['T'] = make_field(mod, "tripod modifier") = JPARSER::initialised();
115  zap['d'] = make_field(debug) = 1;
116 
117  zap(argc, argv);
118  }
119  catch(const exception &error) {
120  FATAL(error.what() << endl);
121  }
122 
123  container_type data;
124 
125  data.load(file_name.c_str());
126 
127  data.comment.add(JMeta(argc, argv));
128 
129  for (vector<JModifier>::const_iterator i = mod.begin(); i != mod.end(); ++i) {
130 
131  for (container_type::iterator target = data.begin(); target != data.end(); ++target) {
132 
133  if (target->getID() == i->id) {
134 
135  DEBUG("Modifier" << ' '
136  << "(" << FILL(2,'0') << target->getID() << FILL() << ")" << ' '
137  << "action" << ' ' << i->pos << endl);
138 
139  if (!i->apply(*target)) {
140  ERROR("No valid action: " << *i << endl);
141  }
142  }
143  }
144  }
145 
146  data.store(file_name.c_str());
147 }
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:70
Utility class to parse command line options.
Definition: JParser.hh:1500
Target.
Definition: JHead.hh:268
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:66
Auxiliary wrapper for I/O of container with optional comment (see JComment).
Definition: JContainer.hh:39
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
#define ERROR(A)
Definition: JMessage.hh:66
int debug
debug level
Definition: JSirene.cc:63
Auxiliary data structure for sequence of same character.
Definition: JManip.hh:328
#define FATAL(A)
Definition: JMessage.hh:67
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62