Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • cberge/dynamic-graph
  • ostasse/dynamic-graph
  • gsaurel/dynamic-graph
  • stack-of-tasks/dynamic-graph
4 results
Show changes
Commits on Source (26)
Showing
with 338 additions and 287 deletions
---
ColumnLimit: 80
...
# pre-commit: details (Guilhem Saurel, 2022-04-14)
1c0f3cc1048a8b2a8206510a51a237b2f1e68a34
# pre-commit run -a (Guilhem Saurel, 2022-03-30)
0c1e6fb50735d4d6cc93e15d3bef202392d47c5b
# clang format defaults + pre-commit (Guilhem Saurel, 2022-03-30)
b6fc5d81e645a84fa8f4d656371adfb27c2b2b23
# [value] Clang format. (Olivier Stasse, 2022-01-09)
b852eef0d56de04ae91a43b1ddbd837ec69ddbe6
# linters: fix clang-check-12 (Guilhem Saurel, 2021-09-14)
ca1b2fc51540b4fcb2cd0b4fccaa33b02738af41
# reformat for clang-format-12 (Guilhem Saurel, 2021-09-07)
ed5899076b7b11c16d9517295e3826dd9b9d80d2
# format (Guilhem Saurel, 2020-11-13)
c54add29f80f6bcd1d05ca741d472491cf74c180
# format (Guilhem Saurel, 2020-07-22)
f4def3bfeaf0f9c9a6d5c5eb01c3a3b2fbb04b2f
# clang format. (Olivier Stasse, 2020-02-03)
70864112c87365af645f0404f881edf36c1ec734
# [clang] Update format. (Olivier Stasse, 2019-08-26)
384b2078e4962d762db4293bf3396be17df4e5c7
# [clang-format] Comply to Google style. (Olivier Stasse, 2019-08-20)
df48199dd436ba8341ae93c7b1f87eb30d0f457a
_build* _build*
*~ .~
\ No newline at end of file compile_commands.json
[submodule "cmake"] [submodule "cmake"]
path = cmake path = cmake
url = git://github.com/jrl-umi3218/jrl-cmakemodules.git url = https://github.com/jrl-umi3218/jrl-cmakemodules.git
[submodule ".travis"]
path = .travis
url = git://github.com/jrl-umi3218/jrl-travis.git
ci:
autoupdate_branch: 'devel'
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v13.0.1
hooks:
- id: clang-format
args: [-i, --style=Google]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: trailing-whitespace
Subproject commit cbc92f81bdd0dcfd7fc1eae56801d8111267937d
git:
depth: false
language: cpp
sudo: required
compiler:
- gcc
- clang
env:
global:
- DEBSIGN_KEYID=5AE5CD75
- secure: "lEJYxth3fNsmvNS7Ern9+kEpHk4X3Tjo51GBUQBNL6g+YyZJKm4xwBEfwK+sewlmhY3oLUds+5H/2zE27q517kIcpP2Tlp4sRfooJfnBS7YYyF+1boxbvOXrZ2aqev3rzkyvKKMBg0UJTvAiSf7JgVCkMv33GeAX3/I+djEh23U="
- secure: "QTw5QQDaeQWBz6APcUCyl9P9UPI/T3j1++9o9fPxygS9R/7bQYNCrSH++owcAVCJgUI5oY3RmnYk/PjVygOLM0vbFqB2mMySibAhO/U3pSLtZ/HyPjqI9fX0TV/Cf7ji7soeXKk8p6kI2InMILpODLBaLdfm/jgCdAfecr5sGQI="
- secure: "JEcGQsUgEND64cAGVEHSxg8j7SlwofuYtLamANszs/h8FGYZ82rEjmG7r2zqSfBj/i1WsnSbTSsh8WJuXzvV8fw8enkcLEuJG9scQJzuzY8hnLe81o1fhEkclML0SLkLQ2Fu6rIqlKKeYwmJFFhSIj69ESRIkDhkjA1OrV7szzc="
- APT_DEPENDENCIES="doxygen libboost-dev libboost-test-dev libboost-filesystem-dev libboost-system-dev libboost-thread-dev libboost-program-options-dev libeigen3-dev"
- PPA_URI="stack-of-tasks/snapshot"
- NSIQCPPSTYLE_FILEFILTERPATH=cmake/filefilter.txt
notifications:
hipchat:
rooms:
- secure: "SP8KX6gPzBT0BCpcL3ybK4Cgx7a7rmK3Hv/fD2lIf/RUdTwtzLh/J/l9xSYuMZisLe1tM+12vfP7r6t1RNdXrB7pSpYvFRNIWmyfBC7KnUFVn5rwxUnDPhKY3D/XaJ1cycbBJqJdUjYjFKCGEm4x6cpRRN61Ii66RAUvm1h9aHQ="
email:
- hpp-source@laas.fr
branches:
only:
- master
- devel
script: ./travis_custom/build_custom
after_success: ./.travis/run after_success
after_failure: ./.travis/run after_failure
before_install: ./travis_custom/custom_before_install
matrix:
allow_failures:
- compiler: clang
...@@ -25,7 +25,7 @@ INCLUDE(cmake/boost.cmake) ...@@ -25,7 +25,7 @@ INCLUDE(cmake/boost.cmake)
# Project definition # Project definition
COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX) COMPUTE_PROJECT_ARGS(PROJECT_ARGS LANGUAGES CXX)
PROJECT(${PROJECT_NAME} ${PROJECT_ARGS}) PROJECT(${PROJECT_NAME} ${PROJECT_ARGS})
CHECK_MINIMAL_CXX_STANDARD(11 ENFORCE) CHECK_MINIMAL_CXX_STANDARD(14 ENFORCE)
INCLUDE(cmake/pthread.cmake) # needs to be included after the CXX definition INCLUDE(cmake/pthread.cmake) # needs to be included after the CXX definition
......
...@@ -129,4 +129,3 @@ stasse (3): ...@@ -129,4 +129,3 @@ stasse (3):
Reinforce the dependant->dependent policy. Merge the florent branch. Makes the test_depend.cpp test works. Reinforce the dependant->dependent policy. Merge the florent branch. Makes the test_depend.cpp test works.
Reinforce the dependant->dependent policy. Reinforce the dependant->dependent policy.
Adding documentation to cmdPlug. Adding documentation to cmdPlug.
...@@ -4,6 +4,7 @@ dynamic-graph ...@@ -4,6 +4,7 @@ dynamic-graph
[![Building status](https://gitlab.laas.fr/stack-of-tasks/dynamic-graph/badges/master/pipeline.svg)](https://gitlab.laas.fr/stack-of-tasks/dynamic-graph/commits/master) [![Building status](https://gitlab.laas.fr/stack-of-tasks/dynamic-graph/badges/master/pipeline.svg)](https://gitlab.laas.fr/stack-of-tasks/dynamic-graph/commits/master)
[![Coverage report](https://gitlab.laas.fr/stack-of-tasks/dynamic-graph/badges/master/coverage.svg?job=doc-coverage)](http://projects.laas.fr/stack-of-tasks/doc/stack-of-tasks/dynamic-graph/master/coverage/) [![Coverage report](https://gitlab.laas.fr/stack-of-tasks/dynamic-graph/badges/master/coverage.svg?job=doc-coverage)](http://projects.laas.fr/stack-of-tasks/doc/stack-of-tasks/dynamic-graph/master/coverage/)
[![License](https://img.shields.io/badge/License-BSD%202--Clause-green.svg)](https://opensource.org/licenses/BSD-2-Clause) [![License](https://img.shields.io/badge/License-BSD%202--Clause-green.svg)](https://opensource.org/licenses/BSD-2-Clause)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/stack-of-tasks/dynamic-graph/master.svg)](https://results.pre-commit.ci/latest/github/stack-of-tasks/dynamic-graph)
This software provides an efficient way to modelize a C++ data-flow. This software provides an efficient way to modelize a C++ data-flow.
......
Subproject commit a689714c0d0890ffff5649ba25cbaed44dd6e660 Subproject commit e77c9c32b1d69b21e447cf64f1ad1590aab61159
...@@ -293,7 +293,7 @@ WARN_LOGFILE = @CMAKE_BINARY_DIR@/doc/doxygen.log ...@@ -293,7 +293,7 @@ WARN_LOGFILE = @CMAKE_BINARY_DIR@/doc/doxygen.log
INPUT = @CMAKE_SOURCE_DIR@/include \ INPUT = @CMAKE_SOURCE_DIR@/include \
@CMAKE_SOURCE_DIR@/doc/additionalDoc @CMAKE_SOURCE_DIR@/doc/additionalDoc
# The RECURSIVE tag can be used to turn specify whether or not subdirectories # The RECURSIVE tag can be used to turn specify whether or not subdirectories
# should be searched for input files as well. Possible values are YES and NO. # should be searched for input files as well. Possible values are YES and NO.
...@@ -672,4 +672,4 @@ MATHJAX_FORMAT = SVG ...@@ -672,4 +672,4 @@ MATHJAX_FORMAT = SVG
ALIASES += "cheatsheet=\xrefitem cheatsheet \"Remarkable identity\" \"Cheat sheet\"" ALIASES += "cheatsheet=\xrefitem cheatsheet \"Remarkable identity\" \"Cheat sheet\""
CITE_BIB_FILES += @CMAKE_SOURCE_DIR@/doc/sot.bib CITE_BIB_FILES += @CMAKE_SOURCE_DIR@/doc/sot.bib
\ No newline at end of file
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg2" id="svg2"
version="1.1" version="1.1"
inkscape:version="0.47 r22583" inkscape:version="0.47 r22583"
......
...@@ -15,4 +15,4 @@ ...@@ -15,4 +15,4 @@
#include <dynamic-graph/command-setter.h> #include <dynamic-graph/command-setter.h>
#include <dynamic-graph/command.h> #include <dynamic-graph/command.h>
#endif //! DYNAMIC_GRAPH_ALL_COMMANDS_H #endif //! DYNAMIC_GRAPH_ALL_COMMANDS_H
...@@ -12,4 +12,4 @@ ...@@ -12,4 +12,4 @@
#include <dynamic-graph/signal-time-dependent.h> #include <dynamic-graph/signal-time-dependent.h>
#include <dynamic-graph/signal.h> #include <dynamic-graph/signal.h>
#endif //! DYNAMIC_GRAPH_ALL_SIGNALS_H #endif //! DYNAMIC_GRAPH_ALL_SIGNALS_H
...@@ -20,28 +20,30 @@ ...@@ -20,28 +20,30 @@
* *
*/ */
#include "dynamic-graph/command.h"
#include <boost/assign/list_of.hpp> #include <boost/assign/list_of.hpp>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/function.hpp> #include <boost/function.hpp>
#include "dynamic-graph/command.h"
/* --- FUNCTION 0 ARGS ----------------------------------------------------- */ /* --- FUNCTION 0 ARGS ----------------------------------------------------- */
namespace dynamicgraph { namespace dynamicgraph {
namespace command { namespace command {
template <class E> struct CommandVoid0 : public Command { template <class E>
struct CommandVoid0 : public Command {
CommandVoid0(E &entity, boost::function<void(void)> function, CommandVoid0(E &entity, boost::function<void(void)> function,
const std::string &docString) const std::string &docString)
: Command(entity, EMPTY_ARG, docString), fptr(function) {} : Command(entity, EMPTY_ARG, docString), fptr(function) {}
protected: protected:
virtual Value doExecute() { virtual Value doExecute() {
assert(getParameterValues().size() == 0); assert(getParameterValues().size() == 0);
fptr(); fptr();
return Value(); // void return Value(); // void
} }
private: private:
boost::function<void(void)> fptr; boost::function<void(void)> fptr;
}; };
...@@ -69,14 +71,15 @@ inline std::string docCommandVoid0(const std::string &doc) { ...@@ -69,14 +71,15 @@ inline std::string docCommandVoid0(const std::string &doc) {
return std::string("\n") + doc + "\n\nNo input.\nVoid return.\n\n"; return std::string("\n") + doc + "\n\nNo input.\nVoid return.\n\n";
} }
} // namespace command } // namespace command
} // namespace dynamicgraph } // namespace dynamicgraph
/* --- FUNCTION 1 ARGS ------------------------------------------------------ */ /* --- FUNCTION 1 ARGS ------------------------------------------------------ */
namespace dynamicgraph { namespace dynamicgraph {
namespace command { namespace command {
template <class E, typename T> struct CommandVoid1 : public Command { template <class E, typename T>
struct CommandVoid1 : public Command {
typedef boost::function<void(const T &)> function_t; typedef boost::function<void(const T &)> function_t;
CommandVoid1(E &entity, function_t function, const std::string &docString) CommandVoid1(E &entity, function_t function, const std::string &docString)
...@@ -84,33 +87,33 @@ template <class E, typename T> struct CommandVoid1 : public Command { ...@@ -84,33 +87,33 @@ template <class E, typename T> struct CommandVoid1 : public Command {
docString), docString),
fptr(function) {} fptr(function) {}
protected: protected:
virtual Value doExecute() { virtual Value doExecute() {
assert(getParameterValues().size() == 1); assert(getParameterValues().size() == 1);
T val = getParameterValues()[0].value(); T val = getParameterValues()[0].value();
fptr(val); fptr(val);
return Value(); // void return Value(); // void
} }
private: private:
function_t fptr; function_t fptr;
}; };
template <class E, typename T> template <class E, typename T>
CommandVoid1<E, T> * CommandVoid1<E, T> *makeCommandVoid1(
makeCommandVoid1(E &entity, boost::function<void(const T &)> function, E &entity, boost::function<void(const T &)> function,
// typename CommandVoid1<E,T>::function_t function , // typename CommandVoid1<E,T>::function_t function ,
const std::string &docString) { const std::string &docString) {
return new CommandVoid1<E, T>(entity, function, docString); return new CommandVoid1<E, T>(entity, function, docString);
} }
template <class E, typename T> template <class E, typename T>
CommandVoid1<E, T> * CommandVoid1<E, T> *makeCommandVoid1(
makeCommandVoid1(E &entity, E &entity,
// The following syntaxt don't compile when not specializing // The following syntaxt don't compile when not specializing
// the template arg... why ??? // the template arg... why ???
boost::function<void(E *, const T &)> function, boost::function<void(E *, const T &)> function,
const std::string &docString) { const std::string &docString) {
return new CommandVoid1<E, T>(entity, boost::bind(function, &entity, _1), return new CommandVoid1<E, T>(entity, boost::bind(function, &entity, _1),
docString); docString);
} }
...@@ -129,8 +132,8 @@ inline std::string docCommandVoid1(const std::string &doc, ...@@ -129,8 +132,8 @@ inline std::string docCommandVoid1(const std::string &doc,
".\nVoid return.\n\n"; ".\nVoid return.\n\n";
} }
} // namespace command } // namespace command
} // namespace dynamicgraph } // namespace dynamicgraph
/* --- FUNCTION 2 ARGS ------------------------------------------------------ */ /* --- FUNCTION 2 ARGS ------------------------------------------------------ */
namespace dynamicgraph { namespace dynamicgraph {
...@@ -147,42 +150,42 @@ struct CommandVoid2 : public Command { ...@@ -147,42 +150,42 @@ struct CommandVoid2 : public Command {
docString), docString),
fptr(function) {} fptr(function) {}
protected: protected:
virtual Value doExecute() { virtual Value doExecute() {
assert(getParameterValues().size() == 2); assert(getParameterValues().size() == 2);
T1 val1 = getParameterValues()[0].value(); T1 val1 = getParameterValues()[0].value();
T2 val2 = getParameterValues()[1].value(); T2 val2 = getParameterValues()[1].value();
fptr(val1, val2); fptr(val1, val2);
return Value(); // void return Value(); // void
} }
private: private:
function_t fptr; function_t fptr;
}; };
template <class E, typename T1, typename T2> template <class E, typename T1, typename T2>
CommandVoid2<E, T1, T2> * CommandVoid2<E, T1, T2> *makeCommandVoid2(
makeCommandVoid2(E &entity, E &entity, boost::function<void(const T1 &, const T2 &)> function,
boost::function<void(const T1 &, const T2 &)> function, const std::string &docString) {
const std::string &docString) {
return new CommandVoid2<E, T1, T2>(entity, function, docString); return new CommandVoid2<E, T1, T2>(entity, function, docString);
} }
template <class E, typename T1, typename T2> template <class E, typename T1, typename T2>
CommandVoid2<E, T1, T2> * CommandVoid2<E, T1, T2> *makeCommandVoid2(
makeCommandVoid2(E &entity, E &entity,
// The following syntaxt don't compile when not specializing // The following syntaxt don't compile when not specializing
// the template arg... why ??? // the template arg... why ???
boost::function<void(E *, const T1 &, const T2 &)> function, boost::function<void(E *, const T1 &, const T2 &)> function,
const std::string &docString) { const std::string &docString) {
return new CommandVoid2<E, T1, T2>( return new CommandVoid2<E, T1, T2>(
entity, boost::bind(function, &entity, _1, _2), docString); entity, boost::bind(function, &entity, _1, _2), docString);
} }
template <class E, typename T1, typename T2> template <class E, typename T1, typename T2>
CommandVoid2<E, T1, T2> * CommandVoid2<E, T1, T2> *makeCommandVoid2(E &entity,
makeCommandVoid2(E &entity, void (E::*function)(const T1 &, const T2 &), void (E::*function)(const T1 &,
const std::string &docString) { const T2 &),
const std::string &docString) {
return new CommandVoid2<E, T1, T2>( return new CommandVoid2<E, T1, T2>(
entity, boost::bind(function, &entity, _1, _2), docString); entity, boost::bind(function, &entity, _1, _2), docString);
return NULL; return NULL;
...@@ -195,8 +198,8 @@ inline std::string docCommandVoid2(const std::string &doc, ...@@ -195,8 +198,8 @@ inline std::string docCommandVoid2(const std::string &doc,
"Input:\n - A " + type2 + ".\n" + "Void return.\n\n"); "Input:\n - A " + type2 + ".\n" + "Void return.\n\n");
} }
} // namespace command } // namespace command
} // namespace dynamicgraph } // namespace dynamicgraph
/* --- FUNCTION 3 ARGS ------------------------------------------------------ */ /* --- FUNCTION 3 ARGS ------------------------------------------------------ */
namespace dynamicgraph { namespace dynamicgraph {
...@@ -213,25 +216,24 @@ struct CommandVoid3 : public Command { ...@@ -213,25 +216,24 @@ struct CommandVoid3 : public Command {
docString), docString),
fptr(function) {} fptr(function) {}
protected: protected:
virtual Value doExecute() { virtual Value doExecute() {
assert(getParameterValues().size() == 3); assert(getParameterValues().size() == 3);
T1 val1 = getParameterValues()[0].value(); T1 val1 = getParameterValues()[0].value();
T2 val2 = getParameterValues()[1].value(); T2 val2 = getParameterValues()[1].value();
T3 val3 = getParameterValues()[2].value(); T3 val3 = getParameterValues()[2].value();
fptr(val1, val2, val3); fptr(val1, val2, val3);
return Value(); // void return Value(); // void
} }
private: private:
function_t fptr; function_t fptr;
}; };
template <class E, typename T1, typename T2, typename T3> template <class E, typename T1, typename T2, typename T3>
CommandVoid3<E, T1, T2, T3> * CommandVoid3<E, T1, T2, T3> *makeCommandVoid3(
makeCommandVoid3(E &entity, E &entity, typename CommandVoid3<E, T1, T2, T3>::function_t function,
typename CommandVoid3<E, T1, T2, T3>::function_t function, const std::string &docString) {
const std::string &docString) {
return new CommandVoid3<E, T1, T2, T3>(entity, function, docString); return new CommandVoid3<E, T1, T2, T3>(entity, function, docString);
} }
...@@ -247,10 +249,9 @@ CommandVoid3<E, T1, T2, T3> *makeCommandVoid3( ...@@ -247,10 +249,9 @@ CommandVoid3<E, T1, T2, T3> *makeCommandVoid3(
} }
template <class E, typename T1, typename T2, typename T3> template <class E, typename T1, typename T2, typename T3>
CommandVoid3<E, T1, T2, T3> * CommandVoid3<E, T1, T2, T3> *makeCommandVoid3(
makeCommandVoid3(E &entity, E &entity, void (E::*function)(const T1 &, const T2 &, const T3 &),
void (E::*function)(const T1 &, const T2 &, const T3 &), const std::string &docString) {
const std::string &docString) {
return new CommandVoid3<E, T1, T2, T3>( return new CommandVoid3<E, T1, T2, T3>(
entity, boost::bind(function, &entity, _1, _2, _3), docString); entity, boost::bind(function, &entity, _1, _2, _3), docString);
return NULL; return NULL;
...@@ -265,8 +266,8 @@ inline std::string docCommandVoid3(const std::string &doc, ...@@ -265,8 +266,8 @@ inline std::string docCommandVoid3(const std::string &doc,
"Void return.\n\n"); "Void return.\n\n");
} }
} // namespace command } // namespace command
} // namespace dynamicgraph } // namespace dynamicgraph
/* --- FUNCTION 4 ARGS ------------------------------------------------------ */ /* --- FUNCTION 4 ARGS ------------------------------------------------------ */
namespace dynamicgraph { namespace dynamicgraph {
...@@ -287,7 +288,7 @@ struct CommandVoid4 : public Command { ...@@ -287,7 +288,7 @@ struct CommandVoid4 : public Command {
docString), docString),
fptr(function) {} fptr(function) {}
protected: protected:
virtual Value doExecute() { virtual Value doExecute() {
assert(getParameterValues().size() == 4); assert(getParameterValues().size() == 4);
T1 val1 = getParameterValues()[0].value(); T1 val1 = getParameterValues()[0].value();
...@@ -295,18 +296,17 @@ protected: ...@@ -295,18 +296,17 @@ protected:
T3 val3 = getParameterValues()[2].value(); T3 val3 = getParameterValues()[2].value();
T4 val4 = getParameterValues()[3].value(); T4 val4 = getParameterValues()[3].value();
fptr(val1, val2, val3, val4); fptr(val1, val2, val3, val4);
return Value(); // void return Value(); // void
} }
private: private:
function_t fptr; function_t fptr;
}; };
template <class E, typename T1, typename T2, typename T3, typename T4> template <class E, typename T1, typename T2, typename T3, typename T4>
CommandVoid4<E, T1, T2, T3, T4> * CommandVoid4<E, T1, T2, T3, T4> *makeCommandVoid4(
makeCommandVoid4(E &entity, E &entity, typename CommandVoid4<E, T1, T2, T3, T4>::function_t function,
typename CommandVoid4<E, T1, T2, T3, T4>::function_t function, const std::string &docString) {
const std::string &docString) {
return new CommandVoid4<E, T1, T2, T3, T4>(entity, function, docString); return new CommandVoid4<E, T1, T2, T3, T4>(entity, function, docString);
} }
...@@ -340,16 +340,18 @@ inline std::string docCommandVoid4(const std::string &doc, ...@@ -340,16 +340,18 @@ inline std::string docCommandVoid4(const std::string &doc,
"Input:\n - A " + type4 + ".\n" + "Void return.\n\n"); "Input:\n - A " + type4 + ".\n" + "Void return.\n\n");
} }
} // namespace command } // namespace command
} // namespace dynamicgraph } // namespace dynamicgraph
/* --- FUNCTION 5 ARGS ------------------------------------------------------ */ /* --- FUNCTION 5 ARGS ------------------------------------------------------ */
namespace dynamicgraph { namespace dynamicgraph {
namespace command { namespace command {
template <class E, typename T1, typename T2, typename T3, typename T4, typename T5> template <class E, typename T1, typename T2, typename T3, typename T4,
typename T5>
struct CommandVoid5 : public Command { struct CommandVoid5 : public Command {
typedef boost::function<void(const T1 &, const T2 &, const T3 &, const T4 &, const T5 &)> typedef boost::function<void(const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &)>
function_t; function_t;
typedef void (E::*memberFunction_ptr_t)(const T1 &, const T2 &, const T3 &, typedef void (E::*memberFunction_ptr_t)(const T1 &, const T2 &, const T3 &,
const T4 &, const T5 &); const T4 &, const T5 &);
...@@ -362,7 +364,7 @@ struct CommandVoid5 : public Command { ...@@ -362,7 +364,7 @@ struct CommandVoid5 : public Command {
docString), docString),
fptr(function) {} fptr(function) {}
protected: protected:
virtual Value doExecute() { virtual Value doExecute() {
assert(getParameterValues().size() == 5); assert(getParameterValues().size() == 5);
T1 val1 = getParameterValues()[0].value(); T1 val1 = getParameterValues()[0].value();
...@@ -371,35 +373,40 @@ protected: ...@@ -371,35 +373,40 @@ protected:
T4 val4 = getParameterValues()[3].value(); T4 val4 = getParameterValues()[3].value();
T5 val5 = getParameterValues()[4].value(); T5 val5 = getParameterValues()[4].value();
fptr(val1, val2, val3, val4, val5); fptr(val1, val2, val3, val4, val5);
return Value(); // void return Value(); // void
} }
private: private:
function_t fptr; function_t fptr;
}; };
template <class E, typename T1, typename T2, typename T3, typename T4, typename T5> template <class E, typename T1, typename T2, typename T3, typename T4,
CommandVoid5<E, T1, T2, T3, T4, T5> * typename T5>
makeCommandVoid5(E &entity, CommandVoid5<E, T1, T2, T3, T4, T5> *makeCommandVoid5(
typename CommandVoid5<E, T1, T2, T3, T4, T5>::function_t function, E &entity,
const std::string &docString) { typename CommandVoid5<E, T1, T2, T3, T4, T5>::function_t function,
const std::string &docString) {
return new CommandVoid5<E, T1, T2, T3, T4, T5>(entity, function, docString); return new CommandVoid5<E, T1, T2, T3, T4, T5>(entity, function, docString);
} }
template <class E, typename T1, typename T2, typename T3, typename T4, typename T5> template <class E, typename T1, typename T2, typename T3, typename T4,
typename T5>
CommandVoid5<E, T1, T2, T3, T4, T5> *makeCommandVoid5( CommandVoid5<E, T1, T2, T3, T4, T5> *makeCommandVoid5(
E &entity, E &entity,
boost::function<void(E *, const T1 &, const T2 &, const T3 &, const T4 &, const T5 &)> boost::function<void(E *, const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &)>
function, function,
const std::string &docString) { const std::string &docString) {
return new CommandVoid5<E, T1, T2, T3, T4, T5>( return new CommandVoid5<E, T1, T2, T3, T4, T5>(
entity, boost::bind(function, &entity, _1, _2, _3, _4, _5), docString); entity, boost::bind(function, &entity, _1, _2, _3, _4, _5), docString);
} }
template <class E, typename T1, typename T2, typename T3, typename T4, typename T5> template <class E, typename T1, typename T2, typename T3, typename T4,
typename T5>
CommandVoid5<E, T1, T2, T3, T4, T5> *makeCommandVoid5( CommandVoid5<E, T1, T2, T3, T4, T5> *makeCommandVoid5(
E &entity, E &entity,
void (E::*function)(const T1 &, const T2 &, const T3 &, const T4 &, const T5 &), void (E::*function)(const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &),
const std::string &docString) { const std::string &docString) {
return new CommandVoid5<E, T1, T2, T3, T4, T5>( return new CommandVoid5<E, T1, T2, T3, T4, T5>(
entity, boost::bind(function, &entity, _1, _2, _3, _4, _5), docString); entity, boost::bind(function, &entity, _1, _2, _3, _4, _5), docString);
...@@ -418,16 +425,18 @@ inline std::string docCommandVoid5(const std::string &doc, ...@@ -418,16 +425,18 @@ inline std::string docCommandVoid5(const std::string &doc,
"Void return.\n\n"); "Void return.\n\n");
} }
} // namespace command } // namespace command
} // namespace dynamicgraph } // namespace dynamicgraph
/* --- FUNCTION 6 ARGS ------------------------------------------------------ */ /* --- FUNCTION 6 ARGS ------------------------------------------------------ */
namespace dynamicgraph { namespace dynamicgraph {
namespace command { namespace command {
template <class E, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> template <class E, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6>
struct CommandVoid6 : public Command { struct CommandVoid6 : public Command {
typedef boost::function<void(const T1 &, const T2 &, const T3 &, const T4 &, const T5 &, const T6 &)> typedef boost::function<void(const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &, const T6 &)>
function_t; function_t;
typedef void (E::*memberFunction_ptr_t)(const T1 &, const T2 &, const T3 &, typedef void (E::*memberFunction_ptr_t)(const T1 &, const T2 &, const T3 &,
const T4 &, const T5 &, const T6 &); const T4 &, const T5 &, const T6 &);
...@@ -441,7 +450,7 @@ struct CommandVoid6 : public Command { ...@@ -441,7 +450,7 @@ struct CommandVoid6 : public Command {
docString), docString),
fptr(function) {} fptr(function) {}
protected: protected:
virtual Value doExecute() { virtual Value doExecute() {
assert(getParameterValues().size() == 6); assert(getParameterValues().size() == 6);
T1 val1 = getParameterValues()[0].value(); T1 val1 = getParameterValues()[0].value();
...@@ -451,64 +460,71 @@ protected: ...@@ -451,64 +460,71 @@ protected:
T5 val5 = getParameterValues()[4].value(); T5 val5 = getParameterValues()[4].value();
T6 val6 = getParameterValues()[5].value(); T6 val6 = getParameterValues()[5].value();
fptr(val1, val2, val3, val4, val5, val6); fptr(val1, val2, val3, val4, val5, val6);
return Value(); // void return Value(); // void
} }
private: private:
function_t fptr; function_t fptr;
}; };
template <class E, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> template <class E, typename T1, typename T2, typename T3, typename T4,
CommandVoid6<E, T1, T2, T3, T4, T5, T6> * typename T5, typename T6>
makeCommandVoid6(E &entity, CommandVoid6<E, T1, T2, T3, T4, T5, T6> *makeCommandVoid6(
typename CommandVoid6<E, T1, T2, T3, T4, T5, T6>::function_t function, E &entity,
const std::string &docString) { typename CommandVoid6<E, T1, T2, T3, T4, T5, T6>::function_t function,
return new CommandVoid6<E, T1, T2, T3, T4, T5, T6>(entity, function, docString); const std::string &docString) {
return new CommandVoid6<E, T1, T2, T3, T4, T5, T6>(entity, function,
docString);
} }
template <class E, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> template <class E, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6>
CommandVoid6<E, T1, T2, T3, T4, T5, T6> *makeCommandVoid6( CommandVoid6<E, T1, T2, T3, T4, T5, T6> *makeCommandVoid6(
E &entity, E &entity,
boost::function<void(E *, const T1 &, const T2 &, const T3 &, const T4 &, const T5 &, const T6 &)> boost::function<void(E *, const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &, const T6 &)>
function, function,
const std::string &docString) { const std::string &docString) {
return new CommandVoid6<E, T1, T2, T3, T4, T5, T6>( return new CommandVoid6<E, T1, T2, T3, T4, T5, T6>(
entity, boost::bind(function, &entity, _1, _2, _3, _4, _5, _6), docString); entity, boost::bind(function, &entity, _1, _2, _3, _4, _5, _6),
docString);
} }
template <class E, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> template <class E, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6>
CommandVoid6<E, T1, T2, T3, T4, T5, T6> *makeCommandVoid6( CommandVoid6<E, T1, T2, T3, T4, T5, T6> *makeCommandVoid6(
E &entity, E &entity,
void (E::*function)(const T1 &, const T2 &, const T3 &, const T4 &, const T5 &, const T6 &), void (E::*function)(const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &, const T6 &),
const std::string &docString) { const std::string &docString) {
return new CommandVoid6<E, T1, T2, T3, T4, T5, T6>( return new CommandVoid6<E, T1, T2, T3, T4, T5, T6>(
entity, boost::bind(function, &entity, _1, _2, _3, _4, _5, _6), docString); entity, boost::bind(function, &entity, _1, _2, _3, _4, _5, _6),
docString);
return NULL; return NULL;
} }
inline std::string docCommandVoid6(const std::string &doc, inline std::string docCommandVoid6(
const std::string &type1, const std::string &doc, const std::string &type1, const std::string &type2,
const std::string &type2, const std::string &type3, const std::string &type4,
const std::string &type3, const std::string &type5, const std::string &type6) {
const std::string &type4,
const std::string &type5,
const std::string &type6) {
return (std::string("\n") + doc + "\n\n" + "Input:\n - A " + type1 + ".\n" + return (std::string("\n") + doc + "\n\n" + "Input:\n - A " + type1 + ".\n" +
"Input:\n - A " + type2 + ".\n" + "Input:\n - A " + type3 + ".\n" + "Input:\n - A " + type2 + ".\n" + "Input:\n - A " + type3 + ".\n" +
"Input:\n - A " + type4 + ".\n" + "Input:\n - A " + type5 + ".\n" + "Input:\n - A " + type4 + ".\n" + "Input:\n - A " + type5 + ".\n" +
"Input:\n - A " + type6 + ".\n" + "Void return.\n\n"); "Input:\n - A " + type6 + ".\n" + "Void return.\n\n");
} }
} // namespace command } // namespace command
} // namespace dynamicgraph } // namespace dynamicgraph
/* --- FUNCTION 7 ARGS ------------------------------------------------------ */ /* --- FUNCTION 7 ARGS ------------------------------------------------------ */
namespace dynamicgraph { namespace dynamicgraph {
namespace command { namespace command {
template <class E, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> template <class E, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7>
struct CommandVoid7 : public Command { struct CommandVoid7 : public Command {
typedef boost::function<void(const T1 &, const T2 &, const T3 &, const T4 &, const T5 &, const T6 &, const T7 &)> typedef boost::function<void(const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &, const T6 &, const T7 &)>
function_t; function_t;
typedef void (E::*memberFunction_ptr_t)(const T1 &, const T2 &, const T3 &, typedef void (E::*memberFunction_ptr_t)(const T1 &, const T2 &, const T3 &,
const T4 &, const T5 &, const T6 &, const T4 &, const T5 &, const T6 &,
...@@ -523,7 +539,7 @@ struct CommandVoid7 : public Command { ...@@ -523,7 +539,7 @@ struct CommandVoid7 : public Command {
docString), docString),
fptr(function) {} fptr(function) {}
protected: protected:
virtual Value doExecute() { virtual Value doExecute() {
assert(getParameterValues().size() == 7); assert(getParameterValues().size() == 7);
T1 val1 = getParameterValues()[0].value(); T1 val1 = getParameterValues()[0].value();
...@@ -534,49 +550,54 @@ protected: ...@@ -534,49 +550,54 @@ protected:
T6 val6 = getParameterValues()[5].value(); T6 val6 = getParameterValues()[5].value();
T7 val7 = getParameterValues()[6].value(); T7 val7 = getParameterValues()[6].value();
fptr(val1, val2, val3, val4, val5, val6, val7); fptr(val1, val2, val3, val4, val5, val6, val7);
return Value(); // void return Value(); // void
} }
private: private:
function_t fptr; function_t fptr;
}; };
template <class E, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> template <class E, typename T1, typename T2, typename T3, typename T4,
CommandVoid7<E, T1, T2, T3, T4, T5, T6, T7> * typename T5, typename T6, typename T7>
makeCommandVoid7(E &entity, CommandVoid7<E, T1, T2, T3, T4, T5, T6, T7> *makeCommandVoid7(
typename CommandVoid7<E, T1, T2, T3, T4, T5, T6, T7>::function_t function, E &entity,
const std::string &docString) { typename CommandVoid7<E, T1, T2, T3, T4, T5, T6, T7>::function_t function,
return new CommandVoid7<E, T1, T2, T3, T4, T5, T6, T7>(entity, function, docString); const std::string &docString) {
return new CommandVoid7<E, T1, T2, T3, T4, T5, T6, T7>(entity, function,
docString);
} }
template <class E, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> template <class E, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7>
CommandVoid7<E, T1, T2, T3, T4, T5, T6, T7> *makeCommandVoid7( CommandVoid7<E, T1, T2, T3, T4, T5, T6, T7> *makeCommandVoid7(
E &entity, E &entity,
boost::function<void(E *, const T1 &, const T2 &, const T3 &, const T4 &, const T5 &, const T6 &, const T7 &)> boost::function<void(E *, const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &, const T6 &, const T7 &)>
function, function,
const std::string &docString) { const std::string &docString) {
return new CommandVoid7<E, T1, T2, T3, T4, T5, T6, T7>( return new CommandVoid7<E, T1, T2, T3, T4, T5, T6, T7>(
entity, boost::bind(function, &entity, _1, _2, _3, _4, _5, _6, _7), docString); entity, boost::bind(function, &entity, _1, _2, _3, _4, _5, _6, _7),
docString);
} }
template <class E, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> template <class E, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7>
CommandVoid7<E, T1, T2, T3, T4, T5, T6, T7> *makeCommandVoid7( CommandVoid7<E, T1, T2, T3, T4, T5, T6, T7> *makeCommandVoid7(
E &entity, E &entity,
void (E::*function)(const T1 &, const T2 &, const T3 &, const T4 &, const T5 &, const T6 &, const T7 &), void (E::*function)(const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &, const T6 &, const T7 &),
const std::string &docString) { const std::string &docString) {
return new CommandVoid7<E, T1, T2, T3, T4, T5, T6, T7>( return new CommandVoid7<E, T1, T2, T3, T4, T5, T6, T7>(
entity, boost::bind(function, &entity, _1, _2, _3, _4, _5, _6, _7), docString); entity, boost::bind(function, &entity, _1, _2, _3, _4, _5, _6, _7),
docString);
return NULL; return NULL;
} }
inline std::string docCommandVoid7(const std::string &doc, inline std::string docCommandVoid7(
const std::string &type1, const std::string &doc, const std::string &type1, const std::string &type2,
const std::string &type2, const std::string &type3, const std::string &type4,
const std::string &type3, const std::string &type5, const std::string &type6,
const std::string &type4, const std::string &type7) {
const std::string &type5,
const std::string &type6,
const std::string &type7) {
return (std::string("\n") + doc + "\n\n" + "Input:\n - A " + type1 + ".\n" + return (std::string("\n") + doc + "\n\n" + "Input:\n - A " + type1 + ".\n" +
"Input:\n - A " + type2 + ".\n" + "Input:\n - A " + type3 + ".\n" + "Input:\n - A " + type2 + ".\n" + "Input:\n - A " + type3 + ".\n" +
"Input:\n - A " + type4 + ".\n" + "Input:\n - A " + type5 + ".\n" + "Input:\n - A " + type4 + ".\n" + "Input:\n - A " + type5 + ".\n" +
...@@ -584,16 +605,18 @@ inline std::string docCommandVoid7(const std::string &doc, ...@@ -584,16 +605,18 @@ inline std::string docCommandVoid7(const std::string &doc,
"Void return.\n\n"); "Void return.\n\n");
} }
} // namespace command } // namespace command
} // namespace dynamicgraph } // namespace dynamicgraph
/* --- FUNCTION 8 ARGS ------------------------------------------------------ */ /* --- FUNCTION 8 ARGS ------------------------------------------------------ */
namespace dynamicgraph { namespace dynamicgraph {
namespace command { namespace command {
template <class E, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> template <class E, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8>
struct CommandVoid8 : public Command { struct CommandVoid8 : public Command {
typedef boost::function<void(const T1 &, const T2 &, const T3 &, const T4 &, const T5 &, const T6 &, const T7 &, const T8 &)> typedef boost::function<void(const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &, const T6 &, const T7 &, const T8 &)>
function_t; function_t;
typedef void (E::*memberFunction_ptr_t)(const T1 &, const T2 &, const T3 &, typedef void (E::*memberFunction_ptr_t)(const T1 &, const T2 &, const T3 &,
const T4 &, const T5 &, const T6 &, const T4 &, const T5 &, const T6 &,
...@@ -609,7 +632,7 @@ struct CommandVoid8 : public Command { ...@@ -609,7 +632,7 @@ struct CommandVoid8 : public Command {
docString), docString),
fptr(function) {} fptr(function) {}
protected: protected:
virtual Value doExecute() { virtual Value doExecute() {
assert(getParameterValues().size() == 8); assert(getParameterValues().size() == 8);
T1 val1 = getParameterValues()[0].value(); T1 val1 = getParameterValues()[0].value();
...@@ -621,50 +644,55 @@ protected: ...@@ -621,50 +644,55 @@ protected:
T7 val7 = getParameterValues()[6].value(); T7 val7 = getParameterValues()[6].value();
T8 val8 = getParameterValues()[7].value(); T8 val8 = getParameterValues()[7].value();
fptr(val1, val2, val3, val4, val5, val6, val7, val8); fptr(val1, val2, val3, val4, val5, val6, val7, val8);
return Value(); // void return Value(); // void
} }
private: private:
function_t fptr; function_t fptr;
}; };
template <class E, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> template <class E, typename T1, typename T2, typename T3, typename T4,
CommandVoid8<E, T1, T2, T3, T4, T5, T6, T7, T8> * typename T5, typename T6, typename T7, typename T8>
makeCommandVoid8(E &entity, CommandVoid8<E, T1, T2, T3, T4, T5, T6, T7, T8> *makeCommandVoid8(
typename CommandVoid8<E, T1, T2, T3, T4, T5, T6, T7, T8>::function_t function, E &entity,
const std::string &docString) { typename CommandVoid8<E, T1, T2, T3, T4, T5, T6, T7, T8>::function_t
return new CommandVoid8<E, T1, T2, T3, T4, T5, T6, T7, T8>(entity, function, docString); function,
const std::string &docString) {
return new CommandVoid8<E, T1, T2, T3, T4, T5, T6, T7, T8>(entity, function,
docString);
} }
template <class E, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> template <class E, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8>
CommandVoid8<E, T1, T2, T3, T4, T5, T6, T7, T8> *makeCommandVoid8( CommandVoid8<E, T1, T2, T3, T4, T5, T6, T7, T8> *makeCommandVoid8(
E &entity, E &entity,
boost::function<void(E *, const T1 &, const T2 &, const T3 &, const T4 &, const T5 &, const T6 &, const T7 &, const T8 &)> boost::function<void(E *, const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &, const T6 &, const T7 &, const T8 &)>
function, function,
const std::string &docString) { const std::string &docString) {
return new CommandVoid8<E, T1, T2, T3, T4, T5, T6, T7, T8>( return new CommandVoid8<E, T1, T2, T3, T4, T5, T6, T7, T8>(
entity, boost::bind(function, &entity, _1, _2, _3, _4, _5, _6, _7, _8), docString); entity, boost::bind(function, &entity, _1, _2, _3, _4, _5, _6, _7, _8),
docString);
} }
template <class E, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> template <class E, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8>
CommandVoid8<E, T1, T2, T3, T4, T5, T6, T7, T8> *makeCommandVoid8( CommandVoid8<E, T1, T2, T3, T4, T5, T6, T7, T8> *makeCommandVoid8(
E &entity, E &entity,
void (E::*function)(const T1 &, const T2 &, const T3 &, const T4 &, const T5 &, const T6 &, const T7 &, const T8 &), void (E::*function)(const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &, const T6 &, const T7 &, const T8 &),
const std::string &docString) { const std::string &docString) {
return new CommandVoid8<E, T1, T2, T3, T4, T5, T6, T7, T8>( return new CommandVoid8<E, T1, T2, T3, T4, T5, T6, T7, T8>(
entity, boost::bind(function, &entity, _1, _2, _3, _4, _5, _6, _7, _8), docString); entity, boost::bind(function, &entity, _1, _2, _3, _4, _5, _6, _7, _8),
docString);
return NULL; return NULL;
} }
inline std::string docCommandVoid8(const std::string &doc, inline std::string docCommandVoid8(
const std::string &type1, const std::string &doc, const std::string &type1, const std::string &type2,
const std::string &type2, const std::string &type3, const std::string &type4,
const std::string &type3, const std::string &type5, const std::string &type6,
const std::string &type4, const std::string &type7, const std::string &type8) {
const std::string &type5,
const std::string &type6,
const std::string &type7,
const std::string &type8) {
return (std::string("\n") + doc + "\n\n" + "Input:\n - A " + type1 + ".\n" + return (std::string("\n") + doc + "\n\n" + "Input:\n - A " + type1 + ".\n" +
"Input:\n - A " + type2 + ".\n" + "Input:\n - A " + type3 + ".\n" + "Input:\n - A " + type2 + ".\n" + "Input:\n - A " + type3 + ".\n" +
"Input:\n - A " + type4 + ".\n" + "Input:\n - A " + type5 + ".\n" + "Input:\n - A " + type4 + ".\n" + "Input:\n - A " + type5 + ".\n" +
...@@ -672,8 +700,8 @@ inline std::string docCommandVoid8(const std::string &doc, ...@@ -672,8 +700,8 @@ inline std::string docCommandVoid8(const std::string &doc,
"Input:\n - A " + type8 + ".\n" + "Void return.\n\n"); "Input:\n - A " + type8 + ".\n" + "Void return.\n\n");
} }
} // namespace command } // namespace command
} // namespace dynamicgraph } // namespace dynamicgraph
/* --- FUNCTION VERBOSE ----------------------------------------------------- */ /* --- FUNCTION VERBOSE ----------------------------------------------------- */
/* This bind a function void f( ostream& ) that display some results into /* This bind a function void f( ostream& ) that display some results into
...@@ -681,28 +709,29 @@ inline std::string docCommandVoid8(const std::string &doc, ...@@ -681,28 +709,29 @@ inline std::string docCommandVoid8(const std::string &doc,
namespace dynamicgraph { namespace dynamicgraph {
namespace command { namespace command {
template <class E> struct CommandVerbose : public Command { template <class E>
struct CommandVerbose : public Command {
typedef boost::function<void(std::ostream &)> function_t; typedef boost::function<void(std::ostream &)> function_t;
CommandVerbose(E &entity, function_t function, const std::string &docString) CommandVerbose(E &entity, function_t function, const std::string &docString)
: Command(entity, EMPTY_ARG, docString), fptr(function) {} : Command(entity, EMPTY_ARG, docString), fptr(function) {}
protected: protected:
virtual Value doExecute() { virtual Value doExecute() {
assert(getParameterValues().size() == 0); assert(getParameterValues().size() == 0);
std::ostringstream oss; std::ostringstream oss;
fptr(oss); fptr(oss);
return Value(oss.str()); // return string return Value(oss.str()); // return string
} }
private: private:
function_t fptr; function_t fptr;
}; };
template <class E> template <class E>
CommandVerbose<E> * CommandVerbose<E> *makeCommandVerbose(
makeCommandVerbose(E &entity, typename CommandVerbose<E>::function_t function, E &entity, typename CommandVerbose<E>::function_t function,
const std::string &docString) { const std::string &docString) {
return new CommandVerbose<E>(entity, function, docString); return new CommandVerbose<E>(entity, function, docString);
return NULL; return NULL;
} }
...@@ -729,50 +758,48 @@ struct CommandReturnType0 : public Command { ...@@ -729,50 +758,48 @@ struct CommandReturnType0 : public Command {
const std::string &docString) const std::string &docString)
: Command(entity, EMPTY_ARG, docString), fptr(function) {} : Command(entity, EMPTY_ARG, docString), fptr(function) {}
protected: protected:
virtual Value doExecute() { virtual Value doExecute() {
assert(getParameterValues().size() == 0); assert(getParameterValues().size() == 0);
Value res(fptr()); Value res(fptr());
return res; return res;
} }
private: private:
boost::function<ReturnType(void)> fptr; boost::function<ReturnType(void)> fptr;
}; };
template <class E, class ReturnType> template <class E, class ReturnType>
CommandReturnType0<E, ReturnType> * CommandReturnType0<E, ReturnType> *makeCommandReturnType0(
makeCommandReturnType0(E &entity, boost::function<ReturnType(void)> function, E &entity, boost::function<ReturnType(void)> function,
const std::string &docString) { const std::string &docString) {
return new CommandReturnType0<E, ReturnType>(entity, function, docString); return new CommandReturnType0<E, ReturnType>(entity, function, docString);
} }
template <class E, class ReturnType> template <class E, class ReturnType>
CommandReturnType0<E, ReturnType> * CommandReturnType0<E, ReturnType> *makeCommandReturnType0(
makeCommandReturnType0(E &entity, boost::function<ReturnType(E *)> function, E &entity, boost::function<ReturnType(E *)> function,
const std::string &docString) { const std::string &docString) {
return new CommandReturnType0<E, ReturnType>( return new CommandReturnType0<E, ReturnType>(
entity, boost::bind(function, &entity), docString); entity, boost::bind(function, &entity), docString);
} }
template <class E, class ReturnType> template <class E, class ReturnType>
CommandReturnType0<E, ReturnType> * CommandReturnType0<E, ReturnType> *makeCommandReturnType0(
makeCommandReturnType0(E &entity, ReturnType (E::*function)(void), E &entity, ReturnType (E::*function)(void), const std::string &docString) {
const std::string &docString) {
return new CommandReturnType0<E, ReturnType>( return new CommandReturnType0<E, ReturnType>(
entity, boost::bind(function, &entity), docString); entity, boost::bind(function, &entity), docString);
} }
template <typename ReturnType> template <typename ReturnType>
inline std::string inline std::string docCommandReturnType0(
docCommandReturnType0(const std::string &doc, const std::string &doc, const std::string & /* return_type */) {
const std::string & /* return_type */) {
return std::string("\n") + doc + "\n\nNo input.\n" + return std::string("\n") + doc + "\n\nNo input.\n" +
typeid(ReturnType).name() + " return.\n\n"; typeid(ReturnType).name() + " return.\n\n";
} }
} // namespace command } // namespace command
} // namespace dynamicgraph } // namespace dynamicgraph
/* --- FUNCTION 1 ARGS ------------------------------------------------------ */ /* --- FUNCTION 1 ARGS ------------------------------------------------------ */
namespace dynamicgraph { namespace dynamicgraph {
...@@ -788,7 +815,7 @@ struct CommandReturnType1 : public Command { ...@@ -788,7 +815,7 @@ struct CommandReturnType1 : public Command {
docString), docString),
fptr(function) {} fptr(function) {}
protected: protected:
virtual Value doExecute() { virtual Value doExecute() {
assert(getParameterValues().size() == 1); assert(getParameterValues().size() == 1);
T val = getParameterValues()[0].value(); T val = getParameterValues()[0].value();
...@@ -796,33 +823,32 @@ protected: ...@@ -796,33 +823,32 @@ protected:
return res; return res;
} }
private: private:
function_t fptr; function_t fptr;
}; };
template <class E, typename ReturnType, typename T> template <class E, typename ReturnType, typename T>
CommandReturnType1<E, ReturnType, T> * CommandReturnType1<E, ReturnType, T> *makeCommandReturnType1(
makeCommandReturnType1(E &entity, E &entity, boost::function<ReturnType(const T &)> function,
boost::function<ReturnType(const T &)> function, const std::string &docString) {
const std::string &docString) {
return new CommandReturnType1<E, ReturnType, T>(entity, function, docString); return new CommandReturnType1<E, ReturnType, T>(entity, function, docString);
} }
template <class E, typename ReturnType, typename T> template <class E, typename ReturnType, typename T>
CommandReturnType1<E, ReturnType, T> * CommandReturnType1<E, ReturnType, T> *makeCommandReturnType1(
makeCommandReturnType1(E &entity, E &entity,
// The following syntaxt don't compile when not // The following syntaxt don't compile when not
// specializing the template arg... why ??? // specializing the template arg... why ???
boost::function<ReturnType(E *, const T &)> function, boost::function<ReturnType(E *, const T &)> function,
const std::string &docString) { const std::string &docString) {
return new CommandReturnType1<E, ReturnType, T>( return new CommandReturnType1<E, ReturnType, T>(
entity, boost::bind(function, &entity, _1), docString); entity, boost::bind(function, &entity, _1), docString);
} }
template <class E, typename ReturnType, typename T> template <class E, typename ReturnType, typename T>
CommandReturnType1<E, ReturnType, T> * CommandReturnType1<E, ReturnType, T> *makeCommandReturnType1(
makeCommandReturnType1(E &entity, ReturnType (E::*function)(const T &), E &entity, ReturnType (E::*function)(const T &),
const std::string &docString) { const std::string &docString) {
return new CommandReturnType1<E, ReturnType, T>( return new CommandReturnType1<E, ReturnType, T>(
entity, boost::bind(function, &entity, _1), docString); entity, boost::bind(function, &entity, _1), docString);
return NULL; return NULL;
...@@ -835,8 +861,8 @@ inline std::string docCommandReturnType1(const std::string &doc, ...@@ -835,8 +861,8 @@ inline std::string docCommandReturnType1(const std::string &doc,
typeid(ReturnType).name() + "return.\n\n"; typeid(ReturnType).name() + "return.\n\n";
} }
} // namespace command } // namespace command
} // namespace dynamicgraph } // namespace dynamicgraph
/*********** FUNCTION 2 Arguments ************************/ /*********** FUNCTION 2 Arguments ************************/
namespace dynamicgraph { namespace dynamicgraph {
...@@ -854,7 +880,7 @@ struct CommandReturnType2 : public Command { ...@@ -854,7 +880,7 @@ struct CommandReturnType2 : public Command {
docString), docString),
fptr(function) {} fptr(function) {}
protected: protected:
virtual Value doExecute() { virtual Value doExecute() {
assert(getParameterValues().size() == 2); assert(getParameterValues().size() == 2);
T1 val1 = getParameterValues()[0].value(); T1 val1 = getParameterValues()[0].value();
...@@ -863,7 +889,7 @@ protected: ...@@ -863,7 +889,7 @@ protected:
return res; return res;
} }
private: private:
function_t fptr; function_t fptr;
}; };
...@@ -887,10 +913,9 @@ CommandReturnType2<E, ReturnType, T1, T2> *makeCommandReturnType2( ...@@ -887,10 +913,9 @@ CommandReturnType2<E, ReturnType, T1, T2> *makeCommandReturnType2(
} }
template <class E, typename ReturnType, typename T1, typename T2> template <class E, typename ReturnType, typename T1, typename T2>
CommandReturnType2<E, ReturnType, T1, T2> * CommandReturnType2<E, ReturnType, T1, T2> *makeCommandReturnType2(
makeCommandReturnType2(E &entity, E &entity, ReturnType (E::*function)(const T1 &, const T2 &),
ReturnType (E::*function)(const T1 &, const T2 &), const std::string &docString) {
const std::string &docString) {
return new CommandReturnType2<E, ReturnType, T1, T2>( return new CommandReturnType2<E, ReturnType, T1, T2>(
entity, boost::bind(function, &entity, _1, _2), docString); entity, boost::bind(function, &entity, _1, _2), docString);
return NULL; return NULL;
...@@ -905,7 +930,7 @@ inline std::string docCommandReturnType2(const std::string &doc, ...@@ -905,7 +930,7 @@ inline std::string docCommandReturnType2(const std::string &doc,
"ReturnType:\n - Returns:" + typeid(ReturnType).name() + +".\n\n"); "ReturnType:\n - Returns:" + typeid(ReturnType).name() + +".\n\n");
} }
} // namespace command } // namespace command
} // namespace dynamicgraph } // namespace dynamicgraph
#endif // __dg_command_bind_h__ #endif // __dg_command_bind_h__
...@@ -15,15 +15,17 @@ ...@@ -15,15 +15,17 @@
* *
*/ */
#include "dynamic-graph/command.h"
#include <boost/assign/list_of.hpp> #include <boost/assign/list_of.hpp>
#include "dynamic-graph/command.h"
/* --- GETTER --------------------------------------------------------- */ /* --- GETTER --------------------------------------------------------- */
namespace dynamicgraph { namespace dynamicgraph {
namespace command { namespace command {
template <class E, typename T> class DirectGetter : public Command { template <class E, typename T>
public: class DirectGetter : public Command {
public:
/// Pointer to method that sets parameter of type T /// Pointer to method that sets parameter of type T
typedef T (E::*GetterMethod)() const; typedef T (E::*GetterMethod)() const;
...@@ -31,10 +33,10 @@ public: ...@@ -31,10 +33,10 @@ public:
DirectGetter(E &entity, T *ptr, const std::string &docString) DirectGetter(E &entity, T *ptr, const std::string &docString)
: Command(entity, std::vector<Value::Type>(), docString), T_ptr(ptr) {} : Command(entity, std::vector<Value::Type>(), docString), T_ptr(ptr) {}
protected: protected:
virtual Value doExecute() { return Value(*T_ptr); } virtual Value doExecute() { return Value(*T_ptr); }
private: private:
T *T_ptr; T *T_ptr;
}; };
...@@ -50,7 +52,7 @@ inline std::string docDirectGetter(const std::string &name, ...@@ -50,7 +52,7 @@ inline std::string docDirectGetter(const std::string &name,
type + ".\n\n"; type + ".\n\n";
} }
} // namespace command } // namespace command
} // namespace dynamicgraph } // namespace dynamicgraph
#endif // __dg_command_direct_getter_h__ #endif // __dg_command_direct_getter_h__
...@@ -15,29 +15,31 @@ ...@@ -15,29 +15,31 @@
* *
*/ */
#include "dynamic-graph/command.h"
#include <boost/assign/list_of.hpp> #include <boost/assign/list_of.hpp>
#include "dynamic-graph/command.h"
/* --- SETTER --------------------------------------------------------- */ /* --- SETTER --------------------------------------------------------- */
namespace dynamicgraph { namespace dynamicgraph {
namespace command { namespace command {
template <class E, typename T> class DirectSetter : public Command { template <class E, typename T>
public: class DirectSetter : public Command {
public:
DirectSetter(E &entity, T *ptr, const std::string &docString) DirectSetter(E &entity, T *ptr, const std::string &docString)
: Command(entity, boost::assign::list_of(ValueHelper<T>::TypeID), : Command(entity, boost::assign::list_of(ValueHelper<T>::TypeID),
docString), docString),
T_ptr(ptr) {} T_ptr(ptr) {}
protected: protected:
virtual Value doExecute() { virtual Value doExecute() {
const std::vector<Value> &values = getParameterValues(); const std::vector<Value> &values = getParameterValues();
T val = values[0].value(); T val = values[0].value();
(*T_ptr) = val; (*T_ptr) = val;
return Value(); // void return Value(); // void
} }
private: private:
T *T_ptr; T *T_ptr;
}; };
...@@ -53,7 +55,7 @@ inline std::string docDirectSetter(const std::string &name, ...@@ -53,7 +55,7 @@ inline std::string docDirectSetter(const std::string &name,
".\nVoid return.\n\n"; ".\nVoid return.\n\n";
} }
} // namespace command } // namespace command
} // namespace dynamicgraph } // namespace dynamicgraph
#endif // __dg_command_direct_setter_h__ #endif // __dg_command_direct_setter_h__
...@@ -41,21 +41,22 @@ namespace command { ...@@ -41,21 +41,22 @@ namespace command {
/// \li T should be a type supported by class Value, /// \li T should be a type supported by class Value,
/// \li prototype of E::getParameter should be exactly as specified in this /// \li prototype of E::getParameter should be exactly as specified in this
/// example. /// example.
template <class E, typename T> class Getter : public Command { template <class E, typename T>
public: class Getter : public Command {
public:
/// Pointer to method that sets parameter of type T /// Pointer to method that sets parameter of type T
typedef T (E::*GetterMethod)() const; typedef T (E::*GetterMethod)() const;
/// Constructor /// Constructor
Getter(E &entity, GetterMethod getterMethod, const std::string &docString); Getter(E &entity, GetterMethod getterMethod, const std::string &docString);
protected: protected:
virtual Value doExecute(); virtual Value doExecute();
private: private:
GetterMethod getterMethod_; GetterMethod getterMethod_;
}; };
} // namespace command } // namespace command
} // namespace dynamicgraph } // namespace dynamicgraph
#include "dynamic-graph/command-getter.t.cpp" #include "dynamic-graph/command-getter.t.cpp"
#endif // DYNAMIC_GRAPH_COMMAND_GETTER_H #endif // DYNAMIC_GRAPH_COMMAND_GETTER_H
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#define DYNAMIC_GRAPH_COMMAND_GETTER_T_CPP #define DYNAMIC_GRAPH_COMMAND_GETTER_T_CPP
#include "dynamic-graph/command-getter.h" #include "dynamic-graph/command-getter.h"
#include <sstream> #include <sstream>
namespace dynamicgraph { namespace dynamicgraph {
...@@ -20,12 +21,13 @@ Getter<E, T>::Getter(E &entity, GetterMethod getterMethod, ...@@ -20,12 +21,13 @@ Getter<E, T>::Getter(E &entity, GetterMethod getterMethod,
: Command(entity, std::vector<Value::Type>(), docstring), : Command(entity, std::vector<Value::Type>(), docstring),
getterMethod_(getterMethod) {} getterMethod_(getterMethod) {}
template <class E, typename T> Value Getter<E, T>::doExecute() { template <class E, typename T>
Value Getter<E, T>::doExecute() {
E &entity = static_cast<E &>(owner()); E &entity = static_cast<E &>(owner());
T value = (entity.*getterMethod_)(); T value = (entity.*getterMethod_)();
return Value(value); return Value(value);
} }
} // namespace command } // namespace command
} // namespace dynamicgraph } // namespace dynamicgraph
#endif // DYNAMIC_GRAPH_COMMAND_GETTER_T_CPP #endif // DYNAMIC_GRAPH_COMMAND_GETTER_T_CPP