26 static const int WILDCARD = -1;
42 static const std::string randset_t = rand_t + set_t;
43 static const std::string randadd_t = rand_t + add_t;
44 static const std::string randsub_t = rand_t + sub_t;
64 return (action !=
"" && !data.empty());
73 bool apply(
JTripod& tripod)
const
75 switch (data.size()) {
78 return apply(tripod, action, data[0]);
81 return apply(tripod, action,
JUTMPosition(data[0], data[1], data[2]));
101 else if (action == addx_t)
103 else if (action == subx_t)
105 else if (action == sety_t)
107 else if (action == addy_t)
109 else if (action == suby_t)
111 else if (action == setz_t)
113 else if (action == addz_t)
115 else if (action == subz_t)
136 gRandom->Gaus(0.0, pos.
getUTMZ()));
140 else if (action == add_t)
142 else if (action == sub_t)
144 else if (action == randset_t)
146 else if (action == randadd_t)
148 else if (action == randsub_t)
164 friend inline std::istream&
operator>>(std::istream&
in, JModifier& modifier)
166 if (in >> modifier.id >> modifier.action) {
168 modifier.data.clear();
170 for (
double x; in >>
x; ) {
171 modifier.data.push_back(x);
174 in.clear(std::ios_base::eofbit);
188 friend inline std::ostream&
operator<<(std::ostream& out,
const JModifier& modifier)
192 out << modifier.action;
231 int main(
int argc,
char **argv)
249 JParser<> zap(
"Auxiliary program to modify tripod configuration.");
251 zap[
'f'] =
make_field(inputFile,
"tripod input file");
257 zap[
'q'] =
make_field(squash,
"squash meta data");
262 catch(
const exception &error) {
263 FATAL(error.what() << endl);
269 if (!
rm.empty() && !keep.empty()) {
270 FATAL(
"Use either option -K or -D." << endl);
276 tripods.load(inputFile.c_str());
278 catch(
const exception&) {}
294 if (
target->getID() == i->id || i->id == WILDCARD) {
296 DEBUG(
"Modifier" <<
' '
298 << i->action <<
' ' <<
JEEPZ() << i->data << endl);
301 ERROR(
"No valid action: " << *i << endl);
318 if (keep.count(
target->getID()) == 0)
Utility class to parse command line options.
int main(int argc, char *argv[])
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
JUTMPosition & sub(const JUTMPosition &pos)
Subtract UTM position.
double getUTMEast() const
Get UTM east.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
void setUTMPosition(const JUTMPosition &position)
Set UTM position.
Data structure for UTM position.
double getUTMZ() const
Get UTM Z.
I/O formatting auxiliaries.
double getUTMNorth() const
Get UTM north.
Auxiliary wrapper for I/O of container with optional comment (see JComment).
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
bool is_valid(const json &js)
Check validity of JSon data.
Auxiliary data structure for streaming of STL containers.
General purpose messaging.
Auxiliary data structure for sequence of same character.
std::istream & operator>>(std::istream &in, JAANET::JHead &header)
Read header from input.
Utility class to parse command line options.
Data structure for tripod.
JUTMPosition & add(const JUTMPosition &pos)
Add UTM position.
Data structure for tripod.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
#define DEBUG(A)
Message macros.