20 static const std::string set_t =
"set";
21 static const std::string add_t =
"add";
22 static const std::string sub_t =
"sub";
23 static const std::string rot_t =
"rot";
37 switch (
data.size()) {
40 return apply(hydrophone, action,
data[0]);
58 friend inline std::istream&
operator>>(std::istream&
in, JModifier& modifier)
62 if (in >> modifier.id >> modifier.action) {
64 modifier.data.clear();
66 for (
double x; in >>
x; ) {
67 modifier.data.push_back(x);
70 in.clear(ios_base::eofbit);
84 friend inline std::ostream&
operator<<(std::ostream& out,
const JModifier& modifier)
88 out << modifier.action;
112 static bool apply(
JHydrophone& hydrophone,
const std::string& action,
const double value)
135 else if (action == add_t)
137 else if (action == sub_t)
171 int main(
int argc,
char **argv)
189 JParser<> zap(
"Auxiliary program to modify hydrophone configuration.");
191 zap[
'f'] =
make_field(inputFile,
"hydrophone input file") =
"";
197 zap[
'q'] =
make_field(squash,
"squash meta data");
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));
236 for (container_type::iterator
target = data.begin();
target != data.end(); ++
target) {
238 if (
target->getString() ==
i->id) {
240 DEBUG(
"Modifier" <<
' '
242 <<
"action" <<
' ' <<
i->action <<
JEEPZ() <<
i->data << endl);
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))
Utility class to parse command line options.
int main(int argc, char *argv[])
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Type definition of hydrophone.
Data structure for hydrophone.
JVector3D & sub(const JVector3D &vector)
Subtract vector.
I/O formatting auxiliaries.
Data structure for vector in three dimensions.
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 The output file must have the wildcard in the e g root fi 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.
JPosition3D & rotate(const JRotation3D &R)
Rotate.
JVector3D & add(const JVector3D &vector)
Add vector.
void setPosition(const JVector3D &pos)
Set position.
#define DEBUG(A)
Message macros.