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 (78)
Showing
with 718 additions and 327 deletions
---
ColumnLimit: 80
...
# pre-commit run -a (Guilhem Saurel, 2022-07-27)
e9a222fb0a1f236e534e21c66cb623fd8d25b8d6
# 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: v14.0.6
hooks:
- id: clang-format
args: [--style=Google]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.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
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
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
CMAKE_MINIMUM_REQUIRED(VERSION 3.1) cmake_minimum_required(VERSION 3.1)
# Project properties # Project properties
SET(PROJECT_ORG stack-of-tasks) set(PROJECT_ORG stack-of-tasks)
SET(PROJECT_NAME dynamic-graph) set(PROJECT_NAME dynamic-graph)
SET(PROJECT_DESCRIPTION "Dynamic graph library") set(PROJECT_DESCRIPTION "Dynamic graph library")
SET(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}") set(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")
SET(PROJECT_SUFFIX "-v3")
# Project options # Project options
OPTION(SUFFIX_SO_VERSION "Suffix library name with its version" ON) option(SUFFIX_SO_VERSION "Suffix library name with its version" ON)
# Project configuration # Project configuration
SET(PROJECT_USE_CMAKE_EXPORT TRUE) set(PROJECT_USE_CMAKE_EXPORT TRUE)
SET(CUSTOM_HEADER_DIR ${PROJECT_NAME}) set(CUSTOM_HEADER_DIR ${PROJECT_NAME})
SET(CXX_DISABLE_WERROR TRUE) set(CXX_DISABLE_WERROR TRUE)
# Doxygen setup # Doxygen setup
SET(DOXYGEN_USE_MATHJAX YES) set(DOXYGEN_USE_MATHJAX YES)
SET(DOXYGEN_USE_TEMPLATE_CSS YES) set(DOXYGEN_USE_TEMPLATE_CSS YES)
# JRL-cmakemodule setup # JRL-cmakemodule setup
INCLUDE(cmake/base.cmake) include(cmake/base.cmake)
INCLUDE(cmake/boost.cmake) 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
# Project dependencies # Project dependencies
FIND_PACKAGE(Boost REQUIRED COMPONENTS unit_test_framework) if(BUILD_TESTING)
ADD_PROJECT_DEPENDENCY(Boost REQUIRED COMPONENTS serialization system thread) find_package(Boost REQUIRED COMPONENTS unit_test_framework)
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES eigen3) endif()
SEARCH_FOR_PTHREAD() add_project_dependency(Boost REQUIRED COMPONENTS serialization system thread)
add_project_dependency(Eigen3 REQUIRED)
search_for_pthread()
if(Boost_VERSION GREATER 107299 OR Boost_VERSION_MACRO GREATER 107299)
# Silence a warning about a deprecated use of boost bind by boost >= 1.73
# without dropping support for boost < 1.73
add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS)
endif()
# Add configuration headers for plug-ins. # Add configuration headers for plug-ins.
GENERATE_CONFIGURATION_HEADER( generate_configuration_header(${HEADER_DIR} config-tracer.hh DG_TRACER
${HEADER_DIR} config-tracer.hh DG_TRACER tracer_EXPORTS) tracer_EXPORTS)
GENERATE_CONFIGURATION_HEADER( generate_configuration_header(${HEADER_DIR} config-tracer-real-time.hh
${HEADER_DIR} DG_TRACERREALTIME tracer_real_time_EXPORTS)
config-tracer-real-time.hh DG_TRACERREALTIME tracer_real_time_EXPORTS)
# Verbosity level # Verbosity level
IF(NOT (\"${CMAKE_VERBOSITY_LEVEL}\" STREQUAL \"\")) if(NOT (\"${CMAKE_VERBOSITY_LEVEL}\" STREQUAL \"\"))
ADD_DEFINITIONS(-DVP_DEBUG_MODE=${CMAKE_VERBOSITY_LEVEL} -DVP_DEBUG) add_definitions(-DVP_DEBUG_MODE=${CMAKE_VERBOSITY_LEVEL} -DVP_DEBUG)
ENDIF(NOT (\"${CMAKE_VERBOSITY_LEVEL}\" STREQUAL \"\")) endif(NOT (\"${CMAKE_VERBOSITY_LEVEL}\" STREQUAL \"\"))
# Main Library # Main Library
SET(${PROJECT_NAME}_HEADERS set(${PROJECT_NAME}_HEADERS
include/${CUSTOM_HEADER_DIR}/fwd.hh include/${CUSTOM_HEADER_DIR}/fwd.hh
include/${CUSTOM_HEADER_DIR}/debug.h include/${CUSTOM_HEADER_DIR}/debug.h
include/${CUSTOM_HEADER_DIR}/real-time-logger.h include/${CUSTOM_HEADER_DIR}/real-time-logger.h
include/${CUSTOM_HEADER_DIR}/real-time-logger-def.h include/${CUSTOM_HEADER_DIR}/real-time-logger-def.h
include/${CUSTOM_HEADER_DIR}/dynamic-graph-api.h
include/${CUSTOM_HEADER_DIR}/dynamic-graph-api.h include/${CUSTOM_HEADER_DIR}/entity.h
include/${CUSTOM_HEADER_DIR}/factory.h
include/${CUSTOM_HEADER_DIR}/entity.h include/${CUSTOM_HEADER_DIR}/pool.h
include/${CUSTOM_HEADER_DIR}/factory.h include/${CUSTOM_HEADER_DIR}/exception-abstract.h
include/${CUSTOM_HEADER_DIR}/pool.h include/${CUSTOM_HEADER_DIR}/exception-factory.h
include/${CUSTOM_HEADER_DIR}/exception-signal.h
include/${CUSTOM_HEADER_DIR}/exception-abstract.h include/${CUSTOM_HEADER_DIR}/exception-traces.h
include/${CUSTOM_HEADER_DIR}/exception-factory.h include/${CUSTOM_HEADER_DIR}/signal.h
include/${CUSTOM_HEADER_DIR}/exception-signal.h include/${CUSTOM_HEADER_DIR}/signal-array.h
include/${CUSTOM_HEADER_DIR}/exception-traces.h include/${CUSTOM_HEADER_DIR}/signal-base.h
include/${CUSTOM_HEADER_DIR}/signal-ptr.h
include/${CUSTOM_HEADER_DIR}/signal.h include/${CUSTOM_HEADER_DIR}/signal-time-dependent.h
include/${CUSTOM_HEADER_DIR}/signal-array.h include/${CUSTOM_HEADER_DIR}/signal-ptr.t.cpp
include/${CUSTOM_HEADER_DIR}/signal-base.h include/${CUSTOM_HEADER_DIR}/signal.t.cpp
include/${CUSTOM_HEADER_DIR}/signal-ptr.h include/${CUSTOM_HEADER_DIR}/time-dependency.h
include/${CUSTOM_HEADER_DIR}/signal-time-dependent.h include/${CUSTOM_HEADER_DIR}/time-dependency.t.cpp
include/${CUSTOM_HEADER_DIR}/signal-ptr.t.cpp # Kept for a brittle backward compatiblity.
include/${CUSTOM_HEADER_DIR}/signal.t.cpp include/${CUSTOM_HEADER_DIR}/signal-caster.h
include/${CUSTOM_HEADER_DIR}/time-dependency.h include/${CUSTOM_HEADER_DIR}/signal-cast-helper.h
include/${CUSTOM_HEADER_DIR}/time-dependency.t.cpp include/${CUSTOM_HEADER_DIR}/all-signals.h
# Kept for a brittle backward compatiblity. include/${CUSTOM_HEADER_DIR}/signal-helper.h
include/${CUSTOM_HEADER_DIR}/signal-caster.h include/${CUSTOM_HEADER_DIR}/entity-helper.h
include/${CUSTOM_HEADER_DIR}/signal-cast-helper.h include/${CUSTOM_HEADER_DIR}/tracer.h
include/${CUSTOM_HEADER_DIR}/all-signals.h include/${CUSTOM_HEADER_DIR}/tracer-real-time.h
include/${CUSTOM_HEADER_DIR}/signal-helper.h include/${CUSTOM_HEADER_DIR}/command.h
include/${CUSTOM_HEADER_DIR}/entity-helper.h include/${CUSTOM_HEADER_DIR}/eigen-io.h
include/${CUSTOM_HEADER_DIR}/linear-algebra.h
include/${CUSTOM_HEADER_DIR}/tracer.h include/${CUSTOM_HEADER_DIR}/value.h
include/${CUSTOM_HEADER_DIR}/tracer-real-time.h include/${CUSTOM_HEADER_DIR}/command-setter.h
include/${CUSTOM_HEADER_DIR}/command-setter.t.cpp
include/${CUSTOM_HEADER_DIR}/command.h include/${CUSTOM_HEADER_DIR}/command-getter.h
include/${CUSTOM_HEADER_DIR}/eigen-io.h include/${CUSTOM_HEADER_DIR}/command-getter.t.cpp
include/${CUSTOM_HEADER_DIR}/linear-algebra.h include/${CUSTOM_HEADER_DIR}/command-direct-getter.h
include/${CUSTOM_HEADER_DIR}/value.h include/${CUSTOM_HEADER_DIR}/command-direct-setter.h
include/${CUSTOM_HEADER_DIR}/command-bind.h
include/${CUSTOM_HEADER_DIR}/command-setter.h include/${CUSTOM_HEADER_DIR}/all-commands.h
include/${CUSTOM_HEADER_DIR}/command-setter.t.cpp include/${CUSTOM_HEADER_DIR}/logger.h)
include/${CUSTOM_HEADER_DIR}/command-getter.h
include/${CUSTOM_HEADER_DIR}/command-getter.t.cpp set(${PROJECT_NAME}_SOURCES
include/${CUSTOM_HEADER_DIR}/command-direct-getter.h src/debug/debug.cpp
include/${CUSTOM_HEADER_DIR}/command-direct-setter.h src/debug/real-time-logger.cpp
include/${CUSTOM_HEADER_DIR}/command-bind.h src/debug/logger.cpp
include/${CUSTOM_HEADER_DIR}/all-commands.h src/dgraph/entity.cpp
src/dgraph/factory.cpp
include/${CUSTOM_HEADER_DIR}/logger.h src/dgraph/pool.cpp
) src/exception/exception-abstract.cpp
src/exception/exception-factory.cpp
SET(${PROJECT_NAME}_SOURCES src/exception/exception-signal.cpp
src/debug/debug.cpp src/exception/exception-traces.cpp
src/debug/real-time-logger.cpp src/mt/process-list.cpp
src/debug/logger.cpp src/signal/signal-array.cpp
src/command/value.cpp
src/dgraph/entity.cpp src/command/command.cpp)
src/dgraph/factory.cpp
src/dgraph/pool.cpp add_library(${PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_HEADERS})
src/exception/exception-abstract.cpp modernize_target_link_libraries(
src/exception/exception-factory.cpp ${PROJECT_NAME}
src/exception/exception-signal.cpp SCOPE
src/exception/exception-traces.cpp PUBLIC
TARGETS
src/mt/process-list.cpp Eigen3::Eigen
INCLUDE_DIRS
src/signal/signal-array.cpp ${EIGEN3_INCLUDE_DIR})
target_include_directories(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
src/command/value.cpp target_link_libraries(${PROJECT_NAME} PUBLIC Boost::serialization Boost::system
src/command/command.cpp Boost::thread)
)
if(UNIX)
ADD_LIBRARY(${PROJECT_NAME} SHARED target_link_libraries(${PROJECT_NAME} PUBLIC ${CMAKE_DL_LIBS} pthread)
${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_HEADERS}) endif(UNIX)
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} SYSTEM PUBLIC ${EIGEN3_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}) if(SUFFIX_SO_VERSION)
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>) set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${Boost_LIBRARIES}) endif(SUFFIX_SO_VERSION)
IF(UNIX) install(
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${CMAKE_DL_LIBS} pthread) TARGETS ${PROJECT_NAME}
ENDIF(UNIX) EXPORT ${TARGETS_EXPORT_NAME}
DESTINATION lib)
IF(SUFFIX_SO_VERSION)
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION}) set(DYNAMIC_GRAPH_PLUGINDIR "lib/${PROJECT_NAME}-plugins")
ENDIF(SUFFIX_SO_VERSION) set(PACKAGE_EXTRA_MACROS
"set(DYNAMIC_GRAPH_PLUGINDIR ${DYNAMIC_GRAPH_PLUGINDIR})")
INSTALL(TARGETS ${PROJECT_NAME} EXPORT ${TARGETS_EXPORT_NAME} DESTINATION lib) set(PKG_CONFIG_EXTRA "plugindir=${DYNAMIC_GRAPH_PLUGINDIR}")
add_subdirectory(src)
SET(DYNAMIC_GRAPH_PLUGINDIR "${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}-plugins") if(BUILD_TESTING)
SET(PACKAGE_EXTRA_MACROS "set(DYNAMIC_GRAPH_PLUGINDIR ${DYNAMIC_GRAPH_PLUGINDIR})") add_subdirectory(tests)
SET(PKG_CONFIG_EXTRA "plugindir=${DYNAMIC_GRAPH_PLUGINDIR}") endif(BUILD_TESTING)
SET(CMAKE_INSTALL_RPATH "${DYNAMIC_GRAPH_PLUGINDIR}")
pkg_config_append_libs(${PROJECT_NAME})
ADD_SUBDIRECTORY(src) install(FILES package.xml DESTINATION share/${PROJECT_NAME})
ADD_SUBDIRECTORY(tests)
PKG_CONFIG_APPEND_LIBS(${PROJECT_NAME})
INSTALL(FILES package.xml DESTINATION share/${PROJECT_NAME})
...@@ -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 c6e4768fc40c1da1bdee04354538151b9c898acf Subproject commit 47c0cbf0b29433060682377dcb28266e8dc38995
...@@ -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,8 +340,368 @@ inline std::string docCommandVoid4(const std::string &doc, ...@@ -340,8 +340,368 @@ 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 ------------------------------------------------------ */
namespace dynamicgraph {
namespace command {
template <class E, typename T1, typename T2, typename T3, typename T4,
typename T5>
struct CommandVoid5 : public Command {
typedef boost::function<void(const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &)>
function_t;
typedef void (E::*memberFunction_ptr_t)(const T1 &, const T2 &, const T3 &,
const T4 &, const T5 &);
CommandVoid5(E &entity, function_t function, const std::string &docString)
: Command(entity,
boost::assign::list_of(ValueHelper<T1>::TypeID)(
ValueHelper<T2>::TypeID)(ValueHelper<T3>::TypeID)(
ValueHelper<T4>::TypeID)(ValueHelper<T5>::TypeID),
docString),
fptr(function) {}
protected:
virtual Value doExecute() {
assert(getParameterValues().size() == 5);
T1 val1 = getParameterValues()[0].value();
T2 val2 = getParameterValues()[1].value();
T3 val3 = getParameterValues()[2].value();
T4 val4 = getParameterValues()[3].value();
T5 val5 = getParameterValues()[4].value();
fptr(val1, val2, val3, val4, val5);
return Value(); // void
}
private:
function_t fptr;
};
template <class E, typename T1, typename T2, typename T3, typename T4,
typename T5>
CommandVoid5<E, T1, T2, T3, T4, T5> *makeCommandVoid5(
E &entity,
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);
}
template <class E, typename T1, typename T2, typename T3, typename T4,
typename T5>
CommandVoid5<E, T1, T2, T3, T4, T5> *makeCommandVoid5(
E &entity,
boost::function<void(E *, const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &)>
function,
const std::string &docString) {
return new CommandVoid5<E, T1, T2, T3, T4, T5>(
entity, boost::bind(function, &entity, _1, _2, _3, _4, _5), docString);
}
template <class E, typename T1, typename T2, typename T3, typename T4,
typename T5>
CommandVoid5<E, T1, T2, T3, T4, T5> *makeCommandVoid5(
E &entity,
void (E::*function)(const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &),
const std::string &docString) {
return new CommandVoid5<E, T1, T2, T3, T4, T5>(
entity, boost::bind(function, &entity, _1, _2, _3, _4, _5), docString);
return NULL;
}
inline std::string docCommandVoid5(const std::string &doc,
const std::string &type1,
const std::string &type2,
const std::string &type3,
const std::string &type4,
const std::string &type5) {
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 " + type4 + ".\n" + "Input:\n - A " + type5 + ".\n" +
"Void return.\n\n");
}
} // namespace command
} // namespace dynamicgraph
/* --- FUNCTION 6 ARGS ------------------------------------------------------ */
namespace dynamicgraph {
namespace command {
template <class E, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6>
struct CommandVoid6 : public Command {
typedef boost::function<void(const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &, const T6 &)>
function_t;
typedef void (E::*memberFunction_ptr_t)(const T1 &, const T2 &, const T3 &,
const T4 &, const T5 &, const T6 &);
CommandVoid6(E &entity, function_t function, const std::string &docString)
: Command(entity,
boost::assign::list_of(ValueHelper<T1>::TypeID)(
ValueHelper<T2>::TypeID)(ValueHelper<T3>::TypeID)(
ValueHelper<T4>::TypeID)(ValueHelper<T5>::TypeID)(
ValueHelper<T6>::TypeID),
docString),
fptr(function) {}
protected:
virtual Value doExecute() {
assert(getParameterValues().size() == 6);
T1 val1 = getParameterValues()[0].value();
T2 val2 = getParameterValues()[1].value();
T3 val3 = getParameterValues()[2].value();
T4 val4 = getParameterValues()[3].value();
T5 val5 = getParameterValues()[4].value();
T6 val6 = getParameterValues()[5].value();
fptr(val1, val2, val3, val4, val5, val6);
return Value(); // void
}
private:
function_t fptr;
};
template <class E, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6>
CommandVoid6<E, T1, T2, T3, T4, T5, T6> *makeCommandVoid6(
E &entity,
typename CommandVoid6<E, T1, T2, T3, T4, T5, T6>::function_t function,
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>
CommandVoid6<E, T1, T2, T3, T4, T5, T6> *makeCommandVoid6(
E &entity,
boost::function<void(E *, const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &, const T6 &)>
function,
const std::string &docString) {
return new CommandVoid6<E, T1, T2, T3, T4, T5, T6>(
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>
CommandVoid6<E, T1, T2, T3, T4, T5, T6> *makeCommandVoid6(
E &entity,
void (E::*function)(const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &, const T6 &),
const std::string &docString) {
return new CommandVoid6<E, T1, T2, T3, T4, T5, T6>(
entity, boost::bind(function, &entity, _1, _2, _3, _4, _5, _6),
docString);
return NULL;
}
inline std::string docCommandVoid6(
const std::string &doc, const std::string &type1, const std::string &type2,
const std::string &type3, const std::string &type4,
const std::string &type5, const std::string &type6) {
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 " + type4 + ".\n" + "Input:\n - A " + type5 + ".\n" +
"Input:\n - A " + type6 + ".\n" + "Void return.\n\n");
}
} // namespace command
} // namespace dynamicgraph
/* --- FUNCTION 7 ARGS ------------------------------------------------------ */
namespace dynamicgraph {
namespace command {
template <class E, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7>
struct CommandVoid7 : public Command {
typedef boost::function<void(const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &, const T6 &, const T7 &)>
function_t;
typedef void (E::*memberFunction_ptr_t)(const T1 &, const T2 &, const T3 &,
const T4 &, const T5 &, const T6 &,
const T7 &);
CommandVoid7(E &entity, function_t function, const std::string &docString)
: Command(entity,
boost::assign::list_of(ValueHelper<T1>::TypeID)(
ValueHelper<T2>::TypeID)(ValueHelper<T3>::TypeID)(
ValueHelper<T4>::TypeID)(ValueHelper<T5>::TypeID)(
ValueHelper<T6>::TypeID)(ValueHelper<T7>::TypeID),
docString),
fptr(function) {}
protected:
virtual Value doExecute() {
assert(getParameterValues().size() == 7);
T1 val1 = getParameterValues()[0].value();
T2 val2 = getParameterValues()[1].value();
T3 val3 = getParameterValues()[2].value();
T4 val4 = getParameterValues()[3].value();
T5 val5 = getParameterValues()[4].value();
T6 val6 = getParameterValues()[5].value();
T7 val7 = getParameterValues()[6].value();
fptr(val1, val2, val3, val4, val5, val6, val7);
return Value(); // void
}
private:
function_t fptr;
};
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(
E &entity,
typename CommandVoid7<E, T1, T2, T3, T4, T5, T6, T7>::function_t function,
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>
CommandVoid7<E, T1, T2, T3, T4, T5, T6, T7> *makeCommandVoid7(
E &entity,
boost::function<void(E *, const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &, const T6 &, const T7 &)>
function,
const std::string &docString) {
return new CommandVoid7<E, T1, T2, T3, T4, T5, T6, T7>(
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>
CommandVoid7<E, T1, T2, T3, T4, T5, T6, T7> *makeCommandVoid7(
E &entity,
void (E::*function)(const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &, const T6 &, const T7 &),
const std::string &docString) {
return new CommandVoid7<E, T1, T2, T3, T4, T5, T6, T7>(
entity, boost::bind(function, &entity, _1, _2, _3, _4, _5, _6, _7),
docString);
return NULL;
}
inline std::string docCommandVoid7(
const std::string &doc, const std::string &type1, const std::string &type2,
const std::string &type3, const std::string &type4,
const std::string &type5, const std::string &type6,
const std::string &type7) {
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 " + type4 + ".\n" + "Input:\n - A " + type5 + ".\n" +
"Input:\n - A " + type6 + ".\n" + "Input:\n - A " + type7 + ".\n" +
"Void return.\n\n");
}
} // namespace command
} // namespace dynamicgraph
/* --- FUNCTION 8 ARGS ------------------------------------------------------ */
namespace dynamicgraph {
namespace command {
template <class E, typename T1, typename T2, typename T3, typename T4,
typename T5, typename T6, typename T7, typename T8>
struct CommandVoid8 : public Command {
typedef boost::function<void(const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &, const T6 &, const T7 &, const T8 &)>
function_t;
typedef void (E::*memberFunction_ptr_t)(const T1 &, const T2 &, const T3 &,
const T4 &, const T5 &, const T6 &,
const T7 &, const T8 &);
CommandVoid8(E &entity, function_t function, const std::string &docString)
: Command(entity,
boost::assign::list_of(ValueHelper<T1>::TypeID)(
ValueHelper<T2>::TypeID)(ValueHelper<T3>::TypeID)(
ValueHelper<T4>::TypeID)(ValueHelper<T5>::TypeID)(
ValueHelper<T6>::TypeID)(ValueHelper<T7>::TypeID)(
ValueHelper<T8>::TypeID),
docString),
fptr(function) {}
protected:
virtual Value doExecute() {
assert(getParameterValues().size() == 8);
T1 val1 = getParameterValues()[0].value();
T2 val2 = getParameterValues()[1].value();
T3 val3 = getParameterValues()[2].value();
T4 val4 = getParameterValues()[3].value();
T5 val5 = getParameterValues()[4].value();
T6 val6 = getParameterValues()[5].value();
T7 val7 = getParameterValues()[6].value();
T8 val8 = getParameterValues()[7].value();
fptr(val1, val2, val3, val4, val5, val6, val7, val8);
return Value(); // void
}
private:
function_t fptr;
};
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(
E &entity,
typename CommandVoid8<E, T1, T2, T3, T4, T5, T6, T7, T8>::function_t
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>
CommandVoid8<E, T1, T2, T3, T4, T5, T6, T7, T8> *makeCommandVoid8(
E &entity,
boost::function<void(E *, const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &, const T6 &, const T7 &, const T8 &)>
function,
const std::string &docString) {
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);
}
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(
E &entity,
void (E::*function)(const T1 &, const T2 &, const T3 &, const T4 &,
const T5 &, const T6 &, const T7 &, const T8 &),
const std::string &docString) {
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);
return NULL;
}
inline std::string docCommandVoid8(
const std::string &doc, const std::string &type1, const std::string &type2,
const std::string &type3, const std::string &type4,
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" +
"Input:\n - A " + type2 + ".\n" + "Input:\n - A " + type3 + ".\n" +
"Input:\n - A " + type4 + ".\n" + "Input:\n - A " + type5 + ".\n" +
"Input:\n - A " + type6 + ".\n" + "Input:\n - A " + type7 + ".\n" +
"Input:\n - A " + type8 + ".\n" + "Void return.\n\n");
}
} // namespace command
} // 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
...@@ -349,28 +709,29 @@ inline std::string docCommandVoid4(const std::string &doc, ...@@ -349,28 +709,29 @@ inline std::string docCommandVoid4(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;
} }
...@@ -397,51 +758,48 @@ struct CommandReturnType0 : public Command { ...@@ -397,51 +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; Value res(fptr());
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 {
...@@ -457,41 +815,40 @@ struct CommandReturnType1 : public Command { ...@@ -457,41 +815,40 @@ 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();
Value res(fptr(val)); Value res(fptr(val));
return res; // void 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;
...@@ -504,8 +861,8 @@ inline std::string docCommandReturnType1(const std::string &doc, ...@@ -504,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 {
...@@ -523,16 +880,16 @@ struct CommandReturnType2 : public Command { ...@@ -523,16 +880,16 @@ 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();
T2 val2 = getParameterValues()[1].value(); T2 val2 = getParameterValues()[1].value();
fptr(val1, val2); Value res(fptr(val1, val2));
return Value(); // void return res;
} }
private: private:
function_t fptr; function_t fptr;
}; };
...@@ -556,10 +913,9 @@ CommandReturnType2<E, ReturnType, T1, T2> *makeCommandReturnType2( ...@@ -556,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;
...@@ -574,7 +930,7 @@ inline std::string docCommandReturnType2(const std::string &doc, ...@@ -574,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