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/doc/additionalDoc/package.h b/doc/additionalDoc/package.h index be875a22a84afe1c0dc4f32849c7e686798ff574..4182e8235c59ae8beeb2ee23be4cff439c2b4033 100644 --- a/doc/additionalDoc/package.h +++ b/doc/additionalDoc/package.h @@ -3,14 +3,14 @@ \section intro_dynamicGraph Introduction -This code implements the factory design pattern, making creation of entities +This code implements the g_factory design pattern, making creation of entities available to packages depending on the dynamic-graph API. Objects, which are derived from Entities, can be declared within the code and compiled to shared libraries (.so/.dll files). These libraries can be loaded at run-time using the PluginLoader methods, and at the same time register their class names to the Factory (see the -examples in the SOT documentation to learn how). +examples in the DYNAMIC-GRAPH documentation to learn how). The Factory can then create instances of these objects and subsequently register them in the Pool, where they can be listed, accessed, and acted upon @@ -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/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-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..b89ca4b570ddad57e75cb1853579b81276f47537 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 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..1eeab4c51750317175cf054dbe39f2b09df1425e 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 diff --git a/include/dynamic-graph/time-dependency.h b/include/dynamic-graph/time-dependency.h index aabb3be422fc84a4645a101a56e3344e60a807e1..ca0cc3f1ec165dff2fc7ef72d72ee1ed788ae921 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 diff --git a/include/dynamic-graph/time-dependency.t.cpp b/include/dynamic-graph/time-dependency.t.cpp index 9df41c31a4f7c9c90e38f3523758b51850062237..e35c472c1f6dee465b1410b63537b73502732014 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 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/dgraph/shell-functions.cpp b/src/dgraph/shell-functions.cpp deleted file mode 100644 index 868db2c62d409dc811abc78f65514ba03148e191..0000000000000000000000000000000000000000 --- a/src/dgraph/shell-functions.cpp +++ /dev/null @@ -1,527 +0,0 @@ -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Copyright Projet JRL-Japan, 2007 - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * - * File: shell-functions.cpp - * Project: SOT - * Author: François Bleibel (from Nicolas Mansard) - * - * Version control - * =============== - * - * $Id$ - * - * Description - * ============ - * - * - * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - -#include <dynamic-graph/shell-functions.h> -#include <dynamic-graph/plugin-loader.h> -#include <dynamic-graph/factory.h> -#include <dynamic-graph/debug.h> -#include <dynamic-graph/entity.h> -#include <dynamic-graph/signal.h> -#include <dynamic-graph/exception-signal.h> - -#ifdef WIN32 -#include <Windows.h> -#endif - -#include <fstream> -using namespace std; -using namespace dynamicgraph; - -void ShellFunctions:: -cmdTry( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) -{ - if( cmdLine == "help" ) - { - os << " - try <cmd...>" - << "\t\t\t\tTry <cmd> and display the caught exception." <<endl; - return; - } - string cmdLine2; - cmdArg>>cmdLine2; - dgDEBUG(5)<<"Try <" <<cmdLine2<<">"<<endl; - try{ - Shell.cmd(cmdLine2,cmdArg,os); - } catch ( const ExceptionAbstract& e ) { os << "dgERROR catch: " <<endl<< e<<endl; } - catch( ... ) { os<<"Unknown error catch." <<endl; } - -} -void ShellFunctions:: -cmdLoadPlugins( const std::string cmdLine, std::istringstream& cmdArg, std::ostream& os ) -{ - if( cmdLine == "help" ) - { - os << " - loadPlugins <file.txt> <directory>" - << "\t\tLoad the plugins listed in the file." <<endl; - return; - } - if( NULL!=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(); - } - else { os << "!! Dynamic loading functionalities not accessible through the shell." <<endl; } -} -void ShellFunctions:: -cmdClearPlugin( const std::string cmdLine, std::istringstream& cmdArg, std::ostream& os ) -{ - if( cmdLine == "help" ) - { - os << " - clearPlugin <className>" - << "\t\tDestroy all the objects of type <className>." <<endl; - return; - } - - string pluginName; - cmdArg >> pluginName; - pool.clearPlugin( pluginName ); - -} - -void ShellFunctions:: -cmdDisplayPlugins( const std::string cmdLine, std::istringstream& cmdArg, std::ostream& os ) -{ - if( cmdLine == "help" ) - { - os << " - displayPlugins " - << "\t\t\t\tDisplay the name of the loaded plugins." <<endl; - return; - } - if( NULL!=Shell.dlPtr ) - { - std::map< std::string,std::string > m = Shell.dlPtr->getLoadedPluginNames(); - for( std::map< std::string,std::string >::const_iterator iter = m.begin(); - iter!=m.end(); ++iter ) - { - os << " - <"<<iter->first<<">:\t"<<iter->second<<endl; - } - - } - else { os << "!! Dynamic loading functionalities not accessible through the shell." <<endl; } - - -} - - - -void ShellFunctions:: -cmdDisplayFactory( const std::string cmdLine, std::istringstream& cmdArg, - std::ostream& os ) -{ - if( cmdLine == "help" ) - { - os << " - "; factory.commandLine(cmdLine,cmdArg,os); - return; - } - - string cmd2; cmdArg >> cmd2; - factory.commandLine( cmd2,cmdArg,os ); -} - -void ShellFunctions:: -cmdCommentary( const std::string cmdLine, std::istringstream& cmdArg, std::ostream& os ) -{ - if( cmdLine == "help" ) - { os << " # comment with '#': ignore the end of the line." <<endl; } - return; -} - - -void ShellFunctions:: -cmdUnplug( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) -{ - if( cmdLine == "help" ) - { - os << " - unplug <obj2.sig2>" - << "\t\t\t\tPlug on sig2 (consumer) in sig1->sig2." <<endl; - return; - } - string ssig; - cmdArg>>ssig; - - string obj2,fun2; - istringstream str2(ssig); - if( !Interpreter::objectNameParser(str2,obj2,fun2) ) - { - DG_THROW ExceptionFactory( ExceptionFactory::SYNTAX_ERROR, - "Plug function: syntax is unplug OBJ2.SIG2.", - "(while calling plug %s %s).",ssig.c_str() ); - } - - dgDEBUG(20) << "Get Ent2 <"<<obj2<<"> ."<<endl; - Entity& ent2 = pool.getEntity(obj2); - dgDEBUG(20) << "Get Sig2 <"<<fun2<<"> ."<<endl; - SignalBase<int> &sig2 = ent2.getSignal(fun2); - - - dgDEBUG(25) << "Unplug..."<<endl; - sig2.unplug(); -} - -void ShellFunctions:: -cmdSignalTime( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) -{ - if( cmdLine == "help" ) - { - os << " - signalTime <obj.sig>" - << "\t\t\t\tDisplay the time of sig." <<endl; - return; - } - - string ssig; - cmdArg>>ssig; - - string obj2,fun2; - istringstream str2(ssig); - if( !Interpreter::objectNameParser(str2,obj2,fun2) ) - { - DG_THROW ExceptionFactory( ExceptionFactory::SYNTAX_ERROR, - "Plug function: syntax is unplug OBJ2.SIG2.", - "(while calling plug %s %s).",ssig.c_str() ); - } - - dgDEBUG(20) << "Get Ent2 <"<<obj2<<"> ."<<endl; - Entity& ent2 = pool.getEntity(obj2); - dgDEBUG(20) << "Get Sig2 <"<<fun2<<"> ."<<endl; - SignalBase<int> &sig2 = ent2.getSignal(fun2); - - os << sig2.getTime() << endl; -} - -void ShellFunctions:: -cmdSynchroSignal( const std::string cmdLine, std::istringstream& cmdArg, std::ostream& os ) -{ - if( cmdLine == "help" ) - { - os << " - synchro <obj.sig> [<period>]" - << "\t\t\t\tGet/Set the syncho of a signal <sig>." <<endl; - return; - } - - SignalBase<int> & sig = pool.getSignal( cmdArg ); - cmdArg >>ws; - if( cmdArg.good() ) - { - int period; cmdArg>>period; - sig.setPeriodTime( period ); - cmdArg >>ws; - if( cmdArg.good() ) - { - /* The sig is recomputed at the given period from the - * current time, at any time T so that T%p==0, p the period. - * By modifying the current time, the sig reomputation is done - * at T s.t. T%p=d, d the desynchro. */ - int currTime = sig.getTime (); - int desynchro; cmdArg>>desynchro; - sig.setTime( currTime+desynchro ); - } - } - else - { - os << "period = " << sig.getPeriodTime() << std::endl; - } -} - -void ShellFunctions:: -cmdEcho( const std::string cmdLine, std::istringstream& cmdArg, std::ostream& os ) -{ - if( cmdLine == "help" ) - { - os << " - echo <string>" - << "\t\t\t\tPrint <string. on the standard output." <<endl; - return; - } - - cmdArg >>ws; - while( cmdArg.good() ) - { - std::string toPrint; cmdArg>>toPrint; - os<<toPrint<<" "; - } - os<<std::endl; -} - -void ShellFunctions:: -cmdCopy( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) -{ - if( cmdLine == "help" ) - { - os << " - copy <obj1.sig1> <obj2.sig2>" - << "\t\tCopy the value of sig1 to constant value in sig2." <<endl; - return; - } - string ssig1,ssig2; - cmdArg>>ssig1>>ssig2; - istringstream str1(ssig1),str2(ssig2); - - try { - SignalBase<int> &sig1 = pool.getSignal( str1 ); - SignalBase<int> &sig2 = pool.getSignal( str2 ); - - dgDEBUG(25) << "Copy..."<<endl; - sig2.plug(&sig1); - sig2.setConstantDefault(); - sig2.plug(&sig2); - } catch( ExceptionAbstract & err ) { throw; } - catch( ... ) { - DG_THROW ExceptionFactory( ExceptionFactory::SYNTAX_ERROR, - "Copy: syntax is copy OBJ1.SIG1 OBJ2.SIG2.", - "(while calling copy %s %s).",ssig1.c_str(), - ssig2.c_str() ); - } - -} - -void ShellFunctions:: -cmdFreeze( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) -{ - if( cmdLine == "help" ) - { - os << " - freeze <obj.sig> " - << "\t\tOn a ptr-sig: save the current value from the source " - << "and unplug the signal." <<endl; - return; - } - string ssig1; - cmdArg>>ssig1; - istringstream str1(ssig1); - - try { - SignalBase<int> &sig1 = pool.getSignal( str1 ); - - dgDEBUG(25) << "Unplug..."<<endl; - sig1.setConstantDefault(); - sig1.plug(&sig1); - } catch( ... ) { - DG_THROW ExceptionFactory( ExceptionFactory::SYNTAX_ERROR, - "Freeze: syntax is freeze OBJ.SIG.", - "(while calling freeze %s ).",ssig1.c_str()); - } - -} - -void ShellFunctions:: -cmdSqueeze( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) -{ - if( cmdLine == "help" ) - { - os << " - squeeze <mainObj.mainSig> <squeezeObj.sigIn> <squeezeObj.sigOut>" - << "\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; - istringstream strMain(ssigMain); - istringstream strIn(ssigIn); - istringstream strOut(ssigOut); - - try { - SignalBase<int> &sigMain = pool.getSignal(strMain ); - SignalBase<int> &sigIn = pool.getSignal( strIn ); - SignalBase<int> &sigOut = pool.getSignal( strOut ); - - SignalBase<int> *sigMainSource = sigMain.getPluged(); - if( sigMainSource==&sigMain ) - { - DG_THROW ExceptionFactory( ExceptionFactory::SYNTAX_ERROR, - "The main signal is autopluged (or set constant). ", - "(while calling freeze %s ).",ssigMain.c_str()); - } - - sigMain.plug( &sigOut ); - sigIn.plug( sigMainSource ); - } - catch( ExceptionFactory& exc ) { - switch( exc.getCode() ) - { - case ExceptionFactory::UNREFERED_SIGNAL: - DG_THROW ExceptionFactory( ExceptionFactory::SYNTAX_ERROR, - "Sqeeze: unknown signal. ", - "(error while searching signal: %s ).", - exc.getMessage() ); - break; - default: - throw; - } - } - -} - - -void ShellFunctions:: -cmdEnableTrace( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) -{ - if( cmdLine == "help" ) - { - os << " - debugtrace [{true|false}] [<filename>=" - << DebugTrace::DEBUG_FILENAME_DEFAULT <<"]" - << "\t\tOpen/close the file <filename> for debug tracing." <<endl; - return; - } - string opt,filename; - - cmdArg >> ws; - if( cmdArg.good() ) - { - cmdArg>>opt>>ws; - if( opt=="true" ) - if( cmdArg.good() ) - { - cmdArg>>filename; - DebugTrace::openFile( filename.c_str() ); - } - else { DebugTrace::openFile(); } - else DebugTrace::closeFile(); - } - else - { - if( dgDEBUGFLOW.outputbuffer.good() ) os << "true" <<endl; - else os << "false" <<endl; - } - -} - -void ShellFunctions:: -cmdSetPrompt( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) -{ - if( cmdLine == "help" ) - { - os << " - prompt [<string>] " - << "\t\tSet/get the default prompt." <<endl; - return; - } - - string opt; - cmdArg >> ws; - if( cmdArg. good() ) - { - char buffer [80]; cmdArg .getline(buffer,80); - Shell .prompt = buffer; - } else { os << "Current prompt is <" << Shell. prompt << ">." << endl; } -} - -void ShellFunctions:: -cmdSleep( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) -{ - if( cmdLine == "help" ) - { - os << " - sleep [<float> secs] " - << "\t\tSleep (time in secs)." <<endl; - return; - } - - string opt; - cmdArg >> ws; - if( cmdArg. good() ) - { - double secs; cmdArg >> secs; - if( secs > 0 ) -#ifndef WIN32 - usleep( int(secs*1000000) ); -#else - Sleep( int(secs*1000) ); -#endif - } else { /* TODO ERROR */ } -} - -void ShellFunctions:: -cmdBeep( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) -{ - if( cmdLine == "help" ) - { - os << " - beep [<float> secs] " - << "\t\tSend a bip to the std::cout." <<endl; - return; - } - - os << char(7) << "Beep!" << std::endl; -} - -void ShellFunctions:: -cmdCompletionList( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) -{ - if( cmdLine == "help" ) - { - os << " - completion <filename>" - << "\t\tGenerate the completion list for current graph." <<endl; - return; - } - - try { - - std::string aFileName; cmdArg >> aFileName; - std::ofstream completionFile((char *)aFileName.c_str()); - pool.writeCompletionList( completionFile ); - - - } catch( ExceptionAbstract & err ) { throw; } - catch( ... ) { - DG_THROW ExceptionFactory( ExceptionFactory::SYNTAX_ERROR, - "setflag: sig should be of flag type. ", - "(while calling setflag)."); - } - -} - - -extern "C" { - ShellFunctionRegisterer regFun1 - ( "try",boost::bind(ShellFunctions::cmdTry,_1,_2,_3) ); - ShellFunctionRegisterer regFun2 - ( "loadPlugins",boost::bind(ShellFunctions::cmdLoadPlugins,_1,_2,_3) ); - ShellFunctionRegisterer regFun3 - ( "displayPlugins",boost::bind(ShellFunctions::cmdDisplayPlugins,_1,_2,_3) ); - ShellFunctionRegisterer regFun4 - ( "factory",boost::bind(ShellFunctions::cmdDisplayFactory,_1,_2,_3) ); - ShellFunctionRegisterer regFun5 - ( "#",boost::bind(ShellFunctions::cmdCommentary,_1,_2,_3) ); - ShellFunctionRegisterer regFun7 - ( "unplug",boost::bind(ShellFunctions::cmdUnplug,_1,_2,_3) ); - ShellFunctionRegisterer regFun8 - ( "clearPlugin",boost::bind(ShellFunctions::cmdClearPlugin,_1,_2,_3) ); - ShellFunctionRegisterer regFun9 - ( "signalTime",boost::bind(ShellFunctions::cmdSignalTime,_1,_2,_3) ); - ShellFunctionRegisterer regFun10 - ( "synchro",boost::bind(ShellFunctions::cmdSynchroSignal,_1,_2,_3) ); - ShellFunctionRegisterer regFun11 - ( "echo",boost::bind(ShellFunctions::cmdEcho,_1,_2,_3) ); - ShellFunctionRegisterer regFun12 - ( "copy",boost::bind(ShellFunctions::cmdCopy,_1,_2,_3) ); - ShellFunctionRegisterer regFun13 - ( "freeze",boost::bind(ShellFunctions::cmdFreeze,_1,_2,_3) ); - ShellFunctionRegisterer regFun13b - ( "squeeze",boost::bind(ShellFunctions::cmdSqueeze,_1,_2,_3) ); - ShellFunctionRegisterer regFun14 - ( "debugtrace",boost::bind(ShellFunctions::cmdEnableTrace,_1,_2,_3) ); - ShellFunctionRegisterer regFun15 - ( "prompt",boost::bind(ShellFunctions::cmdSetPrompt,_1,_2,_3) ); - ShellFunctionRegisterer regFun16 - ( "sleep",boost::bind(ShellFunctions::cmdSleep,_1,_2,_3) ); - ShellFunctionRegisterer regFun17 - ( "beep",boost::bind(ShellFunctions::cmdBeep,_1,_2,_3) ); - ShellFunctionRegisterer regFun19 - ( "completion",boost::bind(ShellFunctions::cmdCompletionList,_1,_2,_3) ); - -} - diff --git a/src/dgraph/shell-procedure.cpp b/src/dgraph/shell-procedure.cpp deleted file mode 100644 index 42bb88425448055116b3511f47a2cb0e4286dc47..0000000000000000000000000000000000000000 --- a/src/dgraph/shell-procedure.cpp +++ /dev/null @@ -1,298 +0,0 @@ -/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * Copyright Projet JRL-Japan, 2007 - *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - * - * File: shell-procedure.cpp - * Project: SOT - * Author: François Bleibel (from Nicolas Mansard) - * - * Version control - * =============== - * - * $Id$ - * - * Description - * ============ - * - * - * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ - -#include <dynamic-graph/shell-procedure.h> -#include <dynamic-graph/plugin-loader.h> -#include <dynamic-graph/factory.h> -#include <dynamic-graph/debug.h> -#include <dynamic-graph/entity.h> - -#include <fstream> -using namespace std; -using namespace dynamicgraph; - -void ShellProcedure:: -cmdStartProcedure( const std::string& cmdLine,std::istringstream& args,std::ostream& os ) -{ - if( cmdLine == "help" ) - { - os << " - proc <name>" - << "\t\t\t\tProcedure header." <<endl; - return; - } - - args>>procName; - dgDEBUG(5)<<"Proc <" <<procName<<">"<<endl; - - currentProc.clear(); - args >> ws; - while( args.good() ) - { - std::string next; - args>>next>>ws; - currentProc.params.push_back(next); - } -} - -void ShellProcedure:: -cmdContinueProcedure( const std::string& cmdLine,std::istringstream& args,std::ostream& os ) -{ - if( cmdLine == "help" ) - { - os << " - -> cmd args..." - << "\t\t\t\tProcedure body." <<endl; - return; - } - - std::string cmd2; - args>>ws>>cmd2; - 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() ) - { - std::string next; int param=-1; - args>>next>>ws; - for( unsigned int i=0;i<currentProc.params.size();++i ) - { if( next==currentProc.params[i] ) { param=i; break; } } - ins.args.push_back(next); - ins.params.push_back( param ); - } - - currentProc.instructions.push_back( ins ); -} - -void ShellProcedure:: -cmdEndProcedure( const std::string& cmdLine,std::istringstream& args,std::ostream& os ) -{ - if( cmdLine == "help" ) - { - os << " - endproc..." - << "\t\t\t\tProcedure end." <<endl; - return; - } - - dgDEBUG(5)<<"Proc <" <<procName<<">: endproc"<<endl; - procedureList[ procName ] = currentProc; - -// std::string toto="toto"; -// for( sotProcedure::iterator ins=procedureList[ toto ].begin(); -// ins!=procedureList[ toto ].end(); ++ins ) -// { -// dgDEBUG(15) << "Proc <" << procName << "> : " -// << ins->cmd << " -> " << ins->args <<endl; -// } - - currentProc.clear(); - - if( Shell.deregisterFunction( procName )) - { os<< "Redefining proc <"<<procName<<">: procedure already defined. " - << "Overwrite it."<<endl; } - ShellFunctionRegisterer registration - ( procName.c_str(),boost::bind(&ShellProcedure::cmdProcedure, - this,procName,_1,_2,_3) ); - -} - -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; - args >> ws; - if( args.good() ) - { - std::string argname; - const unsigned int gc = args.tellg(); - args >> argname; - args.seekg(gc); args.clear(); - if( procname==argname ) - { - /* if cmdline = "Help <procname>", then display - * the proc instruction. */ - ProcedureList::iterator pair = procedureList.find( argname ); - if( pair==procedureList.end() ) - { - DG_THROW ExceptionFactory( ExceptionFactory::UNREFERED_FUNCTION, - "Undefined procedure", - ": procedure <%s> not defined.", - argname.c_str() ); - } - - sotProcedure & proc = pair->second; - unsigned int cmdnum=1; - for( std::list<Instruction>::iterator ins=proc.instructions.begin(); - ins!=proc.instructions.end(); ++ins ) - { - os<<"\t#" <<cmdnum++<<" "<<ins->cmd; // <<" "<<ins->args <<endl; - for( unsigned int i=0;i<ins->args.size();++i ) - { os << " " << ins->args[i]; } - os << endl; - } - - } - } - return; - } - - - dgDEBUG(15) << " Calling procedure <" <<cmdLine<<"> " <<endl; - ProcedureList::iterator pair = procedureList.find( cmdLine ); - if( pair==procedureList.end() ) - { - DG_THROW ExceptionFactory( ExceptionFactory::UNREFERED_FUNCTION, - "Undefined procedure", - ": procedure <%s> not defined.",cmdLine.c_str() ); - } - - /* You need a copy here, in case the proc is removed from the - * list by itself: - * % proc next - * % -> proc next - * % -> -> echo TOTO - * % -> endproc - * % endproc - */ - sotProcedure proc = pair->second; - - std::vector< std::string > paramValue; - for( unsigned int i=0;i<proc.params.size();++i ) - { - args>>ws; - if( args.good() ) - { - std::string next; args>>next>>ws; - paramValue.push_back( next ); - dgDEBUG(25) << "Args : <" << next << ">"<<endl; - } - else { paramValue.push_back(""); } - } - - istringstream iss; ostringstream oss; - for( std::list<Instruction>::iterator ins=proc.instructions.begin(); - ins!=proc.instructions.end(); ++ins ) - { - dgDEBUG(15) << "Proc <" << cmdLine << "> : " << ins->cmd << endl; - oss.clear(); oss.str(""); - for( unsigned int i=0;i<ins->params.size();++i ) - { - int paramArg = ins->params[i]; - if( paramArg==-1 ) oss << ins->args[i] << " "; - else oss << paramValue[paramArg] << " "; - } - - dgDEBUG(15) << " Args = " << oss.str() << endl; - iss.str(oss.str()); iss.clear(); - Shell.cmd(ins->cmd,iss,os); - } -} - -void ShellProcedure:: -cmdFor( const std::string& cmdLine,std::istringstream& args,std::ostream& os ) -{ - if( cmdLine == "help" ) - { - os << " - for 1 5 instruction "<<endl; - return; - } - - std::string cmd2,idx; - int istart,iend; - - { - stringstream oss; - - args >> cmd2; oss.str( cmd2 ); - const unsigned int SIZE = 32; char b1[SIZE],b2[SIZE],b3[SIZE]; - oss.getline( b1,SIZE,'=' ); - oss.getline( b2,SIZE,':' ); - oss.getline( b3,SIZE ); - dgDEBUG(15) << b1 << "/" << b2 << "/" << b3 << endl; - - idx = b1; istart = atoi(b2); iend = atoi(b3); - args >> cmd2; - - dgDEBUG(15) << "FOR <" << idx << "> = " << istart << " TO " << iend - << " DO " << cmd2 <<endl; - } - - string argsstr; - { - const unsigned int SIZE = 1024; char buffer[SIZE]; - args.getline( buffer,SIZE ); - argsstr = buffer; - } - for( int i=istart;i<=iend;++i ) - { - istringstream iss; stringstream oss; - - std::string insp; - istringstream issargs( argsstr ); - while( issargs.good() ) - { - issargs >> insp; - if( insp == idx ) { oss << i << " "; } else { oss<<insp<< " "; } - } - iss.str( oss.str() ); - Shell.cmd(cmd2,iss,os); - } -} - -ShellProcedure sotShellProceduror; - -extern "C" { - ShellFunctionRegisterer regFun1 - ( "proc",boost::bind(&ShellProcedure::cmdStartProcedure, - &sotShellProceduror,_1,_2,_3) ); - - ShellFunctionRegisterer regFun2 - ( "->",boost::bind(&ShellProcedure::cmdContinueProcedure, - &sotShellProceduror,_1,_2,_3) ); - ShellFunctionRegisterer regFun3 - ( "endproc",boost::bind(&ShellProcedure::cmdEndProcedure, - &sotShellProceduror,_1,_2,_3) ); - - ShellFunctionRegisterer regFun4 - ( "for",boost::bind(&ShellProcedure::cmdFor, - _1,_2,_3) ); -} - 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/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/unitTesting/test_factory.cpp b/unitTesting/test_factory.cpp index c471edf9d70280d6aa57b4e11dda1cfe362c5206..ef4b3f386cad63c18c2bedad47f6c42180e51376 100644 --- a/unitTesting/test_factory.cpp +++ b/unitTesting/test_factory.cpp @@ -3,7 +3,7 @@ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * * File: test_factory.cc - * Project: SOT + * Project: DYNAMIC-GRAPH * Author: Nicolas Mansard * * Version control @@ -123,12 +123,12 @@ if( NULL==dlib ) } Entity* gain = 0; - if ( !factory.existEntity("GainAdaptative") ) { + if ( !g_factory.existEntity("GainAdaptative") ) { cout << "Could not find entity class 'GainAdaptative'" << endl; exit(0); } else - gain = factory.newEntity("GainAdaptative","Gain"); + gain = g_factory.newEntity("GainAdaptative","Gain"); gain->display(cout); cout << 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_shell.cpp b/unitTesting/test_shell.cpp index 11e8ee98020c4ea14f09ecf29265845c76ed1a2e..9e6a8eaec3995f26c6f92c045c7bd387f341122d 100644 --- a/unitTesting/test_shell.cpp +++ b/unitTesting/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; }