Go to the documentation of this file.
22 #include <boost/bind.hpp>
34 Tracer::Tracer(
const std::string n)
37 traceStyle(TRACE_STYLE_DEFAULT),
47 triger(
"Tracer(" + n +
")::triger") {
56 doc =
docCommandVoid2(
"Add a new signal to trace.",
"string (signal name)",
57 "string (filename, empty for default");
67 "Gives the args for file opening, and "
68 "if signals have been set, open the corresponding files.",
69 "string (dirname)",
"string (prefix)",
"string (suffix)");
77 "(can be done automatically for some traces type).");
100 const string &filename) {
106 names.push_back(filename);
112 const string &filename) {
114 istringstream iss(signame);
137 const std::string &basename_,
138 const std::string &suffix_) {
150 NameList::const_iterator iterName =
names.begin();
152 dgDEBUG(15) <<
"Open <" << (*iter)->getName() <<
"> in <" << *iterName
153 <<
">." << std::endl;
164 const string &givenname) {
167 if (givenname.length()) {
170 signame =
sig.shortName();
175 dgDEBUG(5) <<
"Sig <" <<
sig.getName() <<
">: new file " << filename << endl;
176 std::ofstream *newfile =
new std::ofstream(filename.c_str());
177 files.push_back(newfile);
183 std::lock_guard<std::mutex> files_lock(
files_mtx);
185 for (FileList::iterator iter =
files.begin();
files.end() != iter; ++iter) {
186 std::ostream *filePtr = *iter;
208 std::unique_lock<std::mutex> files_lock(
files_mtx, std::try_to_lock);
209 if (!files_lock.owns_lock()) {
217 " (file=%d != %d=sig).",
files.size(),
221 FileList::iterator iterFile =
files.begin();
225 dgDEBUG(45) <<
"Try..." << endl;
238 os <<
sig.getTime() <<
"\t";
243 os << exc << std::endl;
245 os <<
"Unknown error occurred while reading signal." << std::endl;
252 dgDEBUGIN(15) <<
" time=" << time << endl;
265 os << CLASS_NAME <<
" " <<
name <<
" [mode=" << (
play ?
"play" :
"pause")
267 <<
" - Dep list: " << endl;
270 os <<
" -> " << (*iter)->getName() << endl;
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(Tracer, "Tracer")
SignalBase< sigtime_t > & getSignal(std::istringstream &sigpath)
Get a signal by name.
virtual void closeFiles()
sigtime_t & recordTrigger(sigtime_t &dummy, const sigtime_t &time)
void addSignalToTraceByName(const std::string &signame, const std::string &filename="")
void dgDEBUGF(const int, const char *,...)
void display(std::ostream &os) const
Display information on the entity inside the output stream os.
This class represents an entity, i.e. a generic computational unit that provides input and output sig...
CommandVoid3< E, T1, T2, T3 > * makeCommandVoid3(E &entity, typename CommandVoid3< E, T1, T2, T3 >::function_t function, const std::string &docString)
std::string docCommandVoid0(const std::string &doc)
void clearSignalToTrace()
void addSignalToTrace(const SignalBase< sigtime_t > &sig, const std::string &filename="")
DirectGetter< E, T > * makeDirectGetter(E &entity, T *ptr, const std::string &docString)
SignalList toTraceSignals
Abstract root class for all dynamic-graph exceptions.
virtual void addDependency(const SignalBase< Time > &signal)
std::string docCommandVoid3(const std::string &doc, const std::string &type1, const std::string &type2, const std::string &type3)
dynamicgraph::SignalArray_const< double > sig
#define dgDEBUGOUT(level)
#define dgDEBUGIN(level)
VP_DEBUG.
std::string docDirectSetter(const std::string &name, const std::string &type)
DG_TRACER_DLLAPI friend std::ostream & operator<<(std::ostream &os, const Tracer &t)
CommandVoid2< E, T1, T2 > * makeCommandVoid2(E &entity, boost::function< void(const T1 &, const T2 &)> function, const std::string &docString)
std::string docCommandVoid2(const std::string &doc, const std::string &type1, const std::string &type2)
virtual void recordSignal(std::ostream &os, const SignalBase< sigtime_t > &sig)
std::string docDirectGetter(const std::string &name, const std::string &type)
static PoolStorage * getInstance()
Get unique instance of the class.
virtual void clearDependencies()
DirectSetter< E, T > * makeDirectSetter(E &entity, T *ptr, const std::string &docString)
virtual void openFile(const SignalBase< sigtime_t > &sig, const std::string &filename)
void addCommand(const std::string &name, command::Command *command)
Add a command to Entity.
SignalTimeDependent< sigtime_t, sigtime_t > triger
Tracer plug-in main class.
#define dgDEBUGINOUT(level)
void signalRegistration(const SignalArray< sigtime_t > &signals)
CommandVoid0< E > * makeCommandVoid0(E &entity, boost::function< void(void)> function, const std::string &docString)
Exceptions raised when an error related to traces happen.
void openFiles(const std::string &rootdir, const std::string &basename, const std::string &suffix)
dynamic-graph
Author(s): Nicolas Mansard, Olivier Stasse
autogenerated on Fri Aug 2 2024 08:36:38