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, sigtime_t> &sig1 = dynamic_cast<Signal<Flags, sigtime_t> &>(
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 }
dynamicgraph::Signal
factory.hh
dynamicgraph
dynamicgraph::Signal::accessCopy
virtual const T & accessCopy() const
dgDEBUG
#define dgDEBUG(level)
additional-functions.hh
debug.hh
dynamicgraph::ExceptionAbstract
DG_THROW
#define DG_THROW
dynamicgraph::ExceptionFactory
flags.hh
err
err
dynamicgraph::sot
dynamicgraph::sot::Flags
Definition: flags.hh:33


sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Tue Oct 24 2023 02:26:31