diff --git a/AUTHORS b/AUTHORS index f766ee26eb699f9278a4b1b9c43a62915683c770..77602e7259d8ffa15fc5a29e199076e95990bedb 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1 +1 @@ -Authors: +Authors: Nicolas Mansard, Olivier Stasse, François Keith, François Bleibel \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index d202d299414871ef89b9a16445cb1cb12ff70fa2..7c1ee5a7f08f58b2fc1eb3b25ba3b850d496ccc3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,7 +107,6 @@ MESSAGE(STATUS "Boost thread lib name: ${BOOST_THREAD_LIB_NAME} ${Boost_THREAD_L INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) - # # Look for dependencies # @@ -144,8 +143,11 @@ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/dynamic-graph.pc DESTINATION ${install_libdir_pkgconfig} PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE) +ENABLE_TESTING() + ADD_SUBDIRECTORY(src) ADD_SUBDIRECTORY(include) +ADD_SUBDIRECTORY(tools) ADD_SUBDIRECTORY(unitTesting) # diff --git a/README b/README index 4818b748141f7df167bc31744f5901432d918afd..8088615b8df0911bd86f84092de1049f1c3b41e5 100644 --- a/README +++ b/README @@ -1 +1,7 @@ -See INSTALL for installation instruction. +See INSTALL for installation instructions. + +The dynamic-graph library is a framework to create dynamic +graphs of generic entities connected together by signals, +with helper facilities such as signal casters, an object +factory and an object pool. It is a spin-off and was +originally part of the StackOfTasks library. diff --git a/doc/additionalDoc/package.h b/doc/additionalDoc/package.h index be875a22a84afe1c0dc4f32849c7e686798ff574..5ff74320d890ee1449a0cd20e4914622fd370664 100644 --- a/doc/additionalDoc/package.h +++ b/doc/additionalDoc/package.h @@ -29,9 +29,9 @@ at the command line. The public static objects (singletons) made available by including the corresponding headers in this module are: -\li factory: FactoryStorage -\li pool: PoolStorage -\li Shell: Interpreter +\li g_factory: FactoryStorage +\li g_pool: PoolStorage +\li g_shell: Interpreter \image html pictures/use-case.svg diff --git a/include/dynamic-graph/all-signals.h b/include/dynamic-graph/all-signals.h index 82f3175b22938db2fa42a1e7a06dd323c7bc8a6b..c305effc32ecdd4a2334758b246644cb206b20b4 100644 --- a/include/dynamic-graph/all-signals.h +++ b/include/dynamic-graph/all-signals.h @@ -2,18 +2,16 @@ * all-signals.h * * Created on: Jun 16, 2010 - * Author: blue + * Author: Francois Bleibel */ #ifndef ALLSIGNALS_H_ #define ALLSIGNALS_H_ -/// Utility header files including all signals and using namespace dynamicgraph +/// Utility header files including all signal headers #include <dynamic-graph/signal.h> #include <dynamic-graph/signal-ptr.h> #include <dynamic-graph/signal-time-dependant.h> -using namespace dynamicgraph; - #endif /* ALLSIGNALS_H_ */ diff --git a/include/dynamic-graph/contiifstream.h b/include/dynamic-graph/contiifstream.h index b1bacb120f2010b1ea7b4ec884eb96d81c3f008b..583aa232f1a23db05f701a585352fd588c8f17fd 100644 --- a/include/dynamic-graph/contiifstream.h +++ b/include/dynamic-graph/contiifstream.h @@ -2,8 +2,8 @@ * Copyright Projet JRL-Japan, 2007 *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * - * File: sotContiifstream.h - * Project: SOT + * File: Contiifstream.h + * Project: DYNAMIC-GRAPH * Author: Nicolas Mansard * * Version control @@ -45,17 +45,17 @@ #if defined (WIN32) # if defined (sotContiifstream_EXPORTS) -# define SOTCONTIIFSTREAM_EXPORT __declspec(dllexport) +# define DYNAMICGRAPHCONTIIFSTREAM_EXPORT __declspec(dllexport) # else -# define SOTCONTIIFSTREAM_EXPORT __declspec(dllimport) +# define DYNAMICGRAPHCONTIIFSTREAM_EXPORT __declspec(dllimport) # endif #else -# define SOTCONTIIFSTREAM_EXPORT +# define DYNAMICGRAPHCONTIIFSTREAM_EXPORT #endif /* --------------------------------------------------------------------- */ /* --- CLASS ----------------------------------------------------------- */ /* --------------------------------------------------------------------- */ -class SOTCONTIIFSTREAM_EXPORT sotContiifstream +class DYNAMICGRAPHCONTIIFSTREAM_EXPORT Contiifstream { protected: std::string filename; @@ -66,8 +66,8 @@ protected: bool first; public: /* --- Constructor --- */ - sotContiifstream( const std::string& n="" ); - ~sotContiifstream( void ); + Contiifstream( const std::string& n="" ); + ~Contiifstream( void ); void open( const std::string& n ) { filename=n; cursor=0; } public: /* --- READ FILE --- */ diff --git a/include/dynamic-graph/entity.h b/include/dynamic-graph/entity.h index b1266492df22993081c69cd90e5123a0a30a4e6c..568ed017f43e8bb4493a3933777841a5e2556712 100644 --- a/include/dynamic-graph/entity.h +++ b/include/dynamic-graph/entity.h @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: entity.h - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: François Bleibel (from Nicolas Mansard) * * Version control @@ -26,7 +26,7 @@ /* --- INCLUDE --------------------------------------------------------- */ /* --------------------------------------------------------------------- */ -/* SOT */ +/* DYNAMIC-GRAPH */ #include <dynamic-graph/signal-base.h> #include <dynamic-graph/exception-factory.h> #include <dynamic-graph/signal-array.h> @@ -52,7 +52,7 @@ namespace dynamicgraph { These signals link the entities together to form a complete computation graph. To declare a new entity, please see the DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN macro - in factory.h. + in g_factory.h. A command-line interface provided by the entity can be used by a sot shell to call methods from entities and display the result of their execution. Classes that derive from Entity can customize the command-line by overriding commandLine(). diff --git a/include/dynamic-graph/exception-abstract.h b/include/dynamic-graph/exception-abstract.h index 2b2acfa243a2abaf62e51c917223784559b53eec..98c069667f0cce0d1f61868348ae273dc51560b9 100644 --- a/include/dynamic-graph/exception-abstract.h +++ b/include/dynamic-graph/exception-abstract.h @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: exception-abstract.h - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: Nicolas Mansard * * Version control @@ -33,7 +33,7 @@ // Uncomment this macros to have lines parameter on the throw display -// #define SOT_EXCEPTION_PASSING_PARAM +// #define DYNAMIC-GRAPH_EXCEPTION_PASSING_PARAM /* --------------------------------------------------------------------- */ /* --- CLASS ----------------------------------------------------------- */ @@ -91,7 +91,7 @@ public: DYNAMICGRAPH_EXPORT friend std::ostream & operator << (std::ostream & os, const ExceptionAbstract & err); -#ifdef SOT_EXCEPTION_PASSING_PARAM +#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM public: class Param { @@ -120,7 +120,7 @@ public: template<class Exc> friend Exc& operator+ ( const ExceptionAbstract::Param& p, Exc& e ) { e.p.initCopy(p); return e; } -#endif //#ifdef SOT_EXCEPTION_PASSING_PARAM +#endif //#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM }; } // namespace dynamicgraph @@ -129,11 +129,11 @@ public: -#ifdef SOT_EXCEPTION_PASSING_PARAM +#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM # define DG_THROW throw ExceptionAbstract::Param(__LINE__,__FUNCTION__,__FILE__) + -#else //#ifdef SOT_EXCEPTION_PASSING_PARAM +#else //#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM # define DG_THROW throw -#endif //#ifdef SOT_EXCEPTION_PASSING_PARAM +#endif //#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM #endif /* #ifndef __ABSTRACT_EXCEPTION_H */ diff --git a/include/dynamic-graph/exception-factory.h b/include/dynamic-graph/exception-factory.h index ea5f60e0506ffa9acfc45c496531fc46d6c195f2..20176761144ffac4fae6eb4e9ae05a6966bb0109 100644 --- a/include/dynamic-graph/exception-factory.h +++ b/include/dynamic-graph/exception-factory.h @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: sotExceptionFactory.h - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: Nicolas Mansard * * Version control diff --git a/include/dynamic-graph/exception-signal.h b/include/dynamic-graph/exception-signal.h index 9834b31c0f2724692b8da17b25b45c9495125b42..fb3d272c17594092385cba934deb7f287b031d0b 100644 --- a/include/dynamic-graph/exception-signal.h +++ b/include/dynamic-graph/exception-signal.h @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: sotexception-signal.h - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: Nicolas Mansard * * Version control diff --git a/include/dynamic-graph/factory.h b/include/dynamic-graph/factory.h index bb679d06be2bd5feec76da738a85bc7bd70565e8..13d5a63451a7fa940026116d69a2454dc1e7818c 100644 --- a/include/dynamic-graph/factory.h +++ b/include/dynamic-graph/factory.h @@ -2,8 +2,8 @@ * Copyright Projet JRL-Japan, 2007 *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * - * File: factory.h - * Project: SOT + * File: g_factory.h + * Project: DYNAMIC-GRAPH * Author: François Bleibel (from Nicolas Mansard) * * Version control @@ -30,7 +30,7 @@ #include <map> #include <string> -/* --- SOT --- */ +/* --- DYNAMIC-GRAPH --- */ #include <dynamic-graph/exception-factory.h> #include <dynamic-graph/dynamic-graph-api.h> @@ -78,7 +78,7 @@ class DYNAMICGRAPH_EXPORT FactoryStorage }; -DYNAMICGRAPH_EXPORT extern FactoryStorage factory; +DYNAMICGRAPH_EXPORT extern FactoryStorage g_factory; /* --- REGISTERER ----------------------------------------------------------- */ /* --- REGISTERER ----------------------------------------------------------- */ @@ -105,8 +105,8 @@ class DYNAMICGRAPH_EXPORT EntityRegisterer }; /*! This macro should be used to automatically register an entity - * of classType to the factory. It is then possible to create it - * with the factory. + * of classType to the g_factory. It is then possible to create it + * with the g_factory. */ #define DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(classType,className) \ const std::string classType::CLASS_NAME = className; \ diff --git a/include/dynamic-graph/interpreter.h b/include/dynamic-graph/interpreter.h index e2aff77d5beb48f9d9677661cb171691a3085bc6..756963427b47efe62c27347ccfcbfbb201b090b2 100644 --- a/include/dynamic-graph/interpreter.h +++ b/include/dynamic-graph/interpreter.h @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: interpreter.h - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: François Bleibel (from Nicolas Mansard) * * Version control @@ -26,7 +26,7 @@ /* --- INCLUDE --------------------------------------------------------- */ /* --------------------------------------------------------------------- */ -/* SOT */ +/* DYNAMIC-GRAPH */ #include <dynamic-graph/signal-base.h> #include <dynamic-graph/exception-factory.h> #include <dynamic-graph/pool.h> @@ -185,7 +185,7 @@ class DYNAMICGRAPH_EXPORT Interpreter /* -------------------------------------------------------------------------- */ /*! \brief Class for automatic registration of shell functions. - * Use the macro SOT_SHELL_FUNCTION_REGISTERER(name, fun) in a .cpp file + * Use the macro DYNAMIC-GRAPH_SHELL_FUNCTION_REGISTERER(name, fun) in a .cpp file * to register functions on plugin load. */ class DYNAMICGRAPH_EXPORT ShellFunctionRegisterer @@ -201,7 +201,7 @@ public: ShellFunctionRegisterer reg( name,boost::bind(fun,_1,_2,_3) );\ } -DYNAMICGRAPH_EXPORT extern Interpreter Shell; +DYNAMICGRAPH_EXPORT extern Interpreter g_shell; } // namespace dynamicgraph diff --git a/include/dynamic-graph/plugin-loader.h b/include/dynamic-graph/plugin-loader.h index 8fbf85925ab55e0798454868d5964d0b30119c3b..f86f63537d26abf628cc380e4bbda9ffcde0a327 100644 --- a/include/dynamic-graph/plugin-loader.h +++ b/include/dynamic-graph/plugin-loader.h @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: plugin-loader.h - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: François Bleibel (from Nicolas Mansard) * * Version control @@ -31,7 +31,7 @@ #include <string> #include <map> -/* --- SOT --- */ +/* --- DYNAMIC-GRAPH --- */ #include <dynamic-graph/exception-factory.h> #include <dynamic-graph/dynamic-graph-api.h> diff --git a/include/dynamic-graph/pool.h b/include/dynamic-graph/pool.h index d9d41d1bfe9b77669bc730a06de46f0d2b424fd5..aed4aeb2fb146a26bec978125b98afedf9102eb1 100644 --- a/include/dynamic-graph/pool.h +++ b/include/dynamic-graph/pool.h @@ -2,8 +2,8 @@ * Copyright Projet JRL-Japan, 2007 *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * - * File: pool.h - * Project: SOT + * File: g_pool.h + * Project: DYNAMIC-GRAPH * Author: François Bleibel (from Nicolas Mansard) * * Version control @@ -29,7 +29,7 @@ #include <string> #include <sstream> -/* --- SOT --- */ +/* --- DYNAMIC-GRAPH --- */ #include <dynamic-graph/exception-factory.h> #include <dynamic-graph/signal-base.h> #include <dynamic-graph/dynamic-graph-api.h> @@ -119,8 +119,8 @@ class DYNAMICGRAPH_EXPORT PoolStorage If the method of the object displays some information this will be done on os. - The commands specific to the <b>pool<\b> object are: - \li <b>list</b> : List all the entities registered in the pool.s + The commands specific to the <b>g_pool<\b> object are: + \li <b>list</b> : List all the entities registered in the g_pool.s */ void commandLine( const std::string& objectName,const std::string& functionName, std::istringstream& cmdArg, std::ostream& os ); @@ -130,7 +130,7 @@ class DYNAMICGRAPH_EXPORT PoolStorage void writeCompletionList(std::ostream& os); }; -DYNAMICGRAPH_EXPORT extern dynamicgraph::PoolStorage pool; +DYNAMICGRAPH_EXPORT extern dynamicgraph::PoolStorage g_pool; } // namespace dynamicgraph diff --git a/include/dynamic-graph/shell-functions.h b/include/dynamic-graph/shell-functions.h index 6bbd73af348e7075152e3141a2f7ca372d8b2f55..5a9286d2d2d13ddb034bf2092292426769fc7e14 100644 --- a/include/dynamic-graph/shell-functions.h +++ b/include/dynamic-graph/shell-functions.h @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: shell-functions.h - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: François Bleibel (from Nicolas Mansard) * * Version control @@ -26,7 +26,7 @@ /* --- INCLUDE --------------------------------------------------------- */ /* --------------------------------------------------------------------- */ -/* SOT */ +/* DYNAMIC-GRAPH */ #include <dynamic-graph/exception-factory.h> #include <dynamic-graph/interpreter.h> @@ -94,4 +94,4 @@ class SHELLFUNCTIONS_EXPORT ShellFunctions }; -#endif //#ifndef __SOT_SHELL_FUNCTIONS_HH__ +#endif //#ifndef __DYNAMIC-GRAPH_SHELL_FUNCTIONS_HH__ diff --git a/include/dynamic-graph/shell-procedure.h b/include/dynamic-graph/shell-procedure.h index 6343c96388ada6d72e6d6a820bb71574bf5de268..0ef75a924043934668ef727992ee4e2a81898a60 100644 --- a/include/dynamic-graph/shell-procedure.h +++ b/include/dynamic-graph/shell-procedure.h @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: shell-procedure.h - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: François Bleibel (from Nicolas Mansard) * * Version control @@ -26,7 +26,7 @@ /* --- INCLUDE --------------------------------------------------------- */ /* --------------------------------------------------------------------- */ -/* SOT */ +/* DYNAMIC-GRAPH */ #include <dynamic-graph/exception-factory.h> #include <dynamic-graph/interpreter.h> @@ -74,18 +74,18 @@ class ShellProcedure_EXPORT ShellProcedure std::vector<std::string> args; std::vector<int> params; }; - struct sotProcedure { + struct Procedure { std::list< Instruction > instructions; std::vector< std::string > params; void clear() { instructions.clear(); params.clear(); } }; - typedef std::map< std::string,sotProcedure > ProcedureList; + typedef std::map< std::string,Procedure > ProcedureList; public: std::string procName; ProcedureList procedureList; - sotProcedure currentProc; + Procedure currentProc; public: @@ -104,4 +104,4 @@ class ShellProcedure_EXPORT ShellProcedure -#endif //#ifndef __SOT_SHELL_PROCEDURE_HH__ +#endif //#ifndef __DYNAMIC-GRAPH_SHELL_PROCEDURE_HH__ diff --git a/include/dynamic-graph/signal-array.h b/include/dynamic-graph/signal-array.h index d4293400d2693a7ce8cf48a47a162712b96c309d..2a4d53a394813cd6375efe682de0bc9ac55281ab 100644 --- a/include/dynamic-graph/signal-array.h +++ b/include/dynamic-graph/signal-array.h @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: SignalArray.h - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: Nicolas Mansard * * Version control @@ -85,15 +85,6 @@ class SignalArray_const virtual const SignalBase<Time>& operator[] ( const unsigned int& idx ) const { return *const_array[idx]; } virtual unsigned int getSize( void ) const { return rank; } - -/* SignalArray_const<Time>& operator= ( SignalArray<Time> & siga ) */ -/* { */ -/* for( unsigned int i=0;i<rank;++i ) const_array[i]=&siga[i]; */ -/* rank=siga.getSize(); */ -/* } */ - - - // friend class SignalArray<Time>; }; @@ -173,7 +164,12 @@ class SignalArray template<class Time> SignalArray<Time> operator<<( SignalBase<Time>& sig1, SignalBase<Time>& sig2 ) -{ SignalArray<Time> res(20); res<<sig1; res<<sig2; return res;} +{ + SignalArray<Time> res(20); + res<<sig1; + res<<sig2; + return res; +} DYNAMICGRAPH_EXPORT extern SignalArray<int> sotNOSIGNAL; diff --git a/include/dynamic-graph/signal-base.h b/include/dynamic-graph/signal-base.h index dc7d8167c4f0572d895f399a7401bbf6ede85f4a..09b2c404ca94bca74da4abb92e30b866a0d0881b 100644 --- a/include/dynamic-graph/signal-base.h +++ b/include/dynamic-graph/signal-base.h @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: signal-base.h - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: Nicolas Mansard * * Version control diff --git a/include/dynamic-graph/signal-caster.h b/include/dynamic-graph/signal-caster.h index 3c5700c4ddf5ef8e57f2ca5ad7280cdb7d53f4d8..1f65c7355290193d8e68eee8af0de34033132115 100644 --- a/include/dynamic-graph/signal-caster.h +++ b/include/dynamic-graph/signal-caster.h @@ -2,7 +2,7 @@ * SignalCaster.h * * Created on: Jun 14, 2010 - * Author: blue + * Author: Francois Bleibel */ #ifndef SIGNALCASTER_H_ diff --git a/include/dynamic-graph/signal-ptr.h b/include/dynamic-graph/signal-ptr.h index 9506765c2eb9787f225b88e76edf5c9d8bac3f1b..94799d4b6dac259ccf0d42939296160c6af919e6 100644 --- a/include/dynamic-graph/signal-ptr.h +++ b/include/dynamic-graph/signal-ptr.h @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: SignalPtr.h - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: Nicolas Mansard * * Version control diff --git a/include/dynamic-graph/signal-ptr.t.cpp b/include/dynamic-graph/signal-ptr.t.cpp index 4763128256425633cbe64c9387fa6c597466c1c4..a0bcd64067ce7aa5862836d3a7220cfd426b7633 100644 --- a/include/dynamic-graph/signal-ptr.t.cpp +++ b/include/dynamic-graph/signal-ptr.t.cpp @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: SignalPtr.t.cpp - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: Nicolas Mansard * * Version control @@ -29,7 +29,7 @@ #define VP_TEMPLATE_DEBUG_MODE 0 #include <dynamic-graph/debug.h> -using namespace dynamicgraph; +namespace dynamicgraph { template< class T,class Time > bool SignalPtr<T,Time>:: @@ -262,6 +262,7 @@ displayDependancies( std::ostream& os,const int depth, return os; } +} // namespace dynamicgraph #endif // #ifndef __SIGNAL_PTR_TCPP diff --git a/include/dynamic-graph/signal-time-dependant.h b/include/dynamic-graph/signal-time-dependant.h index 06cbc09d92ce35a3a859fad717e57505a3fe2b15..0d08eaa1f8442ad0ba5609d36cf56fb2e1fb9ba1 100644 --- a/include/dynamic-graph/signal-time-dependant.h +++ b/include/dynamic-graph/signal-time-dependant.h @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: signal-time-dependant.h - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: Nicolas Mansard * * Version control diff --git a/include/dynamic-graph/signal.h b/include/dynamic-graph/signal.h index 551c46efc2de1b75167307bcbdc92628ddcdd7e5..9c0e3e92f0dcbca048919746229f795a1a80dfb5 100644 --- a/include/dynamic-graph/signal.h +++ b/include/dynamic-graph/signal.h @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: Signal.h - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: Nicolas Mansard * * Version control diff --git a/include/dynamic-graph/signal.t.cpp b/include/dynamic-graph/signal.t.cpp index f6859b97518b83a2200294f5185100dac2bf52e9..0d00e7d2886ab8a7ab1c8f7c3358d872b1749a93 100644 --- a/include/dynamic-graph/signal.t.cpp +++ b/include/dynamic-graph/signal.t.cpp @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: Signal.t.cpp - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: Nicolas Mansard * * Version control @@ -30,7 +30,7 @@ #define VP_TEMPLATE_DEBUG_MODE 0 #include <dynamic-graph/debug.h> -using namespace dynamicgraph; +namespace dynamicgraph { #define __SIGNAL_INIT(name,Tcpy,Tref,TrefNC,mutex) \ SignalBase<Time>(name) \ @@ -327,6 +327,8 @@ display (std::ostream& os) const return os<<")"; } +} // namespace dynamicgraph + #endif // #ifndef __SIGNAL_TEMPLATE /* diff --git a/include/dynamic-graph/time-dependency.h b/include/dynamic-graph/time-dependency.h index aabb3be422fc84a4645a101a56e3344e60a807e1..3a4f1ec3a82c19396e45f3c5551b24ebdc564683 100644 --- a/include/dynamic-graph/time-dependency.h +++ b/include/dynamic-graph/time-dependency.h @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: TimeDependancy.h - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: Nicolas Mansard * * Version control @@ -29,6 +29,9 @@ #include <dynamic-graph/signal-base.h> #include <dynamic-graph/signal-array.h> +namespace dynamicgraph { + + template< class Time > class TimeDependancy { @@ -90,6 +93,9 @@ class TimeDependancy }; +} // namespace dynamicgraph + + #include <dynamic-graph/time-dependency.t.cpp> #endif /* #ifndef __TIME_DEPENDANCY_HH */ diff --git a/include/dynamic-graph/time-dependency.t.cpp b/include/dynamic-graph/time-dependency.t.cpp index 9df41c31a4f7c9c90e38f3523758b51850062237..de3000f681d78780ba394f55d2a40f1d1c302f5a 100644 --- a/include/dynamic-graph/time-dependency.t.cpp +++ b/include/dynamic-graph/time-dependency.t.cpp @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: TimeDependancy.t.cpp - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: Nicolas Mansard * * Version control @@ -25,7 +25,7 @@ #include <dynamic-graph/time-dependency.h> -using namespace dynamicgraph; +namespace dynamicgraph { #undef VP_TEMPLATE_DEBUG_MODE #define VP_TEMPLATE_DEBUG_MODE 0 @@ -176,7 +176,7 @@ displayDependancies( std::ostream& os,const int depth, return os; } - +} // namespace dynamicgraph #endif /* #ifndef __TIME_DEPENDANCY_TCPP */ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4d63eb70237293e23d8629e20f3ed88e15c4735f..25e674bb23e5c65288834919781cfb5be0782394 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -43,8 +43,8 @@ INSTALL(TARGETS ${LIBRARY_NAME} ### Plugins #################################### SET(plugins_list - dgraph/shell-functions - dgraph/shell-procedure + plugins/shell-functions + plugins/shell-procedure debug/contiifstream ) diff --git a/src/debug/contiifstream.cpp b/src/debug/contiifstream.cpp index 8118db0c5ffa060f6a815d4b9e349ff4b375a0e4..78c35579f6e07eaa86ab2514982bfb1988a61041 100644 --- a/src/debug/contiifstream.cpp +++ b/src/debug/contiifstream.cpp @@ -2,8 +2,8 @@ * Copyright Projet JRL-Japan, 2007 *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * - * File: sotContiifstream.cpp - * Project: SOT + * File: Contiifstream.cpp + * Project: DYNAMIC-GRAPH * Author: Nicolas Mansard * * Version control @@ -20,19 +20,19 @@ #include <dynamic-graph/contiifstream.h> #include <dynamic-graph/debug.h> -sotContiifstream:: -sotContiifstream( const std::string& n ) +Contiifstream:: +Contiifstream( const std::string& n ) :filename(n),cursor(0),first(true) {} -sotContiifstream:: -~sotContiifstream( void ) +Contiifstream:: +~Contiifstream( void ) { dgDEBUGINOUT(5); } -bool sotContiifstream:: +bool Contiifstream:: loop( void ) { dgDEBUGIN(25); @@ -64,7 +64,7 @@ loop( void ) } std::string -sotContiifstream::next( void ) +Contiifstream::next( void ) { std::string res = *reader.begin(); reader.pop_front(); diff --git a/src/debug/debug.cpp b/src/debug/debug.cpp index 0f9ad48584aa563a8f4388fdefcc1ce36fca040b..e7b47ee1e52f85bf30650d6074f55a91724908cd 100644 --- a/src/debug/debug.cpp +++ b/src/debug/debug.cpp @@ -53,13 +53,13 @@ const char * DebugTrace::DEBUG_FILENAME_DEFAULT = "/tmp/traces_dynamicgraph.txt" #endif /*WIN32*/ #else std::ofstream dg_debugfile; //( "/dev/null", std::ios::trunc&std::ios::out ); - class __dgDebug_init + class dgDebug_init { public: - __dgDebug_init( void ) + dgDebug_init( void ) { dg_debugfile.setstate( std::ios::failbit ) ; /* dg_debugfile.close(); */ } }; - __dgDebug_init __dgDebug_initialisator; + dgDebug_init dgDebug_initialisator; #endif diff --git a/src/dgraph/entity.cpp b/src/dgraph/entity.cpp index 6503c5f48b926d33518f6f4e4ead5a1eb41cd86a..a2c27f41579c588acf03f80dbead763360d9c94a 100644 --- a/src/dgraph/entity.cpp +++ b/src/dgraph/entity.cpp @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: entity.cpp - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: François Bleibel (from Nicolas Mansard) * * Version control @@ -39,13 +39,13 @@ entityRegistration( void ) { //sotPool.entity[name] = this; - pool.registerEntity(name,this); + g_pool.registerEntity(name,this); } void Entity:: entityDeregistration( void ) { - pool.deregisterEntity(name); + g_pool.deregisterEntity(name); } Entity:: diff --git a/src/dgraph/factory.cpp b/src/dgraph/factory.cpp index 758f1664638c8c53b6f63331a75074af76dded2b..a8e5872d2f707c18a00abac6bc34d879801e5402 100644 --- a/src/dgraph/factory.cpp +++ b/src/dgraph/factory.cpp @@ -3,8 +3,8 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: factory.cpp - * Project: SOT - * Author: François Bleibel (from Nicolas Mansard) + * Project: DYNAMIC-GRAPH + * Author: François Bleibel, Nicolas Mansard * * Version control * =============== @@ -22,7 +22,7 @@ /* --- INCLUDE --------------------------------------------------------- */ /* --------------------------------------------------------------------- */ -/* --- SOT --- */ +/* --- DYNAMIC-GRAPH --- */ #include <dynamic-graph/debug.h> #include <dynamic-graph/factory.h> @@ -52,7 +52,7 @@ registerEntity( const std::string& entname,FactoryStorage::EntityConstructor_ptr { // DG_THROW ExceptionFactory( ExceptionFactory::OBJECT_CONFLICT, // "Another entity class already defined with the same name. ", -// "(while adding entity class <%s> inside the factory).", +// "(while adding entity class <%s> inside the g_factory).", // entname.c_str() ); dgERRORF("Another entity class already defined with the same name. " "(while adding entity class <%s> inside the factory).", @@ -127,7 +127,7 @@ EntityRegisterer( const std::string& entityClassName, :entityName( entityClassName ) { dgDEBUGIN(15); - factory.registerEntity(entityClassName,maker); + g_factory.registerEntity(entityClassName,maker); dgDEBUGOUT(15); } @@ -136,7 +136,7 @@ EntityRegisterer:: { dgDEBUGIN(15); - factory.deregisterEntity(entityName); + g_factory.deregisterEntity(entityName); dgDEBUGOUT(15); } @@ -174,6 +174,6 @@ commandLine( const std::string& cmdLine,std::istringstream& cmdArgs, } namespace dynamicgraph { - //! The global factory object. - FactoryStorage factory; + //! The global g_factory object. + FactoryStorage g_factory; } diff --git a/src/dgraph/interpreter.cpp b/src/dgraph/interpreter.cpp index 133e42f6f0ec7e9b81cf533c30f457ae160f35e3..92bde1d568aa1bb3863b7f57ce145850b7a87869 100644 --- a/src/dgraph/interpreter.cpp +++ b/src/dgraph/interpreter.cpp @@ -3,8 +3,8 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: interpretor.cpp - * Project: SOT - * Author: François Bleibel (from Nicolas Mansard) + * Project: DYNAMIC-GRAPH + * Author: François Bleibel, Nicolas Mansard * * Version control * =============== @@ -22,7 +22,7 @@ /* --- INCLUDE --------------------------------------------------------- */ /* --------------------------------------------------------------------- */ -/* SOT */ +/* DYNAMIC-GRAPH */ #include <dynamic-graph/interpreter.h> #include <dynamic-graph/plugin-loader.h> #include <dynamic-graph/debug.h> @@ -121,12 +121,12 @@ cmdPlug( const std::string& cmdLine, istringstream& cmdArg, std::ostream& os ) } dgDEBUG(20) << "Get Ent1 <"<<obj1<<"> ."<<endl; - Entity& ent1 = pool.getEntity(obj1); + Entity& ent1 = g_pool.getEntity(obj1); dgDEBUG(20) << "Get Sig1 <"<<fun1<<"> ."<<endl; SignalBase<int> &sig1 = ent1.getSignal(fun1); dgDEBUG(20) << "Get Ent2 <"<<obj2<<"> ."<<endl; - Entity& ent2 = pool.getEntity(obj2); + Entity& ent2 = g_pool.getEntity(obj2); dgDEBUG(20) << "Get Sig2 <"<<fun2<<"> ."<<endl; SignalBase<int> &sig2 = ent2.getSignal(fun2); @@ -147,10 +147,10 @@ cmdNew( const std::string& cmdLine, istringstream& cmdArg, std::ostream& os ) string objName; cmdArg >> className >>objName; dgDEBUG(15) << "New <" << className<<"> requested."<<endl; - if( factory.existEntity( className ) ) + if( g_factory.existEntity( className ) ) { dgDEBUG(15) << "New entity<"<<className<<"> " <<objName<<std::endl; - factory.newEntity(className,objName); + g_factory.newEntity(className,objName); } else os << " !! Class <" << className << "> does not exist."<<endl; } @@ -167,7 +167,7 @@ cmdDestroy( const std::string& cmdLine, istringstream& cmdArg, std::ostream& os } string objName; cmdArg >> objName; dgDEBUG(15) << "Destroy <" << objName <<"> requested."<<endl; - delete &( pool.getEntity( objName ) ); + delete &( g_pool.getEntity( objName ) ); } @@ -334,7 +334,7 @@ cmdSetSignal( const std::string& cmdLine, std::istringstream& cmdArg, std::ostre string objname,signame; objectNameParser(cmdArg,objname,signame); - Entity& obj = pool.getEntity(objname); + Entity& obj = g_pool.getEntity(objname); SignalBase<int>& sig = obj.getSignal( signame ); cmdArg >> ws; @@ -357,7 +357,7 @@ cmdGetSignal( const std::string& cmdLine, std::istringstream& cmdArg, std::ostre string objname,signame; objectNameParser(cmdArg,objname,signame); - Entity& obj = pool.getEntity(objname); + Entity& obj = g_pool.getEntity(objname); SignalBase<int>& sig = obj.getSignal( signame ); os << signame << " = "; sig.get( os ); @@ -379,7 +379,7 @@ cmdComputeSignal( const std::string& cmdLine, std::istringstream& cmdArg, std::o string objname,signame; objectNameParser(cmdArg,objname,signame); - Entity& obj = pool.getEntity(objname); + Entity& obj = g_pool.getEntity(objname); SignalBase<int>& sig = obj.getSignal( signame ); int time; cmdArg >> std::ws; @@ -407,7 +407,7 @@ cmd( const std::string& cmdLine, istringstream& cmdArg, std::ostream& os ) else if( objectNameParser( cmdparse,obj,fun ) ) { dgDEBUG(15) << "Object <" << obj<< "> function <"<<fun<<">"<<endl; - pool.commandLine( obj,fun,cmdArg,os ); + g_pool.commandLine( obj,fun,cmdArg,os ); } else { @@ -486,7 +486,7 @@ ShellFunctionRegisterer( const std::string& funName, const Interpreter::ShellBasicFunction& f) { dgDEBUGIN(25); - Shell.registerFunction(funName,f); + g_shell.registerFunction(funName,f); dgDEBUGOUT(25); } @@ -505,7 +505,7 @@ void Interpreter::writeCompletionList(std::ostream& os) } namespace dynamicgraph { -//! The global Shell object. - Interpreter Shell; +//! The global g_shell object. + Interpreter g_shell; } diff --git a/src/dgraph/plugin-loader.cpp b/src/dgraph/plugin-loader.cpp index c78f428928e0eca144310bd56c1b4ee4fa3e5e55..719d1923c0fdfda303782126e27fe25c8aa13676 100644 --- a/src/dgraph/plugin-loader.cpp +++ b/src/dgraph/plugin-loader.cpp @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: plugin-loader.cpp - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: François Bleibel (from Nicolas Mansard) * * Version control @@ -28,7 +28,7 @@ #include <dlfcn.h> #endif -/* --- SOT --- */ +/* --- DYNAMIC-GRAPH --- */ #include <dynamic-graph/plugin-loader.h> #include <dynamic-graph/debug.h> diff --git a/src/dgraph/pool.cpp b/src/dgraph/pool.cpp index 38bd228235063eb89576547021f3072607790e1b..cdab5d09015dd1531cf017ee0ecbb57d2f1fc25e 100644 --- a/src/dgraph/pool.cpp +++ b/src/dgraph/pool.cpp @@ -3,8 +3,8 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: pool.cpp - * Project: SOT - * Author: François Bleibel (from Nicolas Mansard) + * Project: DYNAMIC-GRAPH + * Author: François Bleibel, Nicolas Mansard * * Version control * =============== @@ -21,7 +21,7 @@ /* --- INCLUDE --------------------------------------------------------- */ /* --------------------------------------------------------------------- */ -/* --- SOT --- */ +/* --- DYNAMIC-GRAPH --- */ #include <dynamic-graph/pool.h> #include <dynamic-graph/debug.h> #include <dynamic-graph/entity.h> @@ -264,7 +264,7 @@ getSignal( std::istringstream& sigpath ) namespace dynamicgraph { - //! The global pool object. - PoolStorage pool; + //! The global g_pool object. + PoolStorage g_pool; } diff --git a/src/exception/exception-abstract.cpp b/src/exception/exception-abstract.cpp index 10739d611e42cfeafd39d0c243f19fc767f3bb15..923e649ba3991fe5ecf4529b62dd2942ac598494 100644 --- a/src/exception/exception-abstract.cpp +++ b/src/exception/exception-abstract.cpp @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: ExceptionAbstract.cpp - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: Nicolas Mansard * * Version control @@ -70,7 +70,7 @@ getCode (void) /* ------------------------------------------------------------------------- */ /* --- MODIFIORS ----------------------------------------------------------- */ /* ------------------------------------------------------------------------- */ -#ifdef SOT_EXCEPTION_PASSING_PARAM +#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM ExceptionAbstract::Param& ExceptionAbstract::Param:: @@ -94,7 +94,7 @@ Param( const int& _line, const char * _function, const char * _file ) { dgDEBUGINOUT(25); } -#endif //#ifdef SOT_EXCEPTION_PASSING_PARAM +#endif //#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM /* ------------------------------------------------------------------------- */ /* --- OP << --------------------------------------------------------------- */ @@ -108,11 +108,11 @@ operator << (ostream & os, { os << error.getExceptionName()<<"Error [#" << error.code << "]: " << error.message << endl; -#ifdef SOT_EXCEPTION_PASSING_PARAM +#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM if( error.p.set ) os << "Thrown from "<<error.p.file << ": "<<error.p.function <<" (#"<<error.p.line << ")"<<endl; -#endif //#ifdef SOT_EXCEPTION_PASSING_PARAM +#endif //#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM return os; } diff --git a/src/exception/exception-factory.cpp b/src/exception/exception-factory.cpp index c54eda0114cd2683c9ba22fd61ebaaffbf66ca9f..b928a4278c8a91218a924ffa1b50300ead5422e2 100644 --- a/src/exception/exception-factory.cpp +++ b/src/exception/exception-factory.cpp @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: ExceptionFactory.cpp - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: Nicolas Mansard * * Version control diff --git a/src/exception/exception-signal.cpp b/src/exception/exception-signal.cpp index 82ff22201ff58882462b2ca058fb791c33e44587..acdfa7043a0ae2669e0a54366f39d3c7412e646c 100644 --- a/src/exception/exception-signal.cpp +++ b/src/exception/exception-signal.cpp @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: ExceptionSignal.cpp - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: Nicolas Mansard * * Version control diff --git a/src/dgraph/shell-functions.cpp b/src/plugins/shell-functions.cpp similarity index 89% rename from src/dgraph/shell-functions.cpp rename to src/plugins/shell-functions.cpp index 868db2c62d409dc811abc78f65514ba03148e191..069d0024b1aa3d1720d1c4fe46719050bbd26c20 100644 --- a/src/dgraph/shell-functions.cpp +++ b/src/plugins/shell-functions.cpp @@ -3,8 +3,8 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: shell-functions.cpp - * Project: SOT - * Author: François Bleibel (from Nicolas Mansard) + * Project: DYNAMIC-GRAPH + * Author: François Bleibel, Nicolas Mansard * * Version control * =============== @@ -46,7 +46,7 @@ cmdTry( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) cmdArg>>cmdLine2; dgDEBUG(5)<<"Try <" <<cmdLine2<<">"<<endl; try{ - Shell.cmd(cmdLine2,cmdArg,os); + g_shell.cmd(cmdLine2,cmdArg,os); } catch ( const ExceptionAbstract& e ) { os << "dgERROR catch: " <<endl<< e<<endl; } catch( ... ) { os<<"Unknown error catch." <<endl; } @@ -60,15 +60,15 @@ cmdLoadPlugins( const std::string cmdLine, std::istringstream& cmdArg, std::ostr << "\t\tLoad the plugins listed in the file." <<endl; return; } - if( NULL!=Shell.dlPtr ) + if( NULL!=g_shell.dlPtr ) { string pluginName,directory; cmdArg >> pluginName; cmdArg >> directory; dgDEBUG(15) << "Load plugin list <" <<pluginName<<"> from dir <" << directory<<">."<<endl; - if( directory.length() != 0 ) Shell.dlPtr->setDirectory( directory ); - Shell.dlPtr ->loadPluginList( pluginName ); - Shell.dlPtr->loadPlugins(); + if( directory.length() != 0 ) g_shell.dlPtr->setDirectory( directory ); + g_shell.dlPtr ->loadPluginList( pluginName ); + g_shell.dlPtr->loadPlugins(); } else { os << "!! Dynamic loading functionalities not accessible through the shell." <<endl; } } @@ -84,7 +84,7 @@ cmdClearPlugin( const std::string cmdLine, std::istringstream& cmdArg, std::ostr string pluginName; cmdArg >> pluginName; - pool.clearPlugin( pluginName ); + g_pool.clearPlugin( pluginName ); } @@ -97,9 +97,9 @@ cmdDisplayPlugins( const std::string cmdLine, std::istringstream& cmdArg, std::o << "\t\t\t\tDisplay the name of the loaded plugins." <<endl; return; } - if( NULL!=Shell.dlPtr ) + if( NULL!=g_shell.dlPtr ) { - std::map< std::string,std::string > m = Shell.dlPtr->getLoadedPluginNames(); + std::map< std::string,std::string > m = g_shell.dlPtr->getLoadedPluginNames(); for( std::map< std::string,std::string >::const_iterator iter = m.begin(); iter!=m.end(); ++iter ) { @@ -120,12 +120,12 @@ cmdDisplayFactory( const std::string cmdLine, std::istringstream& cmdArg, { if( cmdLine == "help" ) { - os << " - "; factory.commandLine(cmdLine,cmdArg,os); + os << " - "; g_factory.commandLine(cmdLine,cmdArg,os); return; } string cmd2; cmdArg >> cmd2; - factory.commandLine( cmd2,cmdArg,os ); + g_factory.commandLine( cmd2,cmdArg,os ); } void ShellFunctions:: @@ -159,7 +159,7 @@ cmdUnplug( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) } dgDEBUG(20) << "Get Ent2 <"<<obj2<<"> ."<<endl; - Entity& ent2 = pool.getEntity(obj2); + Entity& ent2 = g_pool.getEntity(obj2); dgDEBUG(20) << "Get Sig2 <"<<fun2<<"> ."<<endl; SignalBase<int> &sig2 = ent2.getSignal(fun2); @@ -191,7 +191,7 @@ cmdSignalTime( const std::string cmdLine, istringstream& cmdArg, std::ostream& o } dgDEBUG(20) << "Get Ent2 <"<<obj2<<"> ."<<endl; - Entity& ent2 = pool.getEntity(obj2); + Entity& ent2 = g_pool.getEntity(obj2); dgDEBUG(20) << "Get Sig2 <"<<fun2<<"> ."<<endl; SignalBase<int> &sig2 = ent2.getSignal(fun2); @@ -208,7 +208,7 @@ cmdSynchroSignal( const std::string cmdLine, std::istringstream& cmdArg, std::os return; } - SignalBase<int> & sig = pool.getSignal( cmdArg ); + SignalBase<int> & sig = g_pool.getSignal( cmdArg ); cmdArg >>ws; if( cmdArg.good() ) { @@ -265,8 +265,8 @@ cmdCopy( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) istringstream str1(ssig1),str2(ssig2); try { - SignalBase<int> &sig1 = pool.getSignal( str1 ); - SignalBase<int> &sig2 = pool.getSignal( str2 ); + SignalBase<int> &sig1 = g_pool.getSignal( str1 ); + SignalBase<int> &sig2 = g_pool.getSignal( str2 ); dgDEBUG(25) << "Copy..."<<endl; sig2.plug(&sig1); @@ -297,7 +297,7 @@ cmdFreeze( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) istringstream str1(ssig1); try { - SignalBase<int> &sig1 = pool.getSignal( str1 ); + SignalBase<int> &sig1 = g_pool.getSignal( str1 ); dgDEBUG(25) << "Unplug..."<<endl; sig1.setConstantDefault(); @@ -319,16 +319,6 @@ cmdSqueeze( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) << "\t\tIntercalate squeezeObj between mainObj and its source." <<endl; return; } - -// bool target; -// { -// string source; cmdArg >> ws >> source; -// if( source=="source" ) { target=false; } -// else if( source=="target" ) { target=true; } -// else DG_THROW ExceptionFactory( ExceptionFactory::SYNTAX_ERROR, -// "Squeeze: first arg should be source or target", -// "(while calling squeeze %s ).",source.c_str()); -// } string ssigMain,ssigIn,ssigOut; cmdArg>>ssigMain>>ssigIn>>ssigOut; @@ -337,9 +327,9 @@ cmdSqueeze( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) istringstream strOut(ssigOut); try { - SignalBase<int> &sigMain = pool.getSignal(strMain ); - SignalBase<int> &sigIn = pool.getSignal( strIn ); - SignalBase<int> &sigOut = pool.getSignal( strOut ); + SignalBase<int> &sigMain = g_pool.getSignal(strMain ); + SignalBase<int> &sigIn = g_pool.getSignal( strIn ); + SignalBase<int> &sigOut = g_pool.getSignal( strOut ); SignalBase<int> *sigMainSource = sigMain.getPluged(); if( sigMainSource==&sigMain ) @@ -417,8 +407,8 @@ cmdSetPrompt( const std::string cmdLine, istringstream& cmdArg, std::ostream& os if( cmdArg. good() ) { char buffer [80]; cmdArg .getline(buffer,80); - Shell .prompt = buffer; - } else { os << "Current prompt is <" << Shell. prompt << ">." << endl; } + g_shell .prompt = buffer; + } else { os << "Current prompt is <" << g_shell. prompt << ">." << endl; } } void ShellFunctions:: @@ -472,7 +462,7 @@ cmdCompletionList( const std::string cmdLine, istringstream& cmdArg, std::ostrea std::string aFileName; cmdArg >> aFileName; std::ofstream completionFile((char *)aFileName.c_str()); - pool.writeCompletionList( completionFile ); + g_pool.writeCompletionList( completionFile ); } catch( ExceptionAbstract & err ) { throw; } diff --git a/src/dgraph/shell-procedure.cpp b/src/plugins/shell-procedure.cpp similarity index 87% rename from src/dgraph/shell-procedure.cpp rename to src/plugins/shell-procedure.cpp index 42bb88425448055116b3511f47a2cb0e4286dc47..3a3a6f344dacf419c4b22ad4ea039fefe01ee642 100644 --- a/src/dgraph/shell-procedure.cpp +++ b/src/plugins/shell-procedure.cpp @@ -3,8 +3,8 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: shell-procedure.cpp - * Project: SOT - * Author: François Bleibel (from Nicolas Mansard) + * Project: DYNAMIC-GRAPH + * Author: François Bleibel, Nicolas Mansard * * Version control * =============== @@ -65,10 +65,6 @@ cmdContinueProcedure( const std::string& cmdLine,std::istringstream& args,std::o dgDEBUG(5)<<"Proc <" <<procName<<">: "<<cmd2<<endl; Instruction ins; ins.cmd=cmd2; -// const unsigned int SIZE = 256; -// char buffer[SIZE]; args.getline(buffer,SIZE); -// dgDEBUG(5)<<"Proc <" <<procName<<"> arg= ["<<buffer<<"]"<<endl; -// ins.args=buffer; args >> ws; while( args.good() ) { @@ -97,7 +93,7 @@ cmdEndProcedure( const std::string& cmdLine,std::istringstream& args,std::ostrea procedureList[ procName ] = currentProc; // std::string toto="toto"; -// for( sotProcedure::iterator ins=procedureList[ toto ].begin(); +// for( Procedure::iterator ins=procedureList[ toto ].begin(); // ins!=procedureList[ toto ].end(); ++ins ) // { // dgDEBUG(15) << "Proc <" << procName << "> : " @@ -106,7 +102,7 @@ cmdEndProcedure( const std::string& cmdLine,std::istringstream& args,std::ostrea currentProc.clear(); - if( Shell.deregisterFunction( procName )) + if( g_shell.deregisterFunction( procName )) { os<< "Redefining proc <"<<procName<<">: procedure already defined. " << "Overwrite it."<<endl; } ShellFunctionRegisterer registration @@ -119,22 +115,6 @@ void ShellProcedure:: cmdProcedure( const std::string& procname, const std::string& cmdLine,std::istringstream& args,std::ostream& os ) { -// if( cmdLine == "help" ) -// { -// std::string procname; args >> procname; os<< procname<<endl; -// if(! args.good() ) -// { -// os << " - User defined procedures: "<<endl; -// for( ProcedureList::iterator iter=procedureList.begin(); -// iter!=procedureList.end(); ++iter ) -// os << " -> " << iter->first << endl; -// return; -// } -// else -// { -// os <<"Help on user defined procedure <" << procname << ">"<<std::endl; -// } -// } if( cmdLine == "help" ) { os<<" - "<<procname<<"\t\t\t\t\tUser-defined procedure"<<endl; @@ -158,7 +138,7 @@ cmdProcedure( const std::string& procname, argname.c_str() ); } - sotProcedure & proc = pair->second; + Procedure & proc = pair->second; unsigned int cmdnum=1; for( std::list<Instruction>::iterator ins=proc.instructions.begin(); ins!=proc.instructions.end(); ++ins ) @@ -192,7 +172,7 @@ cmdProcedure( const std::string& procname, * % -> endproc * % endproc */ - sotProcedure proc = pair->second; + Procedure proc = pair->second; std::vector< std::string > paramValue; for( unsigned int i=0;i<proc.params.size();++i ) @@ -222,7 +202,7 @@ cmdProcedure( const std::string& procname, dgDEBUG(15) << " Args = " << oss.str() << endl; iss.str(oss.str()); iss.clear(); - Shell.cmd(ins->cmd,iss,os); + g_shell.cmd(ins->cmd,iss,os); } } @@ -273,7 +253,7 @@ cmdFor( const std::string& cmdLine,std::istringstream& args,std::ostream& os ) if( insp == idx ) { oss << i << " "; } else { oss<<insp<< " "; } } iss.str( oss.str() ); - Shell.cmd(cmd2,iss,os); + g_shell.cmd(cmd2,iss,os); } } diff --git a/src/signal/signal-array.cpp b/src/signal/signal-array.cpp index 6b3604c1525ec6ea149cb605a67f7dab0af5c6ee..695117cb3a30d7dc363796ac3280b58655e93fee 100644 --- a/src/signal/signal-array.cpp +++ b/src/signal/signal-array.cpp @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: SignalArray.cpp - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: Nicolas Mansard * * Version control diff --git a/src/signal/signal-caster.cpp b/src/signal/signal-caster.cpp index 84f3f42ed9546dc9329641c39cad7c74d2b605a8..bc81627e00f4d70539e0dbc64a2e55ab5f3c541e 100644 --- a/src/signal/signal-caster.cpp +++ b/src/signal/signal-caster.cpp @@ -2,7 +2,7 @@ * SignalCaster.cpp * * Created on: Jun 14, 2010 - * Author: blue + * Author: François Bleibel, Nicolas Mansard */ #include <dynamic-graph/signal-caster.h> diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..a764fc21f8d8aa85e9f98cba4aa2e08b88c9bc58 --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,30 @@ +# +# Copyright +# + +### tools +SET(tools + test_shell +) + +FOREACH(tool_name ${tools}) + SET(EXECUTABLE_NAME ${tool_name}) + + ADD_DEFINITIONS(-DDEBUG=2) + + ADD_EXECUTABLE(${EXECUTABLE_NAME} + ${tool_name}.cpp) + + INCLUDE_DIRECTORIES( + ${CMAKE_CURRENT_SOURCE_DIR}/../include + ) + + LINK_DIRECTORIES(${${PROJECT_NAME}_BINARY_DIR}/lib) + + TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} + ${PROJECT_NAME} + dl) + + INSTALL(TARGETS ${tool_name} + DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/${PROJECT_NAME}) +ENDFOREACH(tool_name) \ No newline at end of file diff --git a/unitTesting/test_shell.cpp b/tools/test_shell.cpp similarity index 93% rename from unitTesting/test_shell.cpp rename to tools/test_shell.cpp index 11e8ee98020c4ea14f09ecf29265845c76ed1a2e..9e6a8eaec3995f26c6f92c045c7bd387f341122d 100644 --- a/unitTesting/test_shell.cpp +++ b/tools/test_shell.cpp @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: test_shell.cc - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: Nicolas Mansard * * Version control @@ -39,7 +39,7 @@ int main( int argc,char** argv ) dgDEBUG(5) << " Loading..." << endl; PluginLoader pl; - Shell.referencePluginLoader( &pl ); + g_shell.referencePluginLoader( &pl ); int fileIdx; try @@ -48,7 +48,7 @@ int main( int argc,char** argv ) { std::istringstream script( argv[fileIdx] ); cout << "Run "<< argv[fileIdx] << endl; - Shell.cmd( "run",script,cout ); + g_shell.cmd( "run",script,cout ); } } catch( ExceptionAbstract& e ) @@ -66,7 +66,7 @@ int main( int argc,char** argv ) try { dgDEBUG(5) << "Run shell." << endl; - Shell.shell(cin,cout); + g_shell.shell(cin,cout); dgDEBUG(5) << "Shell over." << endl; if( cin.eof() ) break; } diff --git a/unitTesting/CMakeLists.txt b/unitTesting/CMakeLists.txt index b59119d6943fd324e62685c21283f0c2023a6eab..57b60450cc381992e4adce1d4590c191bfcf2b87 100644 --- a/unitTesting/CMakeLists.txt +++ b/unitTesting/CMakeLists.txt @@ -4,10 +4,8 @@ ### tests SET(tests - test_shell test_pool test_depend - test_factory test_signalcast) FOREACH(test_name ${tests}) @@ -28,6 +26,5 @@ FOREACH(test_name ${tests}) ${PROJECT_NAME} dl) - INSTALL(TARGETS ${test_name} - DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/${PROJECT_NAME}) + ADD_TEST(NAME ${test_name} COMMAND ${test_name}) ENDFOREACH(test_name) \ No newline at end of file diff --git a/unitTesting/test_depend.cpp b/unitTesting/test_depend.cpp index 6f0bb2853936d99ff4687a516d4c5c078718ee39..13d2e54575a4ef92454eae12f512f69dfc0d6657 100644 --- a/unitTesting/test_depend.cpp +++ b/unitTesting/test_depend.cpp @@ -30,7 +30,7 @@ #include <string> using namespace std; - +using namespace dynamicgraph; diff --git a/unitTesting/test_factory.cpp b/unitTesting/test_factory.cpp deleted file mode 100644 index c471edf9d70280d6aa57b4e11dda1cfe362c5206..0000000000000000000000000000000000000000 --- a/unitTesting/test_factory.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Copyright Projet JRL-JAPAN, Tsukuba, 2007 - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * - * File: test_factory.cc - * Project: SOT - * Author: Nicolas Mansard - * - * Version control - * =============== - * - * $Id$ - * - * Description - * ============ - * - * - * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - -/* -------------------------------------------------------------------------- */ -/* --- INCLUDES ------------------------------------------------------------- */ -/* -------------------------------------------------------------------------- */ - - -#include <string> -#include <iostream> -#include <cstdlib> -#include <sstream> - -#include <dynamic-graph/factory.h> -#include <dynamic-graph/entity.h> -#include <dynamic-graph/debug.h> - - -using namespace std; -using namespace dynamicgraph; - -#ifdef WIN32 -#include <Windows.h> -#else -#include <dlfcn.h> -#endif - -#ifdef WIN32 - typedef HMODULE sotPluginKey; -#else - typedef void* sotPluginKey; -#endif - -int main() -{ - - dgDEBUG(0) << "# In {"<<endl; -// Entity test(""); -// sotExceptionFeature t2(sotExceptionFeature::BAD_INIT); -// sotExceptionSignal t4(sotExceptionSignal::COPY_NOT_INITIALIZED); -// sotFlags t3; -// TestFeature t5; - -#ifndef WIN32 - sotPluginKey dlib = dlopen("lib/plugin/sotFeatureVisualPoint.so", RTLD_NOW); -#else - sotPluginKey dlib = LoadLibrary ( "lib/plugin/sotFeatureVisualPoint.lib"); -#endif -if( NULL==dlib ) - { - cerr << " Error dl"<<endl; -#ifndef WIN32 - cerr << dlerror() <<endl; -#else - // Retrieve the system error message for the last-error code - LPTSTR pszMessage; - DWORD dwLastError = GetLastError(); - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - dwLastError, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR)&pszMessage, - 0, NULL ); - - - cerr << pszMessage <<endl; - LocalFree(pszMessage); -#endif - - exit(0); - } - - -#ifndef WIN32 - dlib = dlopen("lib/plugin/sotGainAdaptative.so", RTLD_NOW); -#else - dlib = LoadLibrary ("lib/plugin/sotGainAdaptative.lib"); -#endif - if( NULL==dlib ) - { - cout << "This test can only be run after the package StackOfTasks has been installed\n" - "Could not find sotGainAdaptive shared library" << endl; -#ifndef WIN32 - cerr << dlerror() <<endl; -#else - // Retrieve the system error message for the last-error code - LPTSTR pszMessage; - DWORD dwLastError = GetLastError(); - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - dwLastError, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR)&pszMessage, - 0, NULL ); - - - cerr << pszMessage <<endl; - LocalFree(pszMessage); -#endif - exit(0); - } - - Entity* gain = 0; - if ( !factory.existEntity("GainAdaptative") ) { - cout << "Could not find entity class 'GainAdaptative'" << endl; - exit(0); - } - else - gain = factory.newEntity("GainAdaptative","Gain"); - - - gain->display(cout); cout << endl; - cout <<gain->getClassName(); cout << endl; - - - dgDEBUG(0) << "# Out }"<<endl; -} - diff --git a/unitTesting/test_pool.cpp b/unitTesting/test_pool.cpp index 1f77fb6670ae38cbeb2a79caf41e7b9960ac58d7..074cfe2fe0b5bb911b5df839ae0ddcb7f2ed0380 100644 --- a/unitTesting/test_pool.cpp +++ b/unitTesting/test_pool.cpp @@ -68,8 +68,8 @@ main() { MyEntity myEntity("MyEntity"); cout << "-- Pool.list" << endl; - pool.commandLine("pool", "list", *auto_ptr<istringstream>(new istringstream("")), cout); - Entity& e = pool.getEntity("MyEntity"); + g_pool.commandLine("pool", "list", *auto_ptr<istringstream>(new istringstream("")), cout); + Entity& e = g_pool.getEntity("MyEntity"); cout << "-- Display" << endl; e.display(cout); } diff --git a/unitTesting/test_signalcast.cpp b/unitTesting/test_signalcast.cpp index 45f3c15dd5eecef5da46afd23c139911b807fce5..ff828358826f17e4270dd8d7bcb9f04266e11687 100644 --- a/unitTesting/test_signalcast.cpp +++ b/unitTesting/test_signalcast.cpp @@ -37,13 +37,15 @@ using namespace std; using namespace dynamicgraph; -main() { - Signal<int, int> mySignal("out"); - istringstream value("5"); +int main() { + Signal<double, int> mySignal("out"); + istringstream value("42.0"); cout << "[cast] Setting signal value to " << value.str() << endl; mySignal.set(value); // use "set" operation cout << "[disp] The value read is "; mySignal.get(cout); cout << "[trace] Printing out trace: "; mySignal.trace(cout); + + return 0; }