Skip to content
Snippets Groups Projects
Commit 7dd62e30 authored by Nicolas Mansard's avatar Nicolas Mansard
Browse files

Added new-style command for the two entities.

parent a0b5c3bc
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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);
}
/* --------------------------------------------------------------------- */
......
......@@ -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 );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment