additional-functions.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2010,
3  * François Bleibel,
4  * Olivier Stasse,
5  *
6  * CNRS/AIST
7  *
8  */
9 
10 #include <dynamic-graph/signal.h>
11 
13 #include <sot/core/debug.hh>
14 #include <sot/core/factory.hh>
15 #include <sot/core/flags.hh>
16 using namespace std;
17 using namespace dynamicgraph::sot;
18 using namespace dynamicgraph;
19 
20 /* \brief Constructor. At creation, overloads (deregisters-then registers
21  * again) the 'new' function in the g_shell
22  */
23 AdditionalFunctions::AdditionalFunctions() {}
24 
25 AdditionalFunctions::~AdditionalFunctions() {}
26 
27 void AdditionalFunctions::cmdFlagSet(const std::string &cmdLine,
28  istringstream &cmdArg, std::ostream &os) {
29  if (cmdLine == "help") {
30  os << " - set <obj1.sig1(flag type)> {#&|}START:END"
31  << "\t\tSet or reset the flag value." << endl;
32  return;
33  }
34 
35  try {
36  Signal<Flags, int> &sig1 = dynamic_cast<Signal<Flags, int> &>(
37  PoolStorage::getInstance()->getSignal(cmdArg));
38 
39  dgDEBUG(25) << "set..." << endl;
40  Flags fl;
41  try {
42  fl = sig1.accessCopy();
43  } catch (...) {
44  }
45  cmdArg >> std::ws >> fl;
46  dgDEBUG(15) << "Fl=" << fl << std::endl;
47  sig1 = fl;
48 
49  } catch (ExceptionAbstract &err) {
50  throw;
51  } catch (...) {
52  DG_THROW ExceptionFactory(ExceptionFactory::SYNTAX_ERROR,
53  "setflag: sig should be of flag type. ",
54  "(while calling setflag).");
55  }
56 }
#define dgDEBUG(level)
#define DG_THROW
virtual const T & accessCopy() const
err


sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Wed Jun 21 2023 02:51:26