Skip to content

Commit 64c2890

Browse files
committed
Remove PeriodicCall::addSpecificCommands
1 parent ab05904 commit 64c2890

File tree

3 files changed

+18
-65
lines changed

3 files changed

+18
-65
lines changed

include/sot/core/periodic-call.hh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ public:
7777
void clear(void) { signalMap.clear(); }
7878

7979
void display(std::ostream &os) const;
80-
void addSpecificCommands(dynamicgraph::Entity &ent,
81-
dynamicgraph::Entity::CommandMap_t &commap,
82-
const std::string &prefix = "");
8380
};
8481

8582
} // namespace sot

src/python-module.cc

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,24 @@ BOOST_PYTHON_MODULE(wrap)
1313

1414
using dgs::PeriodicCall;
1515
bp::class_<PeriodicCall, boost::noncopyable>("PeriodicCall", bp::no_init)
16-
.def("addSignal", static_cast<void (PeriodicCall::*)(const std::string &, dg::SignalBase<int> &)> (&PeriodicCall::addSignal))
17-
.def("addSignal", static_cast<void (PeriodicCall::*)(const std::string &)> (&PeriodicCall::addSignal))
18-
19-
.def("addDownsampledSignal", static_cast<void (PeriodicCall::*)(const std::string &, dg::SignalBase<int> &, const unsigned int &)> (&PeriodicCall::addDownsampledSignal))
20-
.def("addDownsampledSignal", static_cast<void (PeriodicCall::*)(const std::string &, const unsigned int &)> (&PeriodicCall::addDownsampledSignal))
21-
22-
.def("rmSignal", &PeriodicCall::rmSignal)
23-
.def("clear", &PeriodicCall::clear)
16+
.def("addSignal", static_cast<void (PeriodicCall::*)(const std::string &, dg::SignalBase<int> &)> (&PeriodicCall::addSignal),
17+
"Add the signal to the refresh list", (bp::arg("name"), "signal"))
18+
.def("addSignal", static_cast<void (PeriodicCall::*)(const std::string &)> (&PeriodicCall::addSignal),
19+
"Add the signal to the refresh list", (bp::arg("signal_name")))
20+
21+
.def("addDownsampledSignal", static_cast<void (PeriodicCall::*)(const std::string &, dg::SignalBase<int> &, const unsigned int &)> (&PeriodicCall::addDownsampledSignal),
22+
"Add the signal to the refresh list\n"
23+
"The downsampling factor: 1 means every time, "
24+
"2 means every other time, etc...",
25+
(bp::arg("name"), "signal", "factor"))
26+
.def("addDownsampledSignal", static_cast<void (PeriodicCall::*)(const std::string &, const unsigned int &)> (&PeriodicCall::addDownsampledSignal),
27+
"Add the signal to the refresh list\n"
28+
"The downsampling factor: 1 means every time, "
29+
"2 means every other time, etc...",
30+
(bp::arg("signal_name"), "factor"))
31+
32+
.def("rmSignal", &PeriodicCall::rmSignal, "Remove the signal to the refresh list", bp::arg("name"))
33+
.def("clear", &PeriodicCall::clear, "Clear all signals and commands from the refresh list.")
2434
.def("__str__", +[](const PeriodicCall& e) {
2535
std::ostringstream os;
2636
e.display(os);

src/tools/periodic-call.cpp

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -112,60 +112,6 @@ static std::string readLineStr( istringstream& args )
112112
return res;
113113
}
114114
*/
115-
#define ADD_COMMAND(name, def) \
116-
if (commandMap.count(prefix + name) != 0) { \
117-
DG_THROW ExceptionFactory(ExceptionFactory::OBJECT_CONFLICT, \
118-
"Command " + prefix + name + \
119-
" already registered in Entity."); \
120-
} \
121-
commandMap.insert(std::make_pair(prefix + name, def))
122-
123-
void PeriodicCall::addSpecificCommands(Entity &ent,
124-
Entity::CommandMap_t &commandMap,
125-
const std::string &prefix) {
126-
using namespace dynamicgraph::command;
127-
128-
/* Explicit typage to help the compiler. */
129-
boost::function<void(const std::string &)>
130-
addSignal = boost::bind(&PeriodicCall::addSignal, this, _1),
131-
rmSignal = boost::bind(&PeriodicCall::rmSignal, this, _1);
132-
boost::function<void(const std::string &, const unsigned int &)>
133-
addDownsampledSignal =
134-
boost::bind(&PeriodicCall::addDownsampledSignal, this, _1, _2);
135-
boost::function<void(void)> clear = boost::bind(&PeriodicCall::clear, this);
136-
boost::function<void(std::ostream &)> disp =
137-
boost::bind(&PeriodicCall::display, this, _1);
138-
139-
ADD_COMMAND(
140-
"addSignal",
141-
makeCommandVoid1(ent, addSignal,
142-
docCommandVoid1("Add the signal to the refresh list",
143-
"string (sig name)")));
144-
ADD_COMMAND("addDownsampledSignal",
145-
makeCommandVoid2(
146-
ent, addDownsampledSignal,
147-
docCommandVoid2(
148-
"Add the signal to the refresh list", "string (sig name)",
149-
"unsigned int (downsampling factor, 1 means every time, "
150-
"2 means every other time, etc...")));
151-
ADD_COMMAND(
152-
"rmSignal",
153-
makeCommandVoid1(ent, rmSignal,
154-
docCommandVoid1("Remove the signal to the refresh list",
155-
"string (sig name)")));
156-
ADD_COMMAND(
157-
"clear",
158-
makeCommandVoid0(
159-
ent, clear,
160-
docCommandVoid0(
161-
"Clear all signals and commands from the refresh list.")));
162-
163-
ADD_COMMAND("disp",
164-
makeCommandVerbose(
165-
ent, disp,
166-
docCommandVerbose(
167-
"Print the list of to-refresh signals and commands.")));
168-
}
169115

170116
/*
171117
* Local variables:

0 commit comments

Comments
 (0)