Jpp
 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 106 of file JEditTripod.cc.

107 {
108  using namespace std;
109  using namespace JPP;
110 
111  typedef JContainer< vector<JTripod> > tripods_container;
112 
113  string tripodFile;
114  vector<JModifier> mod;
115  int debug;
116 
117  try {
118 
119  JParser<> zap("Auxiliary program to modify tripod configuration.");
120 
121  zap['f'] = make_field(tripodFile, "tripod file");
122  zap['T'] = make_field(mod, "tripod modifier") = JPARSER::initialised();
123  zap['d'] = make_field(debug) = 1;
124 
125  zap(argc, argv);
126  }
127  catch(const exception &error) {
128  FATAL(error.what() << endl);
129  }
130 
131  tripods_container tripods;
132 
133  tripods.load(tripodFile.c_str());
134 
135  tripods.comment.add(JMeta(argc, argv));
136 
137  for (vector<JModifier>::const_iterator i = mod.begin(); i != mod.end(); ++i) {
138 
139  for (tripods_container::iterator tripod = tripods.begin(); tripod != tripods.end(); ++tripod) {
140 
141  if (tripod->getID() == i->id) {
142 
143  DEBUG("Modifier" << ' '
144  << "(" << FILL(2,'0') << tripod->getID() << FILL() << ")" << ' '
145  << "action" << ' ' << i->pos << endl);
146 
147  if (!i->apply(*tripod)) {
148  ERROR("No valid action: " << *i << endl);
149  }
150  }
151  }
152  }
153 
154  tripods.store(tripodFile.c_str());
155 }
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
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:327
#define FATAL(A)
Definition: JMessage.hh:67
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62