diff --git a/include/dynamic-graph/tracer.h b/include/dynamic-graph/tracer.h index a56d627bb756387c7d4cdc5e74e0ab215182725e..486526f7ab16c9567e413a8169f327ca27cd9d1c 100644 --- a/include/dynamic-graph/tracer.h +++ b/include/dynamic-graph/tracer.h @@ -98,6 +98,8 @@ namespace dynamicgraph int& recordTrigger( int& dummy, const int& time ); virtual void trace (); + void start() { play = true ; } + void stop() { play = false; } public: //SignalTrigerer<int> triger; diff --git a/src/traces/tracer-real-time.cpp b/src/traces/tracer-real-time.cpp index a71ed467f5ec15297a9341aff3dce3fb2b7179ea..b168157662d68f160de90c7e3049fd7be1b78dc4 100644 --- a/src/traces/tracer-real-time.cpp +++ b/src/traces/tracer-real-time.cpp @@ -30,6 +30,7 @@ #include <dynamic-graph/debug.h> #include <dynamic-graph/pool.h> #include <dynamic-graph/factory.h> +#include <dynamic-graph/all-commands.h> using namespace std; using namespace dynamicgraph; @@ -116,6 +117,24 @@ TracerRealTime::TracerRealTime( const std::string n ) ,bufferSize( BUFFER_SIZE_DEFAULT ) { dgDEBUGINOUT(15); + + /* --- Commands --- */ + { + using namespace dynamicgraph::command; + std::string doc + = docCommandVoid0("Trash the current content of the buffers, without saving it."); + addCommand("empty", + makeCommandVoid0(*this,&TracerRealTime::emptyBuffers,doc )); + + addCommand("getBufferSize", + makeDirectGetter(*this,&bufferSize, + docDirectGetter("bufferSize","int"))); + addCommand("setBufferSize", + makeDirectSetter(*this,&bufferSize, + docDirectSetter("bufferSize","int"))); + } // using namespace command + + dgDEBUGOUT(15); } /* --------------------------------------------------------------------- */ diff --git a/src/traces/tracer.cpp b/src/traces/tracer.cpp index 23dfa18c53cb15be83e5d174ab34656705749445..c4cb373b8b77145a8b310a47e6e1943eb42479d1 100644 --- a/src/traces/tracer.cpp +++ b/src/traces/tracer.cpp @@ -27,6 +27,7 @@ #include <dynamic-graph/debug.h> #include <dynamic-graph/pool.h> #include <dynamic-graph/factory.h> +#include <dynamic-graph/all-commands.h> #include <boost/bind.hpp> using namespace std; @@ -56,6 +57,57 @@ Tracer::Tracer( const std::string n ) "Tracer("+n+")::triger" ) { signalRegistration( triger ); + + + /* --- Commands --- */ + { + using namespace dynamicgraph::command; + std::string doc; + + doc = docCommandVoid2("Add a new signal to trace.", + "string (signal name)","string (filename, empty for default"); + addCommand("add", + makeCommandVoid2(*this,&Tracer::addSignalToTraceByName,doc )); + + doc = docCommandVoid0("Remove all signals. If necessary, close open files."); + addCommand("clear", + makeCommandVoid0(*this,&Tracer::clearSignalToTrace,doc )); + + doc = docCommandVoid3("Gives the args for file opening, and " + "if signals have been set, open the corresponding files.", + "string (dirname)","string (prefix)","string (suffix)"); + addCommand("open", + makeCommandVoid3(*this,&Tracer::openFiles,doc )); + + doc = docCommandVoid0("Close all the open files."); + addCommand("close", + makeCommandVoid0(*this,&Tracer::closeFiles,doc )); + + doc = docCommandVoid0("If necessary, dump " + "(can be done automatically for some traces type)."); + addCommand("dump", + makeCommandVoid0(*this,&Tracer::trace,doc )); + + doc = docCommandVoid0("Start the tracing process."); + addCommand("start", + makeCommandVoid0(*this,&Tracer::start,doc )); + + doc = docCommandVoid0("Stop temporarily the tracing process."); + addCommand("stop", + makeCommandVoid0(*this,&Tracer::stop,doc )); + + + doc = docCommandVoid0("Stop temporarily the tracing process."); + addCommand("stop", + makeCommandVoid0(*this,&Tracer::stop,doc )); + + addCommand("getTimeStart", + makeDirectGetter(*this,&timeStart, + docDirectGetter("timeStart","int"))); + addCommand("setTimeStart", + makeDirectSetter(*this,&timeStart, + docDirectSetter("timeStart","int"))); + } // using namespace command } /* --------------------------------------------------------------------- */ @@ -93,11 +145,11 @@ addSignalToTraceByName( const string& signame, void Tracer:: clearSignalToTrace () { + closeFiles (); toTraceSignals.clear (); triger.clearDependencies (); } - // void Tracer:: // parasite( SignalBase<int>& sig ) // { @@ -314,8 +366,6 @@ commandLine( const std::string& cmdLine { os << "timeStart = " << timeStart << std::endl; } else { cmdArgs >> timeStart; } } - - else //sotTaskAbstract:: Entity::commandLine( cmdLine,cmdArgs,os );