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";
36 switch (data.size()) {
39 return apply(transmitter, action, data[0]);
42 return apply(transmitter, action,
JVector3D(data[0], data[1], data[2]));
57 friend inline std::istream&
operator>>(std::istream&
in, JModifier& modifier)
61 if (in >> modifier.id >> modifier.action) {
63 modifier.data.clear();
65 for (
double x; in >>
x; ) {
66 modifier.data.push_back(x);
69 in.clear(ios_base::eofbit);
83 friend inline std::ostream&
operator<<(std::ostream& out,
const JModifier& modifier)
87 out << modifier.action;
111 static bool apply(
JTransmitter& transmitter,
const std::string& action,
const double value)
134 else if (action == add_t)
135 transmitter.
add(pos);
136 else if (action == sub_t)
137 transmitter.
sub(pos);
170 int main(
int argc,
char **argv)
186 JParser<> zap(
"Auxiliary program to modify transmitter configuration.");
188 zap[
'f'] =
make_field(file_name,
"transmitter file");
197 catch(
const exception &error) {
198 FATAL(error.what() << endl);
204 data.load(file_name.c_str());
206 catch(
const exception&) {}
209 data.comment.clear();
212 data.comment.add(
JMeta(argc, argv));
220 for (container_type::iterator
target = data.begin();
target != data.end(); ++
target) {
222 if (
target->getString() == i->id) {
224 DEBUG(
"Modifier" <<
' '
226 <<
"action" <<
' ' << i->action <<
JEEPZ() << i->data << endl);
229 ERROR(
"No valid action: " << *i << endl);
236 for (container_type::iterator
target = data.begin();
target != data.end(); ) {
237 if (
target->getString() == *i)
244 data.store(file_name.c_str());
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)...
JVector3D & sub(const JVector3D &vector)
Subtract vector.
I/O formatting auxiliaries.
Data structure for vector in three dimensions.
Data structure for transmitter.
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.
Utility class to parse command line options.
Type definition of transmitter.
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
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.