19 static const std::string set_t =
"set";
20 static const std::string add_t =
"add";
21 static const std::string sub_t =
"sub";
22 static const std::string rot_t =
"rot";
46 switch (data.size()) {
49 return apply(hydrophone, action, data[0]);
52 return apply(hydrophone, action,
JVector3D(data[0], data[1], data[2]));
67 friend inline std::istream&
operator>>(std::istream&
in, JModifier& modifier)
71 if (in >> modifier.id >> modifier.action) {
73 modifier.data.clear();
75 for (
double x; in >> x; ) {
76 modifier.data.push_back(x);
79 in.clear(ios_base::eofbit);
93 friend inline std::ostream&
operator<<(std::ostream& out,
const JModifier& modifier)
97 out << modifier.action;
121 static bool apply(
JHydrophone& hydrophone,
const std::string& action,
const double value)
144 else if (action == add_t)
146 else if (action == sub_t)
173 int main(
int argc,
char **argv)
180 string hydrophoneFile;
186 JParser<> zap(
"Auxiliary program to modify hydrophone configuration.");
188 zap[
'f'] =
make_field(hydrophoneFile,
"hydrophone file");
194 catch(
const exception &error) {
195 FATAL(error.what() << endl);
198 hydrophones_container hydrophones;
200 hydrophones.load(hydrophoneFile.c_str());
202 hydrophones.comment.add(
JMeta(argc, argv));
206 for (hydrophones_container::iterator hydrophone = hydrophones.begin(); hydrophone != hydrophones.end(); ++hydrophone) {
210 DEBUG(
"Modifier" <<
' '
212 <<
"action" <<
' ' << i->action <<
JEEPZ() << i->data << endl);
214 if (!i->apply(*hydrophone)) {
215 ERROR(
"No valid action: " << *i << endl);
221 hydrophones.store(hydrophoneFile.c_str());
Utility class to parse command line options.
int getFloor() const
Get floor number.
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.
int getString() const
Get string number.
std::istream & operator>>(std::istream &in, JAANET::JHead &header)
Read header from input.
Utility class to parse command line options.
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 source JAcoustics sh $DETECTOR_ID typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
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.
int main(int argc, char *argv[])