43 static const std::string randset_t = rand_t + set_t;
44 static const std::string randadd_t = rand_t + add_t;
45 static const std::string randsub_t = rand_t + sub_t;
65 return (action !=
"" && !
data.empty());
74 bool apply(
JTripod& tripod)
const
76 switch (
data.size()) {
79 return apply(tripod, action,
data[0]);
100 if (action == setx_t)
102 else if (action == addx_t)
104 else if (action == subx_t)
106 else if (action == sety_t)
108 else if (action == addy_t)
110 else if (action == suby_t)
112 else if (action == setz_t)
114 else if (action == addz_t)
116 else if (action == subz_t)
137 gRandom->Gaus(0.0, pos.
getUTMZ()));
141 else if (action == add_t)
143 else if (action == sub_t)
145 else if (action == randset_t)
147 else if (action == randadd_t)
149 else if (action == randsub_t)
165 friend inline std::istream&
operator>>(std::istream&
in, JModifier& modifier)
167 if (in >> modifier.id >> modifier.action) {
169 modifier.data.clear();
171 for (
double x; in >>
x; ) {
172 modifier.data.push_back(x);
175 in.clear(std::ios_base::eofbit);
189 friend inline std::ostream&
operator<<(std::ostream& out,
const JModifier& modifier)
193 out << modifier.action;
232 int main(
int argc,
char **argv)
250 JParser<> zap(
"Auxiliary program to modify tripod configuration.");
252 zap[
'f'] =
make_field(inputFile,
"tripod input file");
258 zap[
'q'] =
make_field(squash,
"squash meta data");
263 catch(
const exception &error) {
264 FATAL(error.what() << endl);
270 if (!
rm.empty() && !keep.empty()) {
271 FATAL(
"Use either option -K or -D." << endl);
277 tripods.load(inputFile.c_str());
279 catch(
const exception&) {}
297 DEBUG(
"Modifier" <<
' '
299 <<
i->action <<
' ' <<
JEEPZ() <<
i->data << endl);
302 ERROR(
"No valid action: " << *
i << endl);
319 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.
bool is_valid(const json &js)
Check validity of JSon data.
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.
static const char WILDCARD
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
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.
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
Utility class to parse command line options.
Data structure for tripod.
JUTMPosition & add(const JUTMPosition &pos)
Add UTM position.
Data structure for tripod.
#define DEBUG(A)
Message macros.