diff --git a/include/dynamic-graph/debug.h b/include/dynamic-graph/debug.h index 3db9f0911030c89bd394e41587b13d6fce434686..99e0148dccb3cdef4264561d1b309bc7ccd86477 100644 --- a/include/dynamic-graph/debug.h +++ b/include/dynamic-graph/debug.h @@ -49,7 +49,7 @@ #include <stdarg.h> #include <dynamic-graph/dynamic-graph-api.h> - + /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ @@ -58,7 +58,7 @@ #ifndef VP_DEBUG_MODE #define VP_DEBUG_MODE 0 -#endif +#endif #ifndef VP_TEMPLATE_DEBUG_MODE #define VP_TEMPLATE_DEBUG_MODE 0 #endif @@ -82,14 +82,14 @@ class DYNAMICGRAPH_EXPORT DebugTrace std::ostream& outputbuffer; char charbuffer[SIZE+1]; int traceLevel; - int traceLevelTemplate; + int traceLevelTemplate; DebugTrace( std::ostream& os ): outputbuffer(os) {} inline void trace( const int level,const char* format,...) { if( level<=traceLevel ) DG_COMMON_TRACES; tmpbuffer.str(""); } inline void trace( const char* format,...){ DG_COMMON_TRACES; tmpbuffer.str(""); } - inline void trace( const int level=-1 ) + inline void trace( const int level=-1 ) { if( level<=traceLevel ) outputbuffer << tmpbuffer.str(); tmpbuffer.str(""); } inline void traceTemplate( const int level,const char* format,...) @@ -117,9 +117,9 @@ DYNAMICGRAPH_EXPORT extern DebugTrace dgERRORFLOW; #ifdef VP_DEBUG #define dgPREDEBUG __FILE__ << ": " <<__FUNCTION__ \ - << "(#" << __LINE__ << ") :" + << "(#" << __LINE__ << ") :" #define dgPREERROR "\t!! "<<__FILE__ << ": " <<__FUNCTION__ \ - << "(#" << __LINE__ << ") :" + << "(#" << __LINE__ << ") :" # define dgDEBUG(level) if( (level>VP_DEBUG_MODE)||(!dgDEBUGFLOW.outputbuffer.good()) ) ;\ else dgDEBUGFLOW.outputbuffer << dgPREDEBUG @@ -138,7 +138,7 @@ inline bool dgTDEBUG_ENABLE( const int & level ) { return level<=VP_TEMPLATE_DEB /* -------------------------------------------------------------------------- */ #else // #ifdef VP_DEBUG #define dgPREERROR "\t!! "<<__FILE__ << ": " <<__FUNCTION__ \ - << "(#" << __LINE__ << ") :" + << "(#" << __LINE__ << ") :" # define dgDEBUG(level) if( 1 ) ; else std::cout # define dgDEBUGMUTE(level) if( 1 ) ; else std::cout # define dgERROR dgERRORFLOW.outputbuffer << dgPREERROR diff --git a/include/dynamic-graph/entity.h b/include/dynamic-graph/entity.h index 65299ce96d2e4b25dc04f06b90b82de15959fc02..b2c800f38d61ca509239c1c4445261147214a422 100644 --- a/include/dynamic-graph/entity.h +++ b/include/dynamic-graph/entity.h @@ -87,7 +87,7 @@ class DYNAMICGRAPH_EXPORT Entity virtual std::ostream& writeCompletionList( std::ostream& os ) const; public: /* --- DISPLAY --- */ - virtual void display( std::ostream& os ) const; + virtual void display( std::ostream& os ) const; public: /* --- PARAMS --- */ virtual void commandLine( const std::string& cmdLine,std::istringstream& cmdArgs, diff --git a/include/dynamic-graph/exception-abstract.h b/include/dynamic-graph/exception-abstract.h index 7934f1eeb1eb3dc6ec49a4655e23c09823ac4495..427e2e58d6ad95d313c86f8760a828ef41448b2b 100644 --- a/include/dynamic-graph/exception-abstract.h +++ b/include/dynamic-graph/exception-abstract.h @@ -33,7 +33,7 @@ // Uncomment this macros to have lines parameter on the throw display -// #define DYNAMIC-GRAPH_EXCEPTION_PASSING_PARAM +// #define DYNAMIC-GRAPH_EXCEPTION_PASSING_PARAM /* --------------------------------------------------------------------- */ /* --- CLASS ----------------------------------------------------------- */ @@ -92,12 +92,12 @@ public: { return getStringMessage().c_str(); } - + /** Print the error structure. */ DYNAMICGRAPH_EXPORT friend std::ostream & operator << (std::ostream & os, const ExceptionAbstract & err); -#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM +#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM public: class Param { @@ -114,7 +114,7 @@ public: Param( const int& _line, const char * _function, const char * _file ); Param( void ) : pointersSet(false),set(false) {} Param& initCopy( const Param& p ); - + }; protected: @@ -126,7 +126,7 @@ public: template<class Exc> friend Exc& operator+ ( const ExceptionAbstract::Param& p, Exc& e ) { e.p.initCopy(p); return e; } -#endif //#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM +#endif //#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM }; } // namespace dynamicgraph @@ -137,9 +137,9 @@ public: #ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM # define DG_THROW throw ExceptionAbstract::Param(__LINE__,__FUNCTION__,__FILE__) + -#else //#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM +#else //#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM # define DG_THROW throw -#endif //#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM +#endif //#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM #endif /* #ifndef __ABSTRACT_EXCEPTION_H */ diff --git a/include/dynamic-graph/interpreter-helper.h b/include/dynamic-graph/interpreter-helper.h index 4fd9a1d36fb73470f3cdd9b8ee312952de3b7b94..bfa9e3ca2ef12bdd78d3f2f66c71641413286b1c 100644 --- a/include/dynamic-graph/interpreter-helper.h +++ b/include/dynamic-graph/interpreter-helper.h @@ -90,7 +90,7 @@ class DYNAMICGRAPH_EXPORT InterpreterHelper /*! \brief Destroy the object. Destroy the object objName. */ - void cmdDestroy( const std::string& objName, + void cmdDestroy( const std::string& objName, std::ostream& os ); /*! \brief Connect two signals. @@ -107,20 +107,20 @@ class DYNAMICGRAPH_EXPORT InterpreterHelper Extracts the name first and the directory in second from cmdArg to load the dynamic library. */ - void cmdLoadPlugin( const std::string& directory, - const std::string& pluginName, + void cmdLoadPlugin( const std::string& directory, + const std::string& pluginName, std::ostream& os ); /*! \brief Unload a dynamic library which includes a plugin. Extracts the name to unload the dynamic library. */ - void cmdUnloadPlugin( const std::string& pluginName, + void cmdUnloadPlugin( const std::string& pluginName, std::ostream& os ); /*! \brief Set a signal <obj.signal> to a value <value> with cmdArg = "<obj.signal> <value>" */ - void cmdSetSignal( const std::string& objname, + void cmdSetSignal( const std::string& objname, const std::string& signame, const std::string& cmdArg, std::ostream& os); @@ -128,15 +128,15 @@ class DYNAMICGRAPH_EXPORT InterpreterHelper /*! \brief Display the value of the signal <obj.signal> with cmdArg = "<obj.signal>" */ - void cmdGetSignal( const std::string& objname, - const std::string& signame, + void cmdGetSignal( const std::string& objname, + const std::string& signame, std::ostream& os); /*! \brief Compute the value of the signal <obj.signal> at time <time> with cmdArg = "<obj.signal> <time>" */ void cmdComputeSignal( const std::string& objname, - const std::string& signame, + const std::string& signame, const int &time, std::ostream& os ); diff --git a/include/dynamic-graph/plugin-loader.h b/include/dynamic-graph/plugin-loader.h index b425beafd85e435e78a05873d2a0c5381c415147..18fd14d341fb05ce04087a696d546559f410b921 100644 --- a/include/dynamic-graph/plugin-loader.h +++ b/include/dynamic-graph/plugin-loader.h @@ -50,7 +50,7 @@ class PluginRefMap; Once loaded, the plugins register themselves to the sotFactory and the related objects can subsequently be instantiated by the sotInterpretor for example. - + */ class DYNAMICGRAPH_EXPORT PluginLoader { @@ -63,12 +63,12 @@ class DYNAMICGRAPH_EXPORT PluginLoader std::list< std::string > pluginNames; /*! \brief If a plugin has been loaded then this map contains - the name of the plugin. + the name of the plugin. \note This field looks useless. */ std::map< std::string,std::string > loadedPluginNames; - - /*! \brief Keeps a reference to the library according to the name of the + + /*! \brief Keeps a reference to the library according to the name of the plugin. */ PluginRefMap* pluginRefs; @@ -77,7 +77,7 @@ class DYNAMICGRAPH_EXPORT PluginLoader /*! \brief Default constructor. */ PluginLoader( void ); ~PluginLoader( void ); - + /*! \brief Set the directory from which to load the dynamic libraries containing the plugins. */ const std::string& setDirectory( const std::string& n ); @@ -87,7 +87,7 @@ class DYNAMICGRAPH_EXPORT PluginLoader /*! \brief Adds a list of plugins It is done by reading the file configFile which contains for each line - a plugin name. + a plugin name. \par[in] configFile: The name of the file which contains the plugins name. \par[in] dir: The name of the directory which contains the dynamic libraries. */ @@ -103,7 +103,7 @@ class DYNAMICGRAPH_EXPORT PluginLoader void unloadAllPlugins(); - const std::map< std::string,std::string > getLoadedPluginNames( void ) + const std::map< std::string,std::string > getLoadedPluginNames( void ) { return loadedPluginNames; } const std::string& searchPlugin( const std::string& plugname ); diff --git a/include/dynamic-graph/shell-procedure.h b/include/dynamic-graph/shell-procedure.h index 196c9574eb8a7ab41f787d6860381ec84c82fbd5..51c481f560f18bd0fd13ab669eefe840c1817099 100644 --- a/include/dynamic-graph/shell-procedure.h +++ b/include/dynamic-graph/shell-procedure.h @@ -44,12 +44,12 @@ /* --- API ------------------------------------------------------------- */ /* --------------------------------------------------------------------- */ -#if defined (WIN32) +#if defined (WIN32) # if defined (shell_procedure_EXPORTS) # define ShellProcedure_EXPORT __declspec(dllexport) -# else +# else # define ShellProcedure_EXPORT __declspec(dllimport) -# endif +# endif #else # define ShellProcedure_EXPORT #endif @@ -87,7 +87,7 @@ class ShellProcedure_EXPORT ShellProcedure Procedure currentProc; public: - + void cmdStartProcedure( const std::string& cmd,std::istringstream& args,std::ostream& os ); void cmdContinueProcedure( const std::string& cmd,std::istringstream& args,std::ostream& os ); void cmdEndProcedure( const std::string& cmd,std::istringstream& args,std::ostream& os ); diff --git a/include/dynamic-graph/signal-array.h b/include/dynamic-graph/signal-array.h index 39c59176e12adf002ec8d454476834368e282695..22db5a77ac91e2ed0221e5c5a10842fe59b76092 100644 --- a/include/dynamic-graph/signal-array.h +++ b/include/dynamic-graph/signal-array.h @@ -31,20 +31,20 @@ class SignalArray; template<class Time> class SignalArray_const -{ +{ public: - static const int DEFAULT_SIZE = 20; + static const int DEFAULT_SIZE = 20; protected: const SignalBase<Time> ** const_array; - unsigned int size,rank; + unsigned int size,rank; public: - SignalArray_const<Time>( const unsigned int& sizeARG=DEFAULT_SIZE ) + SignalArray_const<Time>( const unsigned int& sizeARG=DEFAULT_SIZE ) : const_array(NULL),size(sizeARG),rank(0) { createArray(); } - SignalArray_const<Time>( const SignalBase<Time>& sig) + SignalArray_const<Time>( const SignalBase<Time>& sig) : const_array(NULL),size(1),rank(0) { createArray(); addElmt(&sig); } @@ -72,10 +72,10 @@ class SignalArray_const { if(0<size) { const_array = new const SignalBase<Time>* [size]; } } - void addElmt( const SignalBase<Time>* el ) + void addElmt( const SignalBase<Time>* el ) { if(rank<size) const_array[rank++] = el; } - public: + public: virtual SignalArray_const<Time>& operator<< (const SignalBase<Time>& sig) { addElmt( &sig ); return *this; } @@ -98,7 +98,7 @@ SignalArray_const<Time> operator<<( const SignalBase<Time>& sig1, template<class Time> class SignalArray :public SignalArray_const<Time> -{ +{ public: using SignalArray_const<Time>::DEFAULT_SIZE; using SignalArray_const<Time>::size; @@ -107,11 +107,11 @@ class SignalArray mutable SignalBase<Time> ** array; public: - SignalArray<Time>( const unsigned int& sizeARG=DEFAULT_SIZE ) + SignalArray<Time>( const unsigned int& sizeARG=DEFAULT_SIZE ) :SignalArray_const<Time>(0) { size=sizeARG; createArray(); } - SignalArray<Time>( SignalBase<Time>& sig) + SignalArray<Time>( SignalBase<Time>& sig) : SignalArray_const<Time>(0) { size=1; createArray(); addElmt(&sig); } @@ -133,7 +133,7 @@ class SignalArray { if(0<size) { array = new SignalBase<Time>* [size]; } } - void addElmt( SignalBase<Time>* el ) + void addElmt( SignalBase<Time>* el ) { if(rank<size) array[rank++] = el; } public: //protected: @@ -142,16 +142,16 @@ class SignalArray virtual SignalArray_const<Time> operator<< (const SignalBase<Time>& sig) const { - SignalArray_const<Time> res(size); - res=*this; - res<<sig; - return res; + SignalArray_const<Time> res(size); + res=*this; + res<<sig; + return res; } public: virtual SignalBase<Time>& operator[] ( const unsigned int& idx ) const - { + { return *array[idx]; } }; diff --git a/include/dynamic-graph/signal-base.h b/include/dynamic-graph/signal-base.h index da313e623fa0e6cbec4fecaca002c4adf99d96ae..a9c5e88e0b3f14947e8289703e82a5d70a40cefd 100644 --- a/include/dynamic-graph/signal-base.h +++ b/include/dynamic-graph/signal-base.h @@ -40,7 +40,7 @@ class SignalBase : public boost::noncopyable bool ready; public: - + virtual const Time& getTime( void ) const { return signalTime; } virtual void setTime( const Time& t ) { signalTime=t; } const bool& getReady( void ) const { return ready; } @@ -52,8 +52,8 @@ class SignalBase : public boost::noncopyable public: /* --- CONSTRUCTORS ------------------------------------------------------- */ - - SignalBase( std::string name ="" ) + + SignalBase( std::string name ="" ) : name(name),signalTime(0),ready(false) {} virtual ~SignalBase( void ) {} @@ -67,39 +67,39 @@ class SignalBase : public boost::noncopyable virtual bool needUpdate( const Time& t ) const {return ready;} inline void setReady( const bool sready = true ) { ready = sready; } - virtual std::ostream & + virtual std::ostream & writeGraph (std::ostream & os ) const { return os; } - virtual std::ostream& + virtual std::ostream& displayDependencies( std::ostream& os,const int depth=-1, std::string space="", std::string next1="",std::string next2="" ) const { - os << space << next1 << "-- "; - display(os); return os; + os << space << next1 << "-- "; + display(os); return os; } - + /* --- PLUG --------------------------------------------------------------- */ - /* Plug the arg-signal on the <this> object. Plug-in is always + /* Plug the arg-signal on the <this> object. Plug-in is always * a descending operation (the actual <this> object will call the arg-signal - * and not the opposite). + * and not the opposite). */ virtual void plug( SignalBase<Time>* sigarg ) { DG_THROW ExceptionSignal( ExceptionSignal::PLUG_IMPOSSIBLE, "Plug-in operation not possible with this signal. ", "(while trying to plug %s on %s).",sigarg->getName().c_str(), this->getName().c_str() ); } - virtual void unplug( void ) + virtual void unplug( void ) { DG_THROW ExceptionSignal( ExceptionSignal::PLUG_IMPOSSIBLE, "Plug-in operation not possible with this signal. ", "(while trying to unplug %s).",this->getName().c_str() ); } - virtual bool isPluged( void ) const { return false; } - virtual SignalBase<Time>* getPluged( void ) const { return NULL; } + virtual bool isPluged( void ) const { return false; } + virtual SignalBase<Time>* getPluged( void ) const { return NULL; } virtual void setConstantDefault( void ) { DG_THROW ExceptionSignal( ExceptionSignal::PLUG_IMPOSSIBLE, "Plug-in operation not possible with this signal. ", @@ -109,7 +109,7 @@ class SignalBase : public boost::noncopyable /* Generic set function. Should be reimplemented by the specific Signal. */ - virtual void set( std::istringstream& value ) + virtual void set( std::istringstream& value ) { DG_THROW ExceptionSignal( ExceptionSignal::SET_IMPOSSIBLE, "Set operation not possible with this signal. ", "(while trying to set %s).",this->getName().c_str() ); @@ -119,7 +119,7 @@ class SignalBase : public boost::noncopyable "Get operation not possible with this signal. ", "(while trying to get %s).",this->getName().c_str() ); } - virtual inline void recompute( const Time & t) + virtual inline void recompute( const Time & t) { DG_THROW ExceptionSignal( ExceptionSignal::SET_IMPOSSIBLE, "Recompute operation not possible with this signal. ", "(while trying to recompute %s).",this->getName().c_str() ); @@ -132,7 +132,7 @@ class SignalBase : public boost::noncopyable /* --- DISPLAY ------------------------------------------------------------ */ - virtual std::ostream& display( std::ostream& os ) const + virtual std::ostream& display( std::ostream& os ) const { os<<"Sig:"<<name; return os;} std::string shortName( void ) const @@ -149,7 +149,7 @@ class SignalBase : public boost::noncopyable virtual void ExtractNodeAndLocalNames(std::string & LocalName, std::string & NodeName) const { std::string fullname = this->getName(); - + size_t IdxPosLocalName = fullname.rfind(":"); LocalName = fullname.substr(IdxPosLocalName+1,fullname.length()-IdxPosLocalName+1); size_t IdxPosNodeNameStart = fullname.find("("); @@ -158,12 +158,12 @@ class SignalBase : public boost::noncopyable /* std::cout << "Finally " << std:: endl << "\tLocalName: " << LocalName << std::endl << "\tNodeName: " << NodeName << std::endl; */ - + } /* --- TEST TEST TEST TEST TEST TEST --- */ public: - virtual void checkCompatibility( void ) + virtual void checkCompatibility( void ) { DG_THROW ExceptionSignal( ExceptionSignal::PLUG_IMPOSSIBLE, "Abstract signal not compatible with anything.", "(while trying to plug <%s>).", @@ -171,10 +171,10 @@ class SignalBase : public boost::noncopyable }; -/** Forward to a virtual fonction. +/** Forward to a virtual fonction. */ template< class Time > -std::ostream& operator<< (std::ostream& os,const SignalBase<Time>& sig ) +std::ostream& operator<< (std::ostream& os,const SignalBase<Time>& sig ) { return sig.display(os); } } // namespace dynamicgraph diff --git a/include/dynamic-graph/signal-caster.h b/include/dynamic-graph/signal-caster.h index 68d689622a717c9eaebd1a0389262260f7ef9b17..4ceb039b55b236d5b6e0fa6ab0296e23d63fd9ea 100644 --- a/include/dynamic-graph/signal-caster.h +++ b/include/dynamic-graph/signal-caster.h @@ -115,7 +115,7 @@ template<typename T> void signal_disp(const T& value, std::ostream& os) { g_caster.disp(value, os); } template<typename T> T signal_cast(std::istringstream& iss) - { + { return boost::any_cast<T>(g_caster.cast(typeid(T), iss)); } diff --git a/include/dynamic-graph/signal-ptr.h b/include/dynamic-graph/signal-ptr.h index d648837816d2560831bf18ea726aef05b309f9d1..7ca8c53166c117522605d80afd2f18c038d89885 100644 --- a/include/dynamic-graph/signal-ptr.h +++ b/include/dynamic-graph/signal-ptr.h @@ -29,16 +29,16 @@ namespace dynamicgraph { template< class T,class Time > -class SignalPtr +class SignalPtr : public virtual Signal<T,Time> { public: using SignalBase<Time>::getName; - protected: + protected: Signal<T,Time>* signalPtr; bool modeNoThrow; - bool transmitAbstract; + bool transmitAbstract; SignalBase<Time> * abstractTransmitter; T* transmitAbstractData; @@ -52,7 +52,7 @@ class SignalPtr ,transmitAbstract(false) ,abstractTransmitter(NULL) {} virtual ~SignalPtr( void ) { signalPtr = NULL; } - + public: /* --- PLUG-IN OPERATION --- */ Signal<T,Time>* getPtr ( void ); // throw @@ -61,11 +61,11 @@ class SignalPtr const SignalBase<Time>* getAbstractPtr ( void ) const; // throw virtual void plug( SignalBase<Time>* ref ); virtual void unplug( void ) { plug(NULL); } - virtual bool isPluged( void ) const { return (NULL!=signalPtr); } - virtual SignalBase<Time>* getPluged( void ) const { return signalPtr; } - virtual bool isAbstractPluged( void ) const; + virtual bool isPluged( void ) const { return (NULL!=signalPtr); } + virtual SignalBase<Time>* getPluged( void ) const { return signalPtr; } + virtual bool isAbstractPluged( void ) const; virtual const Time& getTime( void ) const; - + /* Equivalent operator-like definitions. */ inline Signal<T,Time>* operator->() { return getPtr(); } inline const Signal<T,Time>* operator->() const { return getPtr(); } @@ -81,10 +81,10 @@ class SignalPtr /* For compatibility, .access() is equivalent to ->access(). For explicite * pointer dereference : - * Prefere ->() to () + * Prefere ->() to () */ virtual const T& operator()( const Time & t ); - /* Similarly, Prefere ->access to .access + /* Similarly, Prefere ->access to .access */ virtual const T& access( const Time & t ); virtual const T& accessCopy( void ) const; @@ -97,7 +97,7 @@ class SignalPtr public: /* --- INHERITANCE --- */ - + /* SignalPtr could be used as a classical signal, through the normal * setting functions. The behavior is to plugged the signalPtr on * the classical mother Signal layer of the object. @@ -122,13 +122,13 @@ class SignalPtr std::string space="", std::string next1="", std::string next2="" ) const; - + protected: // Interdiction of the rest of the heritage - + virtual void addDependency( const SignalBase<Time>& signal ) {} virtual void removeDependency( const SignalBase<Time>& signal ) {} virtual void clearDependencies( void ) {} - + }; } // namespace dynamicgraph diff --git a/include/dynamic-graph/signal-ptr.t.cpp b/include/dynamic-graph/signal-ptr.t.cpp index 9fe541813412b601b17096ec2356561384eccb48..74bbd9f920a6eca0b71be9bfe1f29a937e8a25d8 100644 --- a/include/dynamic-graph/signal-ptr.t.cpp +++ b/include/dynamic-graph/signal-ptr.t.cpp @@ -25,7 +25,7 @@ * * CNRS/AIST * - * This file is part of dynamic-graph. + * This file is part of dynamic-graph. * dynamic-graph is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 of @@ -73,15 +73,15 @@ namespace dynamicgraph { template< class T,class Time > bool SignalPtr<T,Time>:: -isAbstractPluged( void ) const +isAbstractPluged( void ) const { - return ( (NULL!=signalPtr)||(abstractTransmitter) ); -} + return ( (NULL!=signalPtr)||(abstractTransmitter) ); +} template< class T,class Time > Signal<T,Time>* SignalPtr<T,Time>:: -getPtr ( void ) +getPtr ( void ) { dgTDEBUGIN(25); if(! isPluged() ) @@ -89,7 +89,7 @@ getPtr ( void ) "In SignalPtr: SIN ptr not set.", " (in signal <%s>)",getName().c_str()); dgTDEBUGOUT(25); - return signalPtr; + return signalPtr; } template< class T,class Time > @@ -104,12 +104,12 @@ getPtr ( void ) const "In SignalPtr: SIN ptr not set.", " (in signal <%s>)",getName().c_str()); } dgTDEBUGOUT(25); - return signalPtr; + return signalPtr; } template< class T,class Time > SignalBase<Time>* SignalPtr<T,Time>:: -getAbstractPtr ( void ) +getAbstractPtr ( void ) { if(! isAbstractPluged() ) { DG_THROW ExceptionSignal( ExceptionSignal::NOT_INITIALIZED, @@ -133,11 +133,11 @@ getAbstractPtr ( void ) const template< class T,class Time > void SignalPtr<T,Time>:: -plug( SignalBase<Time>* unknown_ref ) +plug( SignalBase<Time>* unknown_ref ) { dgTDEBUGIN(5); if(! unknown_ref ) - { + { signalPtr = NULL; transmitAbstract = false; dgTDEBUGOUT(5); @@ -147,12 +147,12 @@ plug( SignalBase<Time>* unknown_ref ) dgTDEBUG(5) << "# In T = "<< getName() <<" =" <<typeid( Signal<T,Time>::Tcopy1 ) .name() << "{ "<<std::endl; - + Signal<T,Time> * ref = dynamic_cast< Signal<T,Time>* > (unknown_ref); if( NULL==ref ) { try { - unknown_ref->checkCompatibility(); + unknown_ref->checkCompatibility(); } catch( T* t ) { @@ -176,7 +176,7 @@ plug( SignalBase<Time>* unknown_ref ) { dgTDEBUG(25) << "Cast ok."<< std::endl; transmitAbstract = false; - signalPtr = ref; + signalPtr = ref; } dgTDEBUGOUT(5); } @@ -184,15 +184,15 @@ plug( SignalBase<Time>* unknown_ref ) template< class T,class Time > bool SignalPtr<T,Time>:: needUpdate( const Time& t ) const -{ - if( (isAbstractPluged())&&(!autoref()) ){ return getAbstractPtr()->needUpdate(t);} +{ + if( (isAbstractPluged())&&(!autoref()) ){ return getAbstractPtr()->needUpdate(t);} else return Signal<T,Time>::needUpdate(t); } template< class T,class Time > const Time& SignalPtr<T,Time>::getTime( void ) const { - if( (isAbstractPluged())&&(!autoref()) ){ return getAbstractPtr()->getTime();} + if( (isAbstractPluged())&&(!autoref()) ){ return getAbstractPtr()->getTime();} return Signal<T,Time>::getTime(); } @@ -201,12 +201,12 @@ template< class T,class Time > const T& SignalPtr<T,Time>:: operator()( const Time & t ) { - return access(t); + return access(t); } template< class T,class Time > const T& SignalPtr<T,Time>:: -access( const Time & t ) +access( const Time & t ) { dgTDEBUGIN(15); if( modeNoThrow&&(! isPluged())&&Signal<T,Time>::copyInit ) @@ -214,7 +214,7 @@ access( const Time & t ) dgTDEBUGOUT(15); return Signal<T,Time>::accessCopy(); } - else if( autoref() ) + else if( autoref() ) { dgTDEBUGOUT(15); return Signal<T,Time>::access(t); @@ -253,10 +253,10 @@ writeGraph(std::ostream &os) const std::string itLocalName,itNodeName; getAbstractPtr()->ExtractNodeAndLocalNames(itLocalName,itNodeName); os << "\t\"" << itNodeName << "\" -> \"" << LeaderNodeName << "\"" << std::endl - << "\t [ headlabel = \"" << LeaderLocalName - << "\" , taillabel = \"" << itLocalName + << "\t [ headlabel = \"" << LeaderLocalName + << "\" , taillabel = \"" << itLocalName << "\", fontsize=7, fontcolor=red ]" << std::endl; - + } return os; } @@ -268,18 +268,18 @@ display( std::ostream& os ) const dgTDEBUGIN(25) << SignalBase<Time>::name << this << "||" << isPluged() << "||"<<signalPtr; { Signal<T,Time>::display(os); } - if( (isAbstractPluged())&&(!autoref()) ) + if( (isAbstractPluged())&&(!autoref()) ) { // dgTDEBUG(25) << "Display pointed."<<std::endl; - // getPtr()->display(os<<"PTR->"); + // getPtr()->display(os<<"PTR->"); os << " -->-- PLUGGED"; } - else - { + else + { if(! isAbstractPluged()) os << " UNPLUGGED"; else if(autoref()) os << " AUTOPLUGGED"; } - + dgTDEBUGOUT(25); return os; } @@ -294,9 +294,9 @@ displayDependencies( std::ostream& os,const int depth, if( (isAbstractPluged())&&(!autoref()) ) { getAbstractPtr()->displayDependencies(os,depth,space,next1+"-- " +SignalBase<Time>::name+" -->",next2); } - else + else { - SignalBase<Time>::displayDependencies(os,depth,space,next1,next2); + SignalBase<Time>::displayDependencies(os,depth,space,next1,next2); } dgTDEBUGOUT(25); return os; diff --git a/include/dynamic-graph/signal-time-dependent.h b/include/dynamic-graph/signal-time-dependent.h index a12a6e53d59ca90b9fbe27ee95e68930d797282c..f5825867cc5277e7554a2bf145f46d24f7789bc7 100644 --- a/include/dynamic-graph/signal-time-dependent.h +++ b/include/dynamic-graph/signal-time-dependent.h @@ -30,7 +30,7 @@ namespace dynamicgraph { template< class T,class Time > class SignalTimeDependent : public virtual Signal<T,Time> -, public TimeDependency<Time> +, public TimeDependency<Time> { //TimeDependency<Time> timeDependency; @@ -42,12 +42,12 @@ class SignalTimeDependent SignalTimeDependent( boost::function2<T&,T&,Time> t ,const SignalArray_const<Time> & sig ,std::string name = "" ); - + virtual ~SignalTimeDependent( void ) {} - + inline const T& operator() ( const Time& t1 ){ return access(t1); } const T& access( const Time& t1 ); - + virtual void addDependency( const SignalBase<Time>& signal ) ; virtual void removeDependency( const SignalBase<Time>& signal ) ; virtual void clearDependencies( void ); @@ -60,7 +60,7 @@ class SignalTimeDependent std::string next1="",std::string next2="" ) const { return TimeDependency<Time>::displayDependencies( os,depth,space,next1,next2 ); } - + virtual bool needUpdate( const Time& t ) const; virtual void setPeriodTime( const Time& p ) ; virtual Time getPeriodTime( void ) const; @@ -94,12 +94,12 @@ SignalTimeDependent<T,Time>:: :Signal<T,Time>(name) ,TimeDependency<Time>(this,sig) { setFunction(t); } - + template< class T,class Time> const T& SignalTimeDependent<T,Time>:: access( const Time& t1 ) { - const bool up = TimeDependency<Time>::needUpdate(t1); + const bool up = TimeDependency<Time>::needUpdate(t1); //SignalBase<Time>::setReady(false); /* std::cout << "Time before: "<< signalTime << " -- " */ @@ -108,7 +108,7 @@ access( const Time& t1 ) { TimeDependency<Time>::lastAskForUpdate = false; const T& Tres = Signal<T,Time>::access(t1); - SignalBase<Time>::setReady(false); + SignalBase<Time>::setReady(false); return Tres; } else { return Signal<T,Time>::accessCopy(); } @@ -117,12 +117,12 @@ access( const Time& t1 ) template< class T,class Time> void SignalTimeDependent<T,Time>:: -addDependency( const SignalBase<Time>& signal ) +addDependency( const SignalBase<Time>& signal ) { TimeDependency<Time>::addDependency(signal); } template< class T,class Time> void SignalTimeDependent<T,Time>:: -removeDependency( const SignalBase<Time>& signal ) +removeDependency( const SignalBase<Time>& signal ) { TimeDependency<Time>::removeDependency(signal); } template< class T,class Time> @@ -134,12 +134,12 @@ template< class T,class Time> bool SignalTimeDependent<T,Time>:: needUpdate( const Time& t ) const { - return TimeDependency<Time>::needUpdate(t); + return TimeDependency<Time>::needUpdate(t); } template< class T,class Time> void SignalTimeDependent<T,Time>:: -setPeriodTime( const Time& p ) +setPeriodTime( const Time& p ) { TimeDependency<Time>::setPeriodTime( p ); } template< class T,class Time> Time SignalTimeDependent<T,Time>:: diff --git a/include/dynamic-graph/signal.h b/include/dynamic-graph/signal.h index 21fc3630f0fcfecabe834685627464740de11faa..b974c38e9d00635a9c1d443c887c2f44728c7013 100644 --- a/include/dynamic-graph/signal.h +++ b/include/dynamic-graph/signal.h @@ -79,7 +79,7 @@ class Signal typedef int* Mutex; typedef int* MutexError; #endif - + protected: Mutex *providerMutex; using SignalBase<Time>::signalTime; @@ -99,7 +99,7 @@ protected: virtual void trace( std::ostream& os ) const; /* --- Generic Set function --- */ - virtual void setConstant( const T& t ); + virtual void setConstant( const T& t ); virtual void setReference( const T* t,Mutex *mutexref=NULL ); virtual void setReferenceNonConstant( T* t,Mutex *mutexref=NULL ); virtual void setFunction( boost::function2<T&,T&,Time> t, @@ -112,7 +112,7 @@ protected: virtual const T& access( const Time & t ); virtual inline void recompute( const Time & t ) { access(t); } virtual const T& accessCopy( void ) const; - + virtual std::ostream& display( std::ostream& os ) const; /* --- Operators --- */ diff --git a/include/dynamic-graph/signal.t.cpp b/include/dynamic-graph/signal.t.cpp index 3106f17477b582b7943f5c3e5dc90aeb25d90b58..45c77c644402023225b5c6235d5b987c70e929ce 100644 --- a/include/dynamic-graph/signal.t.cpp +++ b/include/dynamic-graph/signal.t.cpp @@ -25,7 +25,7 @@ * * CNRS/AIST * - * This file is part of dynamic-graph. + * This file is part of dynamic-graph. * dynamic-graph is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 of @@ -82,7 +82,7 @@ namespace dynamicgraph { ,TreferenceNonConst(TrefNC) \ ,Tfunction() \ ,keepReference( KEEP_REFERENCE_DEFAULT ) \ - ,providerMutex(mutex) + ,providerMutex(mutex) template< class T,class Time > Signal<T,Time>:: @@ -129,16 +129,16 @@ trace( std::ostream& os ) const template< class T,class Time > const T& Signal<T,Time>:: -setTcopy( const T& t ) +setTcopy( const T& t ) { if( Tcopy==&Tcopy1 ) { Tcopy2 = t; copyInit = true; - Tcopy = &Tcopy2; + Tcopy = &Tcopy2; return Tcopy2; } - else + else { Tcopy1 = t; copyInit = true; @@ -156,7 +156,7 @@ getTwork( void ) template< class T,class Time > const T& Signal<T,Time>:: -getTwork( void ) const +getTwork( void ) const { if( Tcopy==&Tcopy1 ) return Tcopy2; else return Tcopy1; } @@ -166,10 +166,10 @@ template< class T,class Time > const T& Signal<T,Time>:: switchTcopy( void ) { - if( Tcopy==&Tcopy1 ) + if( Tcopy==&Tcopy1 ) { Tcopy = &Tcopy2; - return Tcopy2; + return Tcopy2; } else { @@ -182,7 +182,7 @@ switchTcopy( void ) template< class T,class Time > void Signal<T,Time>:: -setConstant( const T& t ) +setConstant( const T& t ) { signalType = CONSTANT; setTcopy(t); setReady(); @@ -193,7 +193,7 @@ template< class T,class Time > void Signal<T,Time>:: setReference( const T* t,Mutex *mutexref ) { - signalType = REFERENCE; Treference = t; + signalType = REFERENCE; Treference = t; providerMutex = mutexref; copyInit = false; setReady(); @@ -204,8 +204,8 @@ void Signal<T,Time>:: setReferenceNonConstant( T* t,Mutex *mutexref ) { signalType = REFERENCE_NON_CONST; - Treference = t; - TreferenceNonConst = t; + Treference = t; + TreferenceNonConst = t; providerMutex = mutexref; copyInit = false; setReady(); @@ -214,7 +214,7 @@ setReferenceNonConstant( T* t,Mutex *mutexref ) template< class T,class Time > void Signal<T,Time>:: setFunction( boost::function2<T&,T&,Time> t,Mutex *mutexref ) -{ +{ signalType = FUNCTION; Tfunction = t; providerMutex = mutexref; @@ -226,7 +226,7 @@ template< class T,class Time > const T& Signal<T,Time>:: accessCopy( void ) const { - return *Tcopy; + return *Tcopy; } @@ -245,7 +245,7 @@ access(const Time& t) { copyInit=true; signalTime = t; - return setTcopy( *Treference ); + return setTcopy( *Treference ); } else { @@ -265,13 +265,13 @@ access(const Time& t) break; } - case FUNCTION: + case FUNCTION: { if( NULL==providerMutex ) { signalTime = t; - Tfunction(getTwork(),t); - copyInit=true; + Tfunction(getTwork(),t); + copyInit=true; return switchTcopy(); } else @@ -282,7 +282,7 @@ access(const Time& t) boost::try_mutex::scoped_try_lock lock(*providerMutex); #endif signalTime = t; - Tfunction(getTwork(),t); + Tfunction(getTwork(),t); copyInit = true; return switchTcopy(); } @@ -291,9 +291,9 @@ access(const Time& t) } break; } - case CONSTANT: + case CONSTANT: default: - if( this->getReady() ) + if( this->getReady() ) { setReady(false); setTime(t); @@ -312,7 +312,7 @@ Signal<T,Time>& Signal<T,Time>::operator= ( const T& t ) if( NULL==providerMutex ) { setTcopy( t ); - (*TreferenceNonConst)=t; + (*TreferenceNonConst)=t; } else { @@ -330,7 +330,7 @@ Signal<T,Time>& Signal<T,Time>::operator= ( const T& t ) } else { setConstant( t ); } - return *this; + return *this; } @@ -339,7 +339,7 @@ std::ostream& Signal<T,Time>:: display (std::ostream& os) const { os<<"Sig:"<<this->name<<" (Type "; - switch( this->signalType ) + switch( this->signalType ) { case Signal<T,Time>::CONSTANT: os<< "Cst";break; case Signal<T,Time>::REFERENCE: os<<"Ref"; break; diff --git a/include/dynamic-graph/time-dependency.h b/include/dynamic-graph/time-dependency.h index 5a83a01ee00d47db7c4c13321694cb7ce6bacdc5..d5f38efd18179ad7919f36dd22487b9812a9c842 100644 --- a/include/dynamic-graph/time-dependency.h +++ b/include/dynamic-graph/time-dependency.h @@ -22,7 +22,7 @@ #define __TIME_DEPENDENCY_HH #include <list> -#include <iostream> +#include <iostream> #include <dynamic-graph/signal-base.h> #include <dynamic-graph/signal-array.h> @@ -36,7 +36,7 @@ class TimeDependency public: enum DependencyType { - TIME_DEPENDENT, + TIME_DEPENDENT, BOOL_DEPENDENT, ALWAYS_READY }; @@ -65,26 +65,26 @@ class TimeDependency TimeDependency( SignalBase<Time>* sig, const DependencyType dep = DEPENDENCY_TYPE_DEFAULT ); TimeDependency( SignalBase<Time>* sig, - const SignalArray_const<Time>& arr, + const SignalArray_const<Time>& arr, const DependencyType dep = DEPENDENCY_TYPE_DEFAULT ); ~TimeDependency( void ) {} void addDependency( const SignalBase<Time>& sig ); void removeDependency( const SignalBase<Time>& sig ); void clearDependency( void ); - + virtual std::ostream & writeGraph(std::ostream &os) const; std::ostream& displayDependencies( std::ostream& os,const int depth=-1, std::string space="", std::string next1="",std::string next2="" ) const; - + bool needUpdate( const Time& t1 ) const; void setDependencyType( DependencyType dep ) { dependencyType = dep; } - + void setNeedUpdateFromAllChildren( const bool b = true ){ updateFromAllChildren=b; } - bool getNeedUpdateFromAllChildren( void ) const { return updateFromAllChildren; } + bool getNeedUpdateFromAllChildren( void ) const { return updateFromAllChildren; } void setPeriodTime( const Time& p ) { periodTime = p; } Time getPeriodTime( void ) const { return periodTime; } diff --git a/include/dynamic-graph/time-dependency.t.cpp b/include/dynamic-graph/time-dependency.t.cpp index aba523a0aa31ff7812a1e354cf58d9f1a5e74649..0e9cbae3a806f74c954dfd1bbe4183fc481a3d59 100644 --- a/include/dynamic-graph/time-dependency.t.cpp +++ b/include/dynamic-graph/time-dependency.t.cpp @@ -25,7 +25,7 @@ * * CNRS/AIST * - * This file is part of dynamic-graph. + * This file is part of dynamic-graph. * dynamic-graph is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 of @@ -77,7 +77,7 @@ namespace dynamicgraph { ,updateFromAllChildren(ALL_READY_DEFAULT) \ ,dependencyType(dep) \ ,periodTime(PERIOD_TIME_DEFAULT) - + template< class Time > TimeDependency<Time>:: @@ -93,9 +93,9 @@ TimeDependency( SignalBase<Time> * sig ,const DependencyType dep ) :__TIME_DEPENDENCY_INIT(sig,dep) { - for( unsigned int i=0;i<ar.getSize();++i ) + for( unsigned int i=0;i<ar.getSize();++i ) {addDependency( ar[i] ); } - + return ; } @@ -104,26 +104,26 @@ template< class Time > void TimeDependency<Time>:: addDependency( const SignalBase<Time>& sig ) { - dependencies.push_front(&sig); + dependencies.push_front(&sig); } template< class Time > void TimeDependency<Time>:: removeDependency( const SignalBase<Time>& sig ) { - dependencies.remove(&sig); + dependencies.remove(&sig); } template< class Time > void TimeDependency<Time>:: clearDependency( void ) { - dependencies.clear(); + dependencies.clear(); } template< class Time > bool TimeDependency<Time>:: needUpdate( const Time& t1 ) const -{ +{ dgTDEBUG(15) << "# In {" << leader.getName() << " : ("<< leader.getReady()<<") " << t1 << " >? " << leader.getTime() << std::endl; @@ -132,12 +132,12 @@ needUpdate( const Time& t1 ) const switch( dependencyType ) { - case ALWAYS_READY: + case ALWAYS_READY: { dgTDEBUGOUT(15);return true; } case BOOL_DEPENDENT: break; - case TIME_DEPENDENT: + case TIME_DEPENDENT: { - if( t1<leader.getTime()+periodTime ) + if( t1<leader.getTime()+periodTime ) { dgTDEBUGOUT(15);return false; } break; } @@ -193,8 +193,8 @@ displayDependencies( std::ostream& os,const int depth, { case ALWAYS_READY: os<<"A"; break; case BOOL_DEPENDENT: os << "ready=" << ((leader.getReady())?"TRUE":"FALSE"); break; - case TIME_DEPENDENT: - os <<"t="<<leader.getTime() <<" (/"<<periodTime<<") " ; + case TIME_DEPENDENT: + os <<"t="<<leader.getTime() <<" (/"<<periodTime<<") " ; break; }; os<<")"; //<<std::endl; @@ -210,7 +210,7 @@ displayDependencies( std::ostream& os,const int depth, if( it2==dependencies.end() ) { ajout = "`"; ajout2= " "; } (*it)->displayDependencies( os,depth-1,space+next2+" ",ajout,ajout2 ); } - else + else { os<<std::endl<<space<<" `-- ..."; break; } } return os; diff --git a/include/dynamic-graph/tracer-real-time.h b/include/dynamic-graph/tracer-real-time.h index 8a60fdbeec7b55b1cd2f36145b47db7f47578715..c5728cfbab0d07a0888d071e7bfb9d446418560a 100644 --- a/include/dynamic-graph/tracer-real-time.h +++ b/include/dynamic-graph/tracer-real-time.h @@ -35,12 +35,12 @@ /* --- API ------------------------------------------------------------- */ /* --------------------------------------------------------------------- */ -#if defined (WIN32) +#if defined (WIN32) # if defined (tracer_real_time_EXPORTS) # define DGTRACERREALTIME_EXPORT __declspec(dllexport) -# else +# else # define DGTRACERREALTIME_EXPORT __declspec(dllimport) -# endif +# endif #else # define DGTRACERREALTIME_EXPORT #endif @@ -64,19 +64,19 @@ public: public: OutStringStream( void ); - ~OutStringStream( void ); + ~OutStringStream( void ); void resize( const unsigned int & size ); bool addData( const char * data, const unsigned int & size ); void dump( std::ostream& os ); void empty( void ); - + }; class DGTRACERREALTIME_EXPORT TracerRealTime : public Tracer { - public: + public: static const std::string CLASS_NAME; virtual const std::string& getClassName( void ) { return CLASS_NAME; } diff --git a/include/dynamic-graph/tracer.h b/include/dynamic-graph/tracer.h index a9c2cf5340bc1f6f2ca8a5b20ef3cc0d6ff3fd4b..28e0f8055c9d77e81ab75a2cd4b47d821b04c402 100644 --- a/include/dynamic-graph/tracer.h +++ b/include/dynamic-graph/tracer.h @@ -41,12 +41,12 @@ /* --- API ------------------------------------------------------------- */ /* --------------------------------------------------------------------- */ -#if defined (WIN32) +#if defined (WIN32) # if defined (tracer_EXPORTS) # define DGTRACER_EXPORT __declspec(dllexport) -# else +# else # define DGTRACER_EXPORT __declspec(dllimport) -# endif +# endif #else # define DGTRACER_EXPORT #endif @@ -65,11 +65,11 @@ class DGTRACER_EXPORT Tracer SignalList toTraceSignals; - public: + public: static const std::string CLASS_NAME; virtual const std::string& getClassName( void ) { return CLASS_NAME; } - public: + public: enum TraceStyle { WHEN_SAID /// Record, then trace to file only when said to. @@ -110,7 +110,7 @@ class DGTRACER_EXPORT Tracer public: void setTraceStyle( const TraceStyle& style ){ traceStyle = style; } TraceStyle getTraceStyle( void ){ return traceStyle; } - + void setFrenquency( const double& frqu ){ frequency = frqu; } double getFrequency( void ){ return frequency; } diff --git a/src/debug/contiifstream.cpp b/src/debug/contiifstream.cpp index 9a4af7619e236b22a198105d6d9739a00e352cde..3e3d8eaf2e3d62fb1cda2f77bfd44fa80ef289f9 100644 --- a/src/debug/contiifstream.cpp +++ b/src/debug/contiifstream.cpp @@ -40,17 +40,17 @@ loop( void ) { dgDEBUGIN(25); bool res=false; - + std::fstream file( filename.c_str() ); file.seekg(cursor); file.sync(); - + while(1) { file.get(buffer,BUFFER_SIZE); - if( file.gcount() ) - { + if( file.gcount() ) + { res=true; std::string line(buffer); if(! first) reader.push_back(line); @@ -66,8 +66,8 @@ loop( void ) return res; } -std::string -Contiifstream::next( void ) +std::string +Contiifstream::next( void ) { std::string res = *reader.begin(); reader.pop_front(); diff --git a/src/dgraph/entity.cpp b/src/dgraph/entity.cpp index f881c8e7e40c50bd0d8c9844cfeb4347dfdea522..02764fae66efa229ea741f6d3c5f152fab5993e6 100644 --- a/src/dgraph/entity.cpp +++ b/src/dgraph/entity.cpp @@ -36,28 +36,28 @@ const std::string Entity::CLASS_NAME = "Entity"; void Entity:: -entityRegistration( void ) +entityRegistration( void ) { - + //sotPool.entity[name] = this; g_pool.registerEntity(name,this); } void Entity:: -entityDeregistration( void ) +entityDeregistration( void ) { g_pool.deregisterEntity(name); } Entity:: Entity( const string& name__ ) - : name(name__) + : name(name__) { dgDEBUG(15) << "New entity <"<<name__<<">"<<endl; - if( name.length()==0 ) + if( name.length()==0 ) { stringstream oss; oss << rand(); - name = CLASS_NAME; + name = CLASS_NAME; name+="::"; name+=oss.str(); } @@ -79,7 +79,7 @@ Entity:: void Entity:: signalRegistration( const SignalArray<int>& signals ) { - for( unsigned int i=0;i<signals.getSize();++i ) + for( unsigned int i=0;i<signals.getSize();++i ) { SignalBase<int>& sig = signals[i]; //const string& signame = sig.getName(); @@ -154,7 +154,7 @@ getSignal( const string & signame ) const { __DG_ENTITY_GET_SIGNAL__(const_iterator); } - + std::ostream& Entity:: displaySignalList( std::ostream& os ) const @@ -175,7 +175,7 @@ writeGraph( std::ostream& os ) const const SignalMap::const_iterator iterend=signalMap.end(); for( SignalMap::const_iterator iter = signalMap.begin();iterend!=iter;++iter ) { - + (*(iter->second)).writeGraph(os); } return os; @@ -187,7 +187,7 @@ writeCompletionList( std::ostream& os ) const const SignalMap::const_iterator iterend=signalMap.end(); for( SignalMap::const_iterator iter = signalMap.begin();iterend!=iter;++iter ) { - + os << getName() << "." << (*(iter->second)).shortName() << std::endl; } @@ -198,7 +198,7 @@ writeCompletionList( std::ostream& os ) const void Entity:: display( std::ostream& os ) const { - os<<this->getClassName()<<": "<<name; + os<<this->getClassName()<<": "<<name; } std::ostream& dynamicgraph::operator<< (std::ostream& os, const Entity& ent ) @@ -215,7 +215,7 @@ static std::string Entity_COMMAND_LIST = "print\nsignals\nsignalDep"; const std::string& Entity:: getCommandList( void ) const { - return Entity_COMMAND_LIST; + return Entity_COMMAND_LIST; } void Entity:: @@ -235,13 +235,13 @@ commandLine( const std::string& cmdLine,std::istringstream& cmdArgs,std::ostream else if( cmdLine == "signals") { displaySignalList(os); } else if( cmdLine == "signalDep") - { - string sig; cmdArgs>>sig; - cmdArgs >> ws; int depth=-1; + { + string sig; cmdArgs>>sig; + cmdArgs >> ws; int depth=-1; if( cmdArgs.good() ) { cmdArgs >> depth; } getSignal(sig) .displayDependencies( os,depth ); os<<endl; } - else + else { try{ SignalBase<int> & sig = getSignal( cmdLine ); @@ -250,20 +250,20 @@ commandLine( const std::string& cmdLine,std::istringstream& cmdArgs,std::ostream if( cmdArgs.good() ) {cmdArgs >> time;} else {time=0;} sig.recompute( time ); - + os << cmdLine << " = "; sig.get( os ); } catch( ExceptionFactory& e ) { switch( e.getCode() ) { - case ExceptionFactory::UNREFERED_SIGNAL: + case ExceptionFactory::UNREFERED_SIGNAL: DG_THROW ExceptionFactory( ExceptionFactory::UNREFERED_FUNCTION, "The requested function/signal :","<%s> is " "not registered.",cmdLine.c_str() ); break; default: - throw; + throw; } } catch( ... ) { throw; } } - + } diff --git a/src/dgraph/interpreter-helper.cpp b/src/dgraph/interpreter-helper.cpp index a9aa8839a80050f6de752b85ef8519eb023c67ae..43686238b027de5dca18ed20bd607fac47ba30af 100644 --- a/src/dgraph/interpreter-helper.cpp +++ b/src/dgraph/interpreter-helper.cpp @@ -87,21 +87,21 @@ void InterpreterHelper:: cmdDestroy( const std::string& objName, std::ostream& os) { - + dgDEBUG(15) << "Destroy <" << objName <<"> requested."<<endl; delete &( g_pool.getEntity( objName ) ); } void InterpreterHelper:: -cmdLoadPlugin( const std::string& directory, +cmdLoadPlugin( const std::string& directory, const std::string& pluginName, std::ostream& os ) { if( directory.length() != 0 ) dlPtr.setDirectory( directory ); dlPtr.addPlugin( pluginName ); - + try{ dgDEBUG(15) << "Try to load " << pluginName<< endl; dlPtr.loadPlugins(); @@ -130,7 +130,7 @@ cmdUnloadPlugin( const std::string& pluginName, } void InterpreterHelper:: -cmdSetSignal( const std::string& objname, +cmdSetSignal( const std::string& objname, const std::string& signame, const std::string& value, std::ostream& os ) @@ -148,8 +148,8 @@ cmdSetSignal( const std::string& objname, } void InterpreterHelper:: -cmdGetSignal( const std::string& objname, - const std::string& signame, +cmdGetSignal( const std::string& objname, + const std::string& signame, std::ostream& os ) { dgDEBUGIN(15); @@ -164,8 +164,8 @@ cmdGetSignal( const std::string& objname, } void InterpreterHelper:: -cmdComputeSignal( const std::string& objname, - const std::string& signame, +cmdComputeSignal( const std::string& objname, + const std::string& signame, const int &time, std::ostream& os ) { diff --git a/src/dgraph/plugin-loader.cpp b/src/dgraph/plugin-loader.cpp index 0892b6035ae16f14d0260351b30d73454fc93fb8..a633859db914a4e55564753ee51b9e79ebcd894c 100644 --- a/src/dgraph/plugin-loader.cpp +++ b/src/dgraph/plugin-loader.cpp @@ -70,13 +70,13 @@ PluginLoader:: const std::string& PluginLoader:: setDirectory( const std::string& n ) -{ - return pluginDirectory = n; +{ + return pluginDirectory = n; } const std::string& PluginLoader:: getDirectory( void ) { - return pluginDirectory; + return pluginDirectory; } void PluginLoader:: @@ -84,7 +84,7 @@ loadPluginList( const std::string& configFileName, const std::string& dir ) { dgDEBUGIN(15); - + string name; //while (1) ifstream configFile( configFileName.c_str(),ios::in ); @@ -99,13 +99,13 @@ loadPluginList( const std::string& configFileName, const std::string& dir ) { configFile>>name; if(configFile.eof()) break; - dgDEBUG(9)<<"Add <"<< name << "> to the list"<<endl; + dgDEBUG(9)<<"Add <"<< name << "> to the list"<<endl; addPlugin( name,dir); } dgDEBUGOUT(15); } - + void PluginLoader:: addPlugin( const std::string& name, const std::string& dir ) { @@ -139,9 +139,9 @@ loadPlugins( void ) PluginRefMap::plugin_key_type dlib = LoadLibrary ( iter->c_str()); #endif - dgDEBUG(19)<<"Plugin <"<< *iter << "> loaded "<<endl; + dgDEBUG(19)<<"Plugin <"<< *iter << "> loaded "<<endl; - if( NULL==dlib ) + if( NULL==dlib ) { std::string wrongLib = *iter; pluginNames.erase(iter); @@ -152,9 +152,9 @@ loadPlugins( void ) #else // Retrieve the system error message for the last-error code LPTSTR pszMessage; - DWORD dwLastError = GetLastError(); + DWORD dwLastError = GetLastError(); FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, @@ -176,7 +176,7 @@ loadPlugins( void ) #endif } - + loadedPluginNames[*iter] = (*iter); pluginRefs->keyMap[*iter] = dlib; } @@ -210,14 +210,14 @@ unloadPlugin( const std::string& plugname ) if( errCode ) { #ifndef WIN32 - dgDEBUG(1) << "Error while unloading <" << plugname <<"> : " + dgDEBUG(1) << "Error while unloading <" << plugname <<"> : " << dlerror() <<endl; #else // Retrieve the system error message for the last-error code LPTSTR pszMessage; - DWORD dwLastError = GetLastError(); + DWORD dwLastError = GetLastError(); FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, @@ -226,7 +226,7 @@ unloadPlugin( const std::string& plugname ) (LPTSTR)&pszMessage, 0, NULL ); - dgDEBUG(1) << "Error while unloading <" << plugname <<"> : " + dgDEBUG(1) << "Error while unloading <" << plugname <<"> : " << pszMessage <<endl; LocalFree(pszMessage); diff --git a/src/exception/exception-abstract.cpp b/src/exception/exception-abstract.cpp index ddbc843c9f8db1d7af9a95518741cb79cc0e470e..b8f16ab1d2292801ab7fcb2cd32546e739f49fec 100644 --- a/src/exception/exception-abstract.cpp +++ b/src/exception/exception-abstract.cpp @@ -69,7 +69,7 @@ getCode (void) /* ------------------------------------------------------------------------- */ /* --- MODIFIORS ----------------------------------------------------------- */ /* ------------------------------------------------------------------------- */ -#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM +#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM ExceptionAbstract::Param& ExceptionAbstract::Param:: @@ -93,7 +93,7 @@ Param( const int& _line, const char * _function, const char * _file ) { dgDEBUGINOUT(25); } -#endif //#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM +#endif //#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM /* ------------------------------------------------------------------------- */ /* --- OP << --------------------------------------------------------------- */ @@ -107,11 +107,11 @@ operator << (ostream & os, { os << error.getExceptionName()<<"Error [#" << error.code << "]: " << error.message << endl; -#ifdef DYNAMICGRAPH_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 DYNAMICGRAPH_EXCEPTION_PASSING_PARAM +#endif //#ifdef DYNAMICGRAPH_EXCEPTION_PASSING_PARAM return os; } diff --git a/src/plugins/shell-functions.cpp b/src/plugins/shell-functions.cpp index 2690fbfa7f8191d70694db44168be210f6b54b73..caee4289523ff6dcd397db63e564f1965bebb6f3 100644 --- a/src/plugins/shell-functions.cpp +++ b/src/plugins/shell-functions.cpp @@ -72,5 +72,5 @@ extern "C" { ShellFunctionRegisterer regFun19 ( "completion",boost::bind(ShellFunctions::cmdCompletionList,_1,_2,_3) ); -} +} diff --git a/src/plugins/shell-procedure.cpp b/src/plugins/shell-procedure.cpp index 5ae6f7a5a2cd23f68ee3aae9b4ab20222f4b2b74..f98c40369171225867587e2b90fdff6857cf129a 100644 --- a/src/plugins/shell-procedure.cpp +++ b/src/plugins/shell-procedure.cpp @@ -31,7 +31,7 @@ using namespace dynamicgraph; void ShellProcedure:: cmdStartProcedure( const std::string& cmdLine,std::istringstream& args,std::ostream& os ) { - if( cmdLine == "help" ) + if( cmdLine == "help" ) { os << " - proc <name>" << "\t\t\t\tProcedure header." <<endl; @@ -40,12 +40,12 @@ cmdStartProcedure( const std::string& cmdLine,std::istringstream& args,std::ostr args>>procName; dgDEBUG(5)<<"Proc <" <<procName<<">"<<endl; - + currentProc.clear(); args >> ws; while( args.good() ) { - std::string next; + std::string next; args>>next>>ws; currentProc.params.push_back(next); } @@ -54,7 +54,7 @@ cmdStartProcedure( const std::string& cmdLine,std::istringstream& args,std::ostr void ShellProcedure:: cmdContinueProcedure( const std::string& cmdLine,std::istringstream& args,std::ostream& os ) { - if( cmdLine == "help" ) + if( cmdLine == "help" ) { os << " - -> cmd args..." << "\t\t\t\tProcedure body." <<endl; @@ -64,8 +64,8 @@ cmdContinueProcedure( const std::string& cmdLine,std::istringstream& args,std::o std::string cmd2; args>>ws>>cmd2; dgDEBUG(5)<<"Proc <" <<procName<<">: "<<cmd2<<endl; - - Instruction ins; ins.cmd=cmd2; + + Instruction ins; ins.cmd=cmd2; args >> ws; while( args.good() ) { @@ -83,7 +83,7 @@ cmdContinueProcedure( const std::string& cmdLine,std::istringstream& args,std::o void ShellProcedure:: cmdEndProcedure( const std::string& cmdLine,std::istringstream& args,std::ostream& os ) { - if( cmdLine == "help" ) + if( cmdLine == "help" ) { os << " - endproc..." << "\t\t\t\tProcedure end." <<endl; @@ -97,7 +97,7 @@ cmdEndProcedure( const std::string& cmdLine,std::istringstream& args,std::ostrea // for( Procedure::iterator ins=procedureList[ toto ].begin(); // ins!=procedureList[ toto ].end(); ++ins ) // { -// dgDEBUG(15) << "Proc <" << procName << "> : " +// dgDEBUG(15) << "Proc <" << procName << "> : " // << ins->cmd << " -> " << ins->args <<endl; // } @@ -116,15 +116,15 @@ void ShellProcedure:: cmdProcedure( const std::string& procname, const std::string& cmdLine,std::istringstream& args,std::ostream& os ) { - if( cmdLine == "help" ) + if( cmdLine == "help" ) { os<<" - "<<procname<<"\t\t\t\t\tUser-defined procedure"<<endl; - args >> ws; - if( args.good() ) + args >> ws; + if( args.good() ) { std::string argname; - const unsigned int gc = args.tellg(); - args >> argname; + const unsigned int gc = args.tellg(); + args >> argname; args.seekg(gc); args.clear(); if( procname==argname ) { @@ -138,7 +138,7 @@ cmdProcedure( const std::string& procname, ": procedure <%s> not defined.", argname.c_str() ); } - + Procedure & proc = pair->second; unsigned int cmdnum=1; for( std::list<Instruction>::iterator ins=proc.instructions.begin(); @@ -151,7 +151,7 @@ cmdProcedure( const std::string& procname, } } - } + } return; } @@ -177,18 +177,18 @@ cmdProcedure( const std::string& procname, 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; + { + std::string next; args>>next>>ws; paramValue.push_back( next ); dgDEBUG(25) << "Args : <" << next << ">"<<endl; } else { paramValue.push_back(""); } } - istringstream iss; ostringstream oss; + istringstream iss; ostringstream oss; for( std::list<Instruction>::iterator ins=proc.instructions.begin(); ins!=proc.instructions.end(); ++ins ) { @@ -200,7 +200,7 @@ cmdProcedure( const std::string& procname, if( paramArg==-1 ) oss << ins->args[i] << " "; else oss << paramValue[paramArg] << " "; } - + dgDEBUG(15) << " Args = " << oss.str() << endl; iss.str(oss.str()); iss.clear(); g_shell.cmd(ins->cmd,iss,os); @@ -210,7 +210,7 @@ cmdProcedure( const std::string& procname, void ShellProcedure:: cmdFor( const std::string& cmdLine,std::istringstream& args,std::ostream& os ) { - if( cmdLine == "help" ) + if( cmdLine == "help" ) { os << " - for 1 5 instruction "<<endl; return; @@ -221,19 +221,19 @@ cmdFor( const std::string& cmdLine,std::istringstream& args,std::ostream& os ) { 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 ); + 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); + + idx = b1; istart = atoi(b2); iend = atoi(b3); args >> cmd2; - - dgDEBUG(15) << "FOR <" << idx << "> = " << istart << " TO " << iend - << " DO " << cmd2 <<endl; + + dgDEBUG(15) << "FOR <" << idx << "> = " << istart << " TO " << iend + << " DO " << cmd2 <<endl; } string argsstr; @@ -242,12 +242,12 @@ cmdFor( const std::string& cmdLine,std::istringstream& args,std::ostream& os ) args.getline( buffer,SIZE ); argsstr = buffer; } - for( int i=istart;i<=iend;++i ) + for( int i=istart;i<=iend;++i ) { istringstream iss; stringstream oss; - + std::string insp; - istringstream issargs( argsstr ); + istringstream issargs( argsstr ); while( issargs.good() ) { issargs >> insp; @@ -275,5 +275,5 @@ extern "C" { ShellFunctionRegisterer regFun4 ( "for",boost::bind(&ShellProcedure::cmdFor, _1,_2,_3) ); -} +} diff --git a/src/shell/functions.cpp b/src/shell/functions.cpp index 93daa6ff4f51d10240f3ed9167db1fa8add004eb..3f9e3d260fa13102254453eb2bed5572dbb5285a 100644 --- a/src/shell/functions.cpp +++ b/src/shell/functions.cpp @@ -37,7 +37,7 @@ using namespace dynamicgraph; void ShellFunctions:: cmdTry( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) { - if( cmdLine == "help" ) + if( cmdLine == "help" ) { os << " - try <cmd...>" << "\t\t\t\tTry <cmd> and display the caught exception." <<endl; @@ -56,7 +56,7 @@ cmdTry( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) void ShellFunctions:: cmdLoadPlugins( const std::string cmdLine, std::istringstream& cmdArg, std::ostream& os ) { - if( cmdLine == "help" ) + if( cmdLine == "help" ) { os << " - loadPlugins <file.txt> <directory>" << "\t\tLoad the plugins listed in the file." <<endl; @@ -78,7 +78,7 @@ cmdLoadPlugins( const std::string cmdLine, std::istringstream& cmdArg, std::ostr void ShellFunctions:: cmdClearPlugin( const std::string cmdLine, std::istringstream& cmdArg, std::ostream& os ) { - if( cmdLine == "help" ) + if( cmdLine == "help" ) { os << " - clearPlugin <className>" << "\t\tDestroy all the objects of type <className>." <<endl; @@ -94,7 +94,7 @@ cmdClearPlugin( const std::string cmdLine, std::istringstream& cmdArg, std::ostr void ShellFunctions:: cmdDisplayPlugins( const std::string cmdLine, std::istringstream& cmdArg, std::ostream& os ) { - if( cmdLine == "help" ) + if( cmdLine == "help" ) { os << " - displayPlugins " << "\t\t\t\tDisplay the name of the loaded plugins." <<endl; @@ -118,15 +118,15 @@ cmdDisplayPlugins( const std::string cmdLine, std::istringstream& cmdArg, std::o void ShellFunctions:: -cmdDisplayFactory( const std::string cmdLine, std::istringstream& cmdArg, +cmdDisplayFactory( const std::string cmdLine, std::istringstream& cmdArg, std::ostream& os ) { - if( cmdLine == "help" ) + if( cmdLine == "help" ) { os << " - "; g_factory.commandLine(cmdLine,cmdArg,os); return; } - + string cmd2; cmdArg >> cmd2; g_factory.commandLine( cmd2,cmdArg,os ); } @@ -143,7 +143,7 @@ cmdCommentary( const std::string cmdLine, std::istringstream& cmdArg, std::ostre void ShellFunctions:: cmdUnplug( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) { - if( cmdLine == "help" ) + if( cmdLine == "help" ) { os << " - unplug <obj2.sig2>" << "\t\t\t\tPlug on sig2 (consumer) in sig1->sig2." <<endl; @@ -151,7 +151,7 @@ cmdUnplug( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) } string ssig; cmdArg>>ssig; - + string obj2,fun2; istringstream str2(ssig); if( !Interpreter::objectNameParser(str2,obj2,fun2) ) @@ -165,7 +165,7 @@ cmdUnplug( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) Entity& ent2 = g_pool.getEntity(obj2); dgDEBUG(20) << "Get Sig2 <"<<fun2<<"> ."<<endl; SignalBase<int> &sig2 = ent2.getSignal(fun2); - + dgDEBUG(25) << "Unplug..."<<endl; sig2.unplug(); @@ -174,7 +174,7 @@ cmdUnplug( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) void ShellFunctions:: cmdSignalTime( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) { - if( cmdLine == "help" ) + if( cmdLine == "help" ) { os << " - signalTime <obj.sig>" << "\t\t\t\tDisplay the time of sig." <<endl; @@ -183,7 +183,7 @@ cmdSignalTime( const std::string cmdLine, istringstream& cmdArg, std::ostream& o string ssig; cmdArg>>ssig; - + string obj2,fun2; istringstream str2(ssig); if( !Interpreter::objectNameParser(str2,obj2,fun2) ) @@ -197,14 +197,14 @@ cmdSignalTime( const std::string cmdLine, istringstream& cmdArg, std::ostream& o Entity& ent2 = g_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" ) + if( cmdLine == "help" ) { os << " - synchro <obj.sig> [<period>]" << "\t\t\t\tGet/Set the syncho of a signal <sig>." <<endl; @@ -213,15 +213,15 @@ cmdSynchroSignal( const std::string cmdLine, std::istringstream& cmdArg, std::os SignalBase<int> & sig = g_pool.getSignal( cmdArg ); cmdArg >>ws; - if( cmdArg.good() ) + if( cmdArg.good() ) { int period; cmdArg>>period; sig.setPeriodTime( period ); cmdArg >>ws; - if( cmdArg.good() ) + 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. + /* 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 (); @@ -238,15 +238,15 @@ cmdSynchroSignal( const std::string cmdLine, std::istringstream& cmdArg, std::os void ShellFunctions:: cmdEcho( const std::string cmdLine, std::istringstream& cmdArg, std::ostream& os ) { - if( cmdLine == "help" ) + if( cmdLine == "help" ) { os << " - echo <string>" << "\t\t\t\tPrint <string. on the standard output." <<endl; return; } - - cmdArg >>ws; - while( cmdArg.good() ) + + cmdArg >>ws; + while( cmdArg.good() ) { std::string toPrint; cmdArg>>toPrint; os<<toPrint<<" "; @@ -257,7 +257,7 @@ cmdEcho( const std::string cmdLine, std::istringstream& cmdArg, std::ostream& os void ShellFunctions:: cmdCopy( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) { - if( cmdLine == "help" ) + if( cmdLine == "help" ) { os << " - copy <obj1.sig1> <obj2.sig2>" << "\t\tCopy the value of sig1 to constant value in sig2." <<endl; @@ -266,11 +266,11 @@ cmdCopy( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) string ssig1,ssig2; cmdArg>>ssig1>>ssig2; istringstream str1(ssig1),str2(ssig2); - + try { SignalBase<int> &sig1 = g_pool.getSignal( str1 ); SignalBase<int> &sig2 = g_pool.getSignal( str2 ); - + dgDEBUG(25) << "Copy..."<<endl; sig2.plug(&sig1); sig2.setConstantDefault(); @@ -288,7 +288,7 @@ cmdCopy( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) void ShellFunctions:: cmdFreeze( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) { - if( cmdLine == "help" ) + if( cmdLine == "help" ) { os << " - freeze <obj.sig> " << "\t\tOn a ptr-sig: save the current value from the source " @@ -298,10 +298,10 @@ cmdFreeze( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) string ssig1; cmdArg>>ssig1; istringstream str1(ssig1); - + try { SignalBase<int> &sig1 = g_pool.getSignal( str1 ); - + dgDEBUG(25) << "Unplug..."<<endl; sig1.setConstantDefault(); sig1.plug(&sig1); @@ -316,13 +316,13 @@ cmdFreeze( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) void ShellFunctions:: cmdSqueeze( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) { - if( cmdLine == "help" ) + if( cmdLine == "help" ) { os << " - squeeze <mainObj.mainSig> <squeezeObj.sigIn> <squeezeObj.sigOut>" << "\t\tIntercalate squeezeObj between mainObj and its source." <<endl; return; } - + string ssigMain,ssigIn,ssigOut; cmdArg>>ssigMain>>ssigIn>>ssigOut; istringstream strMain(ssigMain); @@ -335,13 +335,13 @@ cmdSqueeze( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) SignalBase<int> &sigOut = g_pool.getSignal( strOut ); SignalBase<int> *sigMainSource = sigMain.getPluged(); - if( sigMainSource==&sigMain ) - { + 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 ); } @@ -358,39 +358,39 @@ cmdSqueeze( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) throw; } } - + } void ShellFunctions:: cmdEnableTrace( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) { - if( cmdLine == "help" ) + if( cmdLine == "help" ) { - os << " - debugtrace [{true|false}] [<filename>=" + 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; + + cmdArg >> ws; if( cmdArg.good() ) { cmdArg>>opt>>ws; if( opt=="true" ) - if( cmdArg.good() ) - { - cmdArg>>filename; + if( cmdArg.good() ) + { + cmdArg>>filename; DebugTrace::openFile( filename.c_str() ); } else { DebugTrace::openFile(); } else DebugTrace::closeFile(); } - else + else { - if( dgDEBUGFLOW.outputbuffer.good() ) os << "true" <<endl; - else os << "false" <<endl; + if( dgDEBUGFLOW.outputbuffer.good() ) os << "true" <<endl; + else os << "false" <<endl; } } @@ -398,18 +398,18 @@ cmdEnableTrace( const std::string cmdLine, istringstream& cmdArg, std::ostream& void ShellFunctions:: cmdSetPrompt( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) { - if( cmdLine == "help" ) + if( cmdLine == "help" ) { - os << " - prompt [<string>] " + os << " - prompt [<string>] " << "\t\tSet/get the default prompt." <<endl; return; } string opt; - cmdArg >> ws; + cmdArg >> ws; if( cmdArg. good() ) { - char buffer [80]; cmdArg .getline(buffer,80); + char buffer [80]; cmdArg .getline(buffer,80); g_shell .prompt = buffer; } else { os << "Current prompt is <" << g_shell. prompt << ">." << endl; } } @@ -417,15 +417,15 @@ cmdSetPrompt( const std::string cmdLine, istringstream& cmdArg, std::ostream& os void ShellFunctions:: cmdSleep( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) { - if( cmdLine == "help" ) + if( cmdLine == "help" ) { - os << " - sleep [<float> secs] " + os << " - sleep [<float> secs] " << "\t\tSleep (time in secs)." <<endl; return; } string opt; - cmdArg >> ws; + cmdArg >> ws; if( cmdArg. good() ) { double secs; cmdArg >> secs; @@ -441,9 +441,9 @@ cmdSleep( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) void ShellFunctions:: cmdBeep( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) { - if( cmdLine == "help" ) + if( cmdLine == "help" ) { - os << " - beep [<float> secs] " + os << " - beep [<float> secs] " << "\t\tSend a bip to the std::cout." <<endl; return; } @@ -454,13 +454,13 @@ cmdBeep( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) void ShellFunctions:: cmdCompletionList( const std::string cmdLine, istringstream& cmdArg, std::ostream& os ) { - if( cmdLine == "help" ) + if( cmdLine == "help" ) { os << " - completion <filename>" << "\t\tGenerate the completion list for current graph." <<endl; return; } - + try { std::string aFileName; cmdArg >> aFileName; diff --git a/src/traces/tracer-real-time.cpp b/src/traces/tracer-real-time.cpp index 23303e440f37f8b24b594bcf4ed2ab050738b8f3..054fe9683bac52724e541881c10379f205e423bf 100644 --- a/src/traces/tracer-real-time.cpp +++ b/src/traces/tracer-real-time.cpp @@ -44,7 +44,7 @@ OutStringStream:: OutStringStream( void ) : std::ostringstream() ,buffer( 0 ),index(0),bufferSize(0),full(false) -{ +{ dgDEBUGINOUT(15); } @@ -70,8 +70,8 @@ bool OutStringStream:: addData( const char * data, const unsigned int & size ) { dgDEBUGIN(15); - unsigned int towrite = size; - if( index+towrite>bufferSize ) + unsigned int towrite = size; + if( index+towrite>bufferSize ) { dgDEBUGOUT(15); full=true; @@ -92,7 +92,7 @@ dump( std::ostream& os ) } void OutStringStream:: -empty( void ) +empty( void ) { dgDEBUGIN(15); index=0; full=false; @@ -111,7 +111,7 @@ TracerRealTime::TracerRealTime( const std::string n ) ,bufferSize( BUFFER_SIZE_DEFAULT ) { dgDEBUGINOUT(15); -} +} /* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */ @@ -124,7 +124,7 @@ openFile( const SignalBase<int> & sig, { dgDEBUGIN(15); string signame; - if( givenname.length() ) + if( givenname.length() ) { signame = givenname; } else { signame = sig.shortName(); } string filename = rootdir + basename + signame + suffix; @@ -156,10 +156,10 @@ closeFiles( void ) while( files.end()!=iter ) { dgDEBUG(25) << "Close the files." << endl; - + std::stringstream * file = dynamic_cast< stringstream* >(*iter); std::ofstream * hardFile = *hardIter; - + (*hardFile) <<flush; hardFile->close(); delete file; delete hardFile; @@ -202,9 +202,9 @@ trace( void ) if( (hardFile.good())&&(NULL!=file) ) { - + // const unsigned int SIZE = 1024*8; -// char buffer[SIZE]; +// char buffer[SIZE]; // streambuf * pbuf = file.rdbuf(); // pbuf->pubseekpos(0); // const unsigned int NB_BYTE = pbuf->in_avail(); @@ -239,12 +239,12 @@ emptyBuffers( void ) { dgDEBUGIN(15); for( FileList::iterator iter = files.begin();files.end()!=iter;++iter ) - { + { //std::stringstream & file = * dynamic_cast< stringstream* >(*iter); try { - OutStringStream & file = * dynamic_cast< OutStringStream* >(*iter); + OutStringStream & file = * dynamic_cast< OutStringStream* >(*iter); file.empty(); - //file.str(""); + //file.str(""); } catch( ... ) { DG_THROW ExceptionTraces( ExceptionTraces::NOT_OPEN, "The buffer is not open",""); } @@ -258,7 +258,7 @@ emptyBuffers( void ) // { // streambuf * pbuf = file.rdbuf(); // pbuf->file.rdbuf() ->pubsetbuf( fileBuffer,10 ); - + // } @@ -269,7 +269,7 @@ recordSignal( std::ostream& os, dgDEBUGIN(15); try { - + OutStringStream & file = dynamic_cast< OutStringStream& >(os); file.str(""); dgDEBUG(45) << "Empty file [" << file.tellp() @@ -283,9 +283,9 @@ recordSignal( std::ostream& os, } catch( ExceptionAbstract & exc ) { throw exc; } catch( ... ) { DG_THROW ExceptionTraces( ExceptionTraces::NOT_OPEN, - "The buffer is not open",""); + "The buffer is not open",""); } - + dgDEBUGOUT(15); return ; @@ -300,7 +300,7 @@ recordSignal( std::ostream& os, void TracerRealTime:: display( std::ostream& os ) const { - os << CLASS_NAME << " " << name << " [mode=" << (play?"play":"pause") + os << CLASS_NAME << " " << name << " [mode=" << (play?"play":"pause") << "] : "<< endl << " - Dep list: "<<endl; @@ -313,7 +313,7 @@ display( std::ostream& os ) const os << " -> "<<(*iter)->getName(); if( file->givenname.length() ) os << " (in " << file->givenname << ")" ; os << "\t"; - if( file ) + if( file ) { const std::streamsize PRECISION = os.precision(); const unsigned int SIZE = file->index; @@ -323,16 +323,16 @@ display( std::ostream& os ) const else if( (SIZE>>20)||(MSIZE>>20) ) { dec = 20; unit="Mo"; } else if( (SIZE>>10)||(MSIZE>>10) ) { dec = 10; unit="Ko"; } os << "[" << std::setw(1)<<std::setprecision(1) - << ((SIZE+0.0)/(1<<dec)) << unit << "/" - << std::setprecision(2)<<((MSIZE+0.0)/(1<<dec)) + << ((SIZE+0.0)/(1<<dec)) << unit << "/" + << std::setprecision(2)<<((MSIZE+0.0)/(1<<dec)) << unit << "]\t"; if( file->full ) os << "(FULL)"; os.precision(PRECISION); } - os<<endl; + os<<endl; iterFile++; } - + } @@ -353,26 +353,26 @@ commandLine( const std::string& cmdLine os << "TracerRealTime: "<<endl << " - empty: trash the buffers." <<endl << " - bufferSize [<size>]: get/set the buffer size." <<endl; - + Tracer::commandLine( cmdLine,cmdArgs,os ); } - else if( cmdLine=="empty" ) + else if( cmdLine=="empty" ) { emptyBuffers(); } - else if( cmdLine=="bufferSize" ) + else if( cmdLine=="bufferSize" ) { cmdArgs>>ws; - if( cmdArgs.good() ) + if( cmdArgs.good() ) { - int s; cmdArgs>>s; + int s; cmdArgs>>s; setBufferSize( s ); } else os << getBufferSize() << endl; } - else + else Tracer::commandLine( cmdLine,cmdArgs,os ); diff --git a/src/traces/tracer.cpp b/src/traces/tracer.cpp index 8e5a7ab7b2d269c81234322d2575fdbcce2d82b7..b44b41a2631775a5599c2ee39b2ed4b3a25ef04c 100644 --- a/src/traces/tracer.cpp +++ b/src/traces/tracer.cpp @@ -56,7 +56,7 @@ Tracer::Tracer( const std::string n ) "Tracer("+n+")::triger" ) { signalRegistration( triger ); -} +} /* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */ @@ -73,11 +73,11 @@ addSignalToTrace( const SignalBase<int>& sig, if( namesSet ) openFile( sig,filename ); triger.addDependency( sig ); dgDEBUGOUT(15); -} +} /*! Empty the list of signals to trace. This function * does not modify the file list (it does not close - * the files in particular. + * the files in particular. */ void Tracer:: clearSignalToTrace( void ) @@ -101,7 +101,7 @@ openFiles( const std::string& rootdir_, const std::string& basename_, int n = rootdir_.length(); rootdir=rootdir_; if( (0<n)&('/'!=rootdir[n-1]) ) rootdir+='/'; - + basename=basename_; suffix=suffix_; @@ -113,7 +113,7 @@ openFiles( const std::string& rootdir_, const std::string& basename_, { dgDEBUG(15) << "Open <" << (*iter)->getName() << "> in <" << *iterName << ">." << std::endl; - openFile( **iter,*iterName ); + openFile( **iter,*iterName ); ++iter; ++iterName; } @@ -127,7 +127,7 @@ openFile( const SignalBase<int> & sig, { dgDEBUGIN(15); string signame; - if( givenname.length() ) + if( givenname.length() ) { signame = givenname; } else { signame = sig.shortName(); } string filename = rootdir + basename + signame + suffix; @@ -143,7 +143,7 @@ void Tracer:: closeFiles( void ) { dgDEBUGIN(15); - + for( FileList::iterator iter = files.begin();files.end()!=iter;++iter ) { std::ostream * filePtr = *iter; @@ -164,7 +164,7 @@ record( void ) if(! play) { dgDEBUGINOUT(15); return;} dgDEBUGIN(15); - + if( files.size()!=toTraceSignals.size() ) { DG_THROW ExceptionTraces( ExceptionTraces::NOT_OPEN, "No files open for tracing"," (file=%d != %d=sig).", @@ -176,7 +176,7 @@ record( void ) while( toTraceSignals.end()!=iterSig ) { dgDEBUG(45) << "Try..." <<endl; - recordSignal( **iterFile,**iterSig ); + recordSignal( **iterFile,**iterSig ); ++iterSig; ++iterFile; } dgDEBUGOUT(15); @@ -187,17 +187,17 @@ recordSignal( std::ostream& os, const SignalBase<int>& sig ) { dgDEBUGIN(15); - - try { - if( sig.getTime()>timeStart ) + + try { + if( sig.getTime()>timeStart ) { - os<< sig.getTime() << "\t"; + os<< sig.getTime() << "\t"; sig.trace(os); os<<endl; } } catch( ExceptionAbstract& exc ) { os << exc << std::endl; } catch( ... ) { os << "Unknown error occured while reading signal." << std::endl; } - + dgDEBUGOUT(15); } @@ -226,12 +226,12 @@ trace( void ) void Tracer:: display( std::ostream& os ) const { - os << CLASS_NAME << " " << name << " [mode=" << (play?"play":"pause") + os << CLASS_NAME << " " << name << " [mode=" << (play?"play":"pause") << "] : "<< endl << " - Dep list: "<<endl; for( SignalList::const_iterator iter = toTraceSignals.begin(); toTraceSignals.end()!=iter;++iter ) - { os << " -> "<<(*iter)->getName()<<endl; } + { os << " -> "<<(*iter)->getName()<<endl; } } @@ -258,7 +258,7 @@ commandLine( const std::string& cmdLine << " - trace "<<endl << " - start/stop" << endl; // << " - parasite <obj.signal> "<<endl; - + Entity::commandLine( cmdLine,cmdArgs,os ); } else if( cmdLine=="add" ) @@ -268,11 +268,11 @@ commandLine( const std::string& cmdLine addSignalToTrace(sig,r); dgDEBUG(14)<<"Add <" <<sig.getName()<<"> with nick \""<<r<<"\""<<endl; } - else if( cmdLine=="clear" ) + else if( cmdLine=="clear" ) { closeFiles(); toTraceSignals.clear(); } else if( cmdLine=="open" ) { - string n,r="",s=".dat"; + string n,r="",s=".dat"; cmdArgs>>ws>>r; if( cmdArgs.good() ) { @@ -283,7 +283,7 @@ commandLine( const std::string& cmdLine } } - //>>r>>s; + //>>r>>s; dgDEBUGF( 15,"Close files."); closeFiles(); dgDEBUGF( 15,"Open files \"%s\" \"%s\" \"%s\".", @@ -292,26 +292,26 @@ commandLine( const std::string& cmdLine } else if( cmdLine=="close" ) { closeFiles(); } else if( cmdLine=="trace" ) { trace(); } - else if( cmdLine=="record" ) - { + else if( cmdLine=="record" ) + { //unsigned int t; //cmdArgs >> ws>>t; if(! cmdArgs.good() ) t=0; record(); } -// else if( cmdLine=="parasite" ) +// else if( cmdLine=="parasite" ) // { // SignalBase<int> &sig = g_pool.getSignal( cmdArgs ); // parasite(sig); // } else if( cmdLine == "start" ) { play=true; } else if( cmdLine == "stop" ) { play=false; } - else if( cmdLine == "timeStart" ) + else if( cmdLine == "timeStart" ) { cmdArgs >> std::ws; if(! cmdArgs.good() ) { os << "timeStart = " << timeStart << std::endl; } else { cmdArgs >> timeStart; } } - + else //sotTaskAbstract:: Entity::commandLine( cmdLine,cmdArgs,os ); diff --git a/tools/dg-shell.cpp b/tools/dg-shell.cpp index 9cc7d215e2c08bebf6ca5ec469b63c9709102b12..07907a50749bf866feaed557ceed4bed436ad171 100644 --- a/tools/dg-shell.cpp +++ b/tools/dg-shell.cpp @@ -25,7 +25,7 @@ * * CNRS/AIST * - * This file is part of dynamic-graph. + * This file is part of dynamic-graph. * dynamic-graph is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 of @@ -76,7 +76,7 @@ extern std::ofstream debugfile; int main( int argc,char** argv ) { dgDEBUGIN(15); - + dgDEBUG(5) << " Loading..." << endl; PluginLoader pl; g_shell.referencePluginLoader( &pl ); @@ -90,7 +90,7 @@ int main( int argc,char** argv ) cout << "Run "<< argv[fileIdx] << endl; g_shell.cmd( "run",script,cout ); } - } + } catch( exception& e ) { cout << "!! In file <" << argv[fileIdx] << "> : " << e.what() <<endl; @@ -100,7 +100,7 @@ int main( int argc,char** argv ) << "Unknown exception " << str << endl; } catch( ... ){ dgDEBUG(5) << "!! Unknown! " <<endl ; } - + while(1) { try @@ -109,7 +109,7 @@ int main( int argc,char** argv ) g_shell.shell(cin,cout); dgDEBUG(5) << "Shell over." << endl; if( cin.eof() ) break; - } + } catch( exception& e ) { cout << "!! " << e.what() <<endl; diff --git a/unitTesting/test_depend.cpp b/unitTesting/test_depend.cpp index 09c3442324d55df94c8c88947ffca8378743297a..2f897faec713b4d97efecf4c99ac1ded493b01a7 100644 --- a/unitTesting/test_depend.cpp +++ b/unitTesting/test_depend.cpp @@ -46,16 +46,16 @@ public: public: DummyClass( const std::string& n ) : proname(n),res(),appel(0),timedata(0) {} - Res& fun( Res& res,int t) + Res& fun( Res& res,int t) { - appel++; timedata=t; + appel++; timedata=t; - cout << "Inside " << proname << " -> " << this + cout << "Inside " << proname << " -> " << this << endl; for( list< SignalTimeDependent<double,int>* >::iterator it=inputsig.begin(); it!=inputsig.end();++it ) { - cout << *(*it) << endl; + cout << *(*it) << endl; (*it)->access(timedata); } for( list< SignalTimeDependent<string,int>* >::iterator it=inputsigV.begin(); @@ -75,7 +75,7 @@ public: Res res; int appel; int timedata; - + }; template< class Res > @@ -103,7 +103,7 @@ int main( void ) SignalTimeDependent<double,int> sig5("Sig5"); SignalTimeDependent<string,int> sig6("Sig6"); - + SignalTimeDependent<string,int> sig4(sig5,"Sig4"); SignalTimeDependent<string,int> sig2(sig4<<sig4<<sig4<<sig6,"Sig2"); SignalTimeDependent<double,int> sig3(sig2<<sig5<<sig6,"Sig3"); @@ -132,15 +132,15 @@ int main( void ) pro2.add(sig6); pro3.add(sig5); pro3.add(sig6); - + sig5.setDependencyType(TimeDependency<int>::ALWAYS_READY); sig6.setDependencyType(TimeDependency<int>::BOOL_DEPENDENT); sig6.setReady(); sig1.displayDependencies(cout)<<endl; - - cout << "Needs update?" << endl + + cout << "Needs update?" << endl << sig1.needUpdate(2) << endl; dgDEBUG(1) << "Access sig1(2) "<<endl; sig1.access(2);