diff --git a/include/dynamic-graph/contiifstream.h b/include/dynamic-graph/contiifstream.h index 6e91d4137a64860d0f71524d4ef2ce72110b3790..013b8fdcc8a34a8ba6c014631545ff2ca8388c25 100644 --- a/include/dynamic-graph/contiifstream.h +++ b/include/dynamic-graph/contiifstream.h @@ -33,16 +33,20 @@ namespace dynamicgraph { + /// \ingroup debug + /// + /// \brief TODO + /// class DG_CONTIIFSTREAM_DLLAPI Contiifstream { public: - explicit Contiifstream (const std::string& n=""); + explicit Contiifstream (const std::string& n = ""); ~Contiifstream (); inline void open (const std::string& n) { - filename=n; - cursor=0; + filename = n; + cursor = 0; } bool loop (); diff --git a/include/dynamic-graph/signal-time-dependent.h b/include/dynamic-graph/signal-time-dependent.h index ad71f81f7b401cb2d347a12b4a71776995592eb2..f9f4b1d09fa7e1f46899591c9005f79067315beb 100644 --- a/include/dynamic-graph/signal-time-dependent.h +++ b/include/dynamic-graph/signal-time-dependent.h @@ -96,7 +96,7 @@ namespace dynamicgraph ,std::string name ) :Signal<T,Time>(name) ,TimeDependency<Time>(this,sig) - { setFunction(t); } + { this->setFunction(t); } template< class T,class Time> const T& SignalTimeDependent<T,Time>:: diff --git a/include/dynamic-graph/signal.t.cpp b/include/dynamic-graph/signal.t.cpp index 1b9f067d7aaaa50aa26351c71fbbd54c0c5ad432..6aa555e2f24ac903553baf130b86684c0dcf066f 100644 --- a/include/dynamic-graph/signal.t.cpp +++ b/include/dynamic-graph/signal.t.cpp @@ -252,7 +252,7 @@ namespace dynamicgraph if( this->getReady () ) { setReady(false); - setTime(t); + this->setTime(t); } return accessCopy (); }; diff --git a/include/dynamic-graph/tracer-real-time.h b/include/dynamic-graph/tracer-real-time.h index 4fb91bb42762e55d4a770c6f30cfa50820e772ad..64f553f7cb60446db4a7da63cc9fe70aeaea126a 100644 --- a/include/dynamic-graph/tracer-real-time.h +++ b/include/dynamic-graph/tracer-real-time.h @@ -29,8 +29,8 @@ namespace dynamicgraph { public: char* buffer; - size_t index; - size_t bufferSize; + std::streamsize index; + std::streamsize bufferSize; bool full; std::string givenname; @@ -38,7 +38,7 @@ namespace dynamicgraph OutStringStream (); ~OutStringStream (); - void resize (const unsigned int & size); + void resize (const std::streamsize& size); bool addData (const char * data, const std::streamoff& size); void dump (std::ostream& os); void empty (); diff --git a/src/debug/contiifstream.cpp b/src/debug/contiifstream.cpp index b4cd34c6de429e4b80af4c348e891a1219a8627d..ec73c71dc18d671f739eea2104498f4b0613c7db 100644 --- a/src/debug/contiifstream.cpp +++ b/src/debug/contiifstream.cpp @@ -1,80 +1,73 @@ -/* - * Copyright 2010, - * François Bleibel, - * Olivier Stasse, - * - * CNRS/AIST - * - * 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 - * the License, or (at your option) any later version. - * dynamic-graph is distributed in the hope that it will be - * useful, but WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. You should - * have received a copy of the GNU Lesser General Public License along - * with dynamic-graph. If not, see <http://www.gnu.org/licenses/>. - */ +// Copyright 2010, François Bleibel, Thomas Moulard, Olivier Stasse, +// JRL, CNRS/AIST. +// +// 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 +// the License, or (at your option) any later version. +// +// dynamic-graph is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Lesser Public License for more details. You should have +// received a copy of the GNU Lesser General Public License along with +// dynamic-graph. If not, see <http://www.gnu.org/licenses/>. #include <dynamic-graph/contiifstream.h> #include <dynamic-graph/debug.h> -using namespace dynamicgraph; - -Contiifstream:: -Contiifstream( const std::string& n ) - :filename(n),cursor(0),first(true) {} - - -Contiifstream:: -~Contiifstream () +namespace dynamicgraph { - dgDEBUGINOUT(5); -} - - -bool Contiifstream:: -loop () -{ - 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 () ) - { - res=true; - std::string line(buffer); - if(! first) reader.push_back(line); - cursor=file.tellg (); cursor++; - file.get(*buffer); // get the last char ( = '\n') - dgDEBUG(15) << "line: "<< line<<std::endl; - } - else { break; } - } - - first=false; - dgDEBUGOUT(25); - return res; -} - -std::string -Contiifstream::next () -{ - std::string res = *reader.begin (); - reader.pop_front (); - return res; -} - - - - - + Contiifstream::Contiifstream (const std::string& n) + : filename (n), + cursor (0), + first (true) + {} + + Contiifstream::~Contiifstream () + { + dgDEBUGINOUT(5); + } + + bool + Contiifstream::loop () + { + 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 ()) + { + res = true; + std::string line (buffer); + if (! first) + reader.push_back (line); + cursor=file.tellg (); + ++cursor; + file.get (*buffer); // get the last char ( = '\n') + dgDEBUG(15) << "line: "<< line<<std::endl; + } + else + break; + } + + first = false; + dgDEBUGOUT(25); + return res; + } + + std::string + Contiifstream::next () + { + std::string res = *reader.begin (); + reader.pop_front (); + return res; + } +} // end of namespace dynamicgraph. diff --git a/src/plugins/shell-procedure.cpp b/src/plugins/shell-procedure.cpp index 5c9a47c1d9693df9df25f8ea663c02348d5201e4..38f00a1142f0e0816b087734bed3562b319d341e 100644 --- a/src/plugins/shell-procedure.cpp +++ b/src/plugins/shell-procedure.cpp @@ -69,12 +69,19 @@ cmdContinueProcedure( const std::string& cmdLine,std::istringstream& args,std::o 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 ); + 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 = (int) i; + break; + } + } + ins.args.push_back (next); + ins.params.push_back (param); } currentProc.instructions.push_back( ins ); @@ -198,7 +205,7 @@ cmdProcedure( const std::string& procname, { int paramArg = ins->params[i]; if( paramArg==-1 ) oss << ins->args[i] << " "; - else oss << paramValue[paramArg] << " "; + else oss << paramValue[(size_t) paramArg] << " "; } dgDEBUG(15) << " Args = " << oss.str () << endl; diff --git a/src/shell/functions.cpp b/src/shell/functions.cpp index 4bd20d21879b3d745293d9b2f0b5f996bc98fc21..308cfa7e5714626028e7d8a00475032641c370a3 100644 --- a/src/shell/functions.cpp +++ b/src/shell/functions.cpp @@ -38,7 +38,8 @@ using namespace dynamicgraph; static const char* NO_PLUGINLOADER_ERROR_MSG = "!! Dynamic loading functionalities not accessible through the shell."; -static void sleep (int secs) +static void sleep_ (unsigned int secs); +static void sleep_ (unsigned int secs) { #ifndef WIN32 usleep(secs * 1000000); @@ -541,11 +542,11 @@ ShellFunctions::cmdSleep (const std::string cmdLine, double secs = 0.; cmdArg >> secs; - typedef boost::numeric::converter<int, double> Double2Int; - int secs_ = Double2Int::convert (secs); + typedef boost::numeric::converter<unsigned int, double> Double2Int; + unsigned int secs_ = Double2Int::convert (secs); if (secs_ > 0) - sleep (secs_); + sleep_ (secs_); } void diff --git a/src/traces/tracer-real-time.cpp b/src/traces/tracer-real-time.cpp index 94beb98cd4da9171983dc810d4bcbce802505619..a71ed467f5ec15297a9341aff3dce3fb2b7179ea 100644 --- a/src/traces/tracer-real-time.cpp +++ b/src/traces/tracer-real-time.cpp @@ -57,7 +57,7 @@ OutStringStream:: } void OutStringStream:: -resize( const unsigned int & size ) +resize (const std::streamsize& size) { dgDEBUGIN(15); @@ -66,27 +66,27 @@ resize( const unsigned int & size ) full=false; delete[] buffer; - buffer = new char [size]; + buffer = new char[static_cast<size_t> (size)]; dgDEBUGOUT(15); } bool OutStringStream:: -addData( const char * data, const std::streamoff& size ) +addData (const char * data, const std::streamoff& size) { dgDEBUGIN(15); - size_t towrite = static_cast<size_t> (size); - if( index+towrite>bufferSize ) + std::streamsize towrite = static_cast<std::streamsize> (size); + if (index + towrite > bufferSize) { dgDEBUGOUT(15); - full=true; + full = true; return false; - }//towrite=bufferSize-index; - memcpy( buffer+index,data,towrite ); - index+=towrite; + } + memcpy (buffer + index, data, static_cast<size_t> (towrite)); + index += towrite; dgDEBUGOUT(15); return true; - } +} void OutStringStream:: dump( std::ostream& os ) @@ -321,8 +321,8 @@ display( std::ostream& os ) const if( file ) { const std::streamsize PRECISION = os.precision (); - const unsigned int SIZE = file->index; - const unsigned int MSIZE = file->bufferSize; + const std::streamsize SIZE = file->index; + const std::streamsize MSIZE = file->bufferSize; unsigned int dec=0; std::string unit =""; if( (SIZE>>30)||(MSIZE>>30) ) { dec = 30; unit="Go"; } else if( (SIZE>>20)||(MSIZE>>20) ) { dec = 20; unit="Mo"; } diff --git a/src/traces/tracer.cpp b/src/traces/tracer.cpp index dc01df8e32f2b7de840f2bcf6def84504d482d71..c755759def9e1acdc4ffe3e1dcc24208daebd828 100644 --- a/src/traces/tracer.cpp +++ b/src/traces/tracer.cpp @@ -98,8 +98,8 @@ openFiles( const std::string& rootdir_, const std::string& basename_, const std::string& suffix_ ) { dgDEBUGIN(15); - int n = rootdir_.length (); - rootdir=rootdir_; + unsigned int n = rootdir_.length (); + rootdir = rootdir_; if( (0<n)&('/'!=rootdir[n-1]) ) rootdir+='/'; basename=basename_; diff --git a/tests/signal-cast-registerer.cpp b/tests/signal-cast-registerer.cpp index eda97b1e88f159b6654c1066dd06d04a92940fbc..f171ed20739deddc422e68006637bdb67213e698 100644 --- a/tests/signal-cast-registerer.cpp +++ b/tests/signal-cast-registerer.cpp @@ -142,7 +142,7 @@ BOOST_AUTO_TEST_CASE (custom_vector_registerer) BOOST_CHECK (output.is_equal ("Sig:vector (Type Cst)")); } - for (int i = 0; i < 5; ++i) + for (unsigned int i = 0; i < 5; ++i) { ublas::unit_vector<double> v (5, i); std::ostringstream os;