43 return apply(hydrophone, action, JVector3D(data[0], data[1], data[2]));
176 typedef JContainer< vector<JHydrophone> > container_type;
180 vector<JModifier> mod;
181 vector<JHydrophone> add;
189 JParser<> zap(
"Auxiliary program to modify hydrophone configuration.");
191 zap[
'f'] = make_field(inputFile,
"hydrophone input file") =
"";
192 zap[
'o'] = make_field(outputFile,
"hydrophone output file");
193 zap[
'S'] = make_field(mod,
"hydrophone modifier") = JPARSER::initialised();
194 zap[
'A'] = make_field(add,
"add hydrophone") = JPARSER::initialised();
195 zap[
'k'] = make_field(keep,
"keep hydrophone[s]") = JPARSER::initialised();
196 zap[
'r'] = make_field(rm,
"remove hydrophone[s]") = JPARSER::initialised();
197 zap[
'q'] = make_field(squash,
"squash meta data");
198 zap[
'd'] = make_field(debug,
"debug level") = 2;
202 catch(
const exception &error) {
203 FATAL(error.what() << endl);
206 const int ns = ((keep.empty() ? 0 : 1) +
207 (rm .empty() ? 0 : 1));
210 FATAL(
"Use either option -k or -r." << endl);
215 if (inputFile !=
"") {
217 data.load(inputFile.c_str());
219 catch(
const exception& error) {
225 data.comment.clear();
228 data.comment.add(JMeta(argc, argv));
230 for (vector<JHydrophone>::const_iterator i = add.begin(); i != add.end(); ++i) {
234 for (vector<JModifier>::const_iterator i = mod.begin(); i != mod.end(); ++i) {
236 for (container_type::iterator target = data.begin(); target != data.end(); ++target) {
238 if (target->getString() == i->id) {
240 DEBUG(
"Modifier" <<
' '
241 <<
"(" << FILL(4,
'0') << target->getString() <<
"," << FILL(2,
'0') << target->getFloor() << FILL() <<
")" <<
' '
242 <<
"action" <<
' ' << i->action << JEEPZ() << i->data << endl);
244 if (!i->apply(*target)) {
245 ERROR(
"No valid action: " << *i << endl);
251 for (container_type::iterator i = data.begin(); i != data.end(); ) {
253 if ((keep.empty() || keep.count(i->getString()) != 0) &&
254 (rm .empty() || rm .count(i->getString()) == 0))
260 data.store(outputFile.c_str());