From 0b3df6830ba93900dbc43dbe1227d8262bbd941b Mon Sep 17 00:00:00 2001 From: Mansard <nmansard@laas.fr> Date: Wed, 16 Feb 2011 17:32:59 +0100 Subject: [PATCH] Corrected function to inline to avoid multiple symbole definition. --- include/dynamic-graph/command-bind.h | 35 ++++++++++++------- include/dynamic-graph/command-direct-getter.h | 4 +-- include/dynamic-graph/command-direct-setter.h | 4 +-- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/include/dynamic-graph/command-bind.h b/include/dynamic-graph/command-bind.h index 70a9efb..47ecf1e 100644 --- a/include/dynamic-graph/command-bind.h +++ b/include/dynamic-graph/command-bind.h @@ -85,7 +85,7 @@ namespace dynamicgraph { boost::bind(function,&entity),docString ); } - std::string docCommandVoid0( const std::string& doc ) + inline std::string docCommandVoid0( const std::string& doc ) { return std::string("\n")+doc +"\n\nNo input.\nVoid return.\n\n"; } @@ -127,7 +127,8 @@ namespace dynamicgraph { template <class E,typename T > CommandVoid1<E,T>* makeCommandVoid1(E& entity, - typename CommandVoid1<E,T>::function_t function , + boost::function<void(const T&)> function, + //typename CommandVoid1<E,T>::function_t function , const std::string& docString) { return new CommandVoid1<E,T>( entity,function,docString ); @@ -157,7 +158,7 @@ namespace dynamicgraph { return NULL; } - std::string docCommandVoid1( const std::string& doc, const std::string& type ) + inline std::string docCommandVoid1( const std::string& doc, const std::string& type ) { return std::string("\n")+doc +"\n\nInput:\n - A "+type+".\nVoid return.\n\n"; } @@ -234,9 +235,9 @@ namespace dynamicgraph { return NULL; } - std::string docCommandVoid2( const std::string& doc, - const std::string& type1, - const std::string& type2 ) + inline std::string docCommandVoid2( const std::string& doc, + const std::string& type1, + const std::string& type2 ) { return (std::string("\n")+doc+"\n\n" +"Input:\n - A "+type1+".\n" @@ -319,10 +320,10 @@ namespace dynamicgraph { return NULL; } - std::string docCommandVoid3( const std::string& doc, - const std::string& type1, - const std::string& type2, - const std::string& type3 ) + inline std::string docCommandVoid3( const std::string& doc, + const std::string& type1, + const std::string& type2, + const std::string& type3 ) { return (std::string("\n")+doc+"\n\n" +"Input:\n - A "+type1+".\n" @@ -352,7 +353,7 @@ namespace dynamicgraph { CommandVerbose(E& entity, function_t function, const std::string& docString) - :Command(entity, boost::assign::list_of(ValueHelper<std::string>::TypeID), docString) + :Command(entity, EMPTY_ARG, docString) ,fptr(function) {} @@ -368,6 +369,16 @@ namespace dynamicgraph { function_t fptr; }; + template <class E > + CommandVerbose<E>* + makeCommandVerbose(E& entity, + typename CommandVerbose<E>::function_t function, + const std::string& docString) + { + return new CommandVerbose<E>( entity,function,docString ); + return NULL; + } + template <class E > CommandVerbose<E>* makeCommandVerbose(E& entity, @@ -391,7 +402,7 @@ namespace dynamicgraph { return NULL; } - std::string docCommandVerbose( const std::string& doc ) + inline std::string docCommandVerbose( const std::string& doc ) { return std::string("\n")+doc +"\n\nNo input.\n Return a string.\n\n"; } diff --git a/include/dynamic-graph/command-direct-getter.h b/include/dynamic-graph/command-direct-getter.h index 6ea26ba..e64efa6 100644 --- a/include/dynamic-graph/command-direct-getter.h +++ b/include/dynamic-graph/command-direct-getter.h @@ -59,8 +59,8 @@ namespace dynamicgraph { const std::string& docString) { return new DirectGetter<E,T>(entity,ptr,docString); } - std::string docDirectGetter( const std::string& name, - const std::string& type ) + inline std::string docDirectGetter( const std::string& name, + const std::string& type ) { return std::string("\nGet the ")+name+".\n\nNo input.\nReturn an "+type+".\n\n"; } diff --git a/include/dynamic-graph/command-direct-setter.h b/include/dynamic-graph/command-direct-setter.h index 56a492c..2457975 100644 --- a/include/dynamic-graph/command-direct-setter.h +++ b/include/dynamic-graph/command-direct-setter.h @@ -61,8 +61,8 @@ namespace dynamicgraph { const std::string& docString) { return new DirectSetter<E,T>(entity,ptr,docString); } - std::string docDirectSetter( const std::string& name, - const std::string& type ) + inline std::string docDirectSetter( const std::string& name, + const std::string& type ) { return std::string("\nSet the ")+name+".\n\nInput:\n - a " +type+".\nVoid return.\n\n"; -- GitLab