34 dummyStr += oss.
str();
45 sprintf(buff,
"%d", n);
46 dummyStr += std::string(buff);
52 sprintf(buff,
"%.2f", n);
53 dummyStr += std::string(buff);
59 dummyStr = std::string(sz);
64 dummyStr = std::string(sz);
80 sprintf(buff,
"%d", n);
81 dummyStr = std::string(buff);
87 std::cout<<sstr.
str();
108 std::string timeinfo =
"[time: " + elapsedTime +
"] ";
109 std::string szWarningWithTime = timeinfo + szWarning;
110 warnings.emplace_back(szWarningWithTime);
117 std::string timeinfo =
"[time: " + elapsedTime +
"] ";
118 std::string strWithTime = timeinfo + str;
119 warnings.push_back(strWithTime);
130 std::string timeinfo =
"[time: " + elapsedTime +
"] ";
131 std::string szErrorWithTime = timeinfo + szError;
132 errors.emplace_back(szErrorWithTime);
139 std::string timeinfo =
"[time: " + elapsedTime +
"] ";
140 std::string strWithTime = timeinfo + str;
141 errors.push_back(strWithTime);
149 if (errors.empty()) {
152 static std::string msg;
159 static std::string msgs;
162 msgs += std::string(err) +
" ";
168 if (warnings.empty()) {
171 static std::string msg;
172 msg = warnings.back();
178 static std::string msgs;
181 msgs += std::string(err) +
" ";
188 errors.clear(); warnings.clear();
192 return errors.size();
197 return warnings.size();
206" Legend [shape=none, margin=0, label=<"
207" <TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"4\" bgcolor=\"white\">"
209" <TD COLSPAN=\"2\"><B>Legend</B></TD>"
212" <TD align=\"left\">Application</TD>"
213" <TD CELLPADDING=\"4\">"
214" <TABLE BORDER=\"1\" CELLBORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">"
216" <TD BGCOLOR=\"darkseagreen\"> </TD>"
222" <TD align=\"left\">Module</TD>"
223" <TD CELLPADDING=\"4\">"
224" <TABLE BORDER=\"1\" CELLBORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">"
226" <TD BGCOLOR=\"lightslategrey\"> </TD>"
232" <TD align=\"left\">Res. Dependency</TD>"
233" <TD CELLPADDING=\"4\">"
234" <TABLE BORDER=\"1\" CELLBORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">"
236" <TD BGCOLOR=\"salmon\"> </TD>"
242" <TD align=\"left\">Res. Provider</TD>"
243" <TD CELLPADDING=\"4\">"
244" <TABLE BORDER=\"1\" CELLBORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">"
246" <TD BGCOLOR=\"indianred\"> </TD>"
252" <TD align=\"left\">Input data</TD>"
253" <TD CELLPADDING=\"4\">"
254" <TABLE BORDER=\"1\" CELLBORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">"
256" <TD BGCOLOR=\"lightgrey\"> </TD>"
262" <TD align=\"left\">Output data</TD>"
263" <TD CELLPADDING=\"4\">"
264" <TABLE BORDER=\"1\" CELLBORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">"
266" <TD BGCOLOR=\"wheat\"> </TD>"
328 if (!szFirst && !szSecond) {
331 if (!szFirst || !szSecond) {
335 std::string strFirst(szFirst);
336 std::string strSecond(szSecond);
337 transform(strFirst.begin(), strFirst.end(), strFirst.begin(),
338 (
int(*)(
int))toupper);
339 transform(strSecond.begin(), strSecond.end(), strSecond.begin(),
340 (
int(*)(
int))toupper);
341 if (strFirst == strSecond) {
348 auto now = std::chrono::system_clock::now();
349 std::time_t currentTime = std::chrono::system_clock::to_time_t(now);
353 localtime_s(&localTime, ¤tTime);
355 localtime_r(¤tTime, &localTime);
357 std::ostringstream oss;
358 oss << std::put_time(&localTime,
"%H:%M:%S");
364 std::istringstream iss(startTimeStr);
365 iss >> std::get_time(&startTime,
"%H:%M:%S");
367 throw std::invalid_argument(
"Invalid time format. Expected %H:%M:%S");
370 auto now = std::chrono::system_clock::now();
371 std::time_t currentTime = std::chrono::system_clock::to_time_t(now);
375 localtime_s(&localTime, ¤tTime);
377 localtime_r(¤tTime, &localTime);
380 localTime.tm_hour = startTime.tm_hour;
381 localTime.tm_min = startTime.tm_min;
382 localTime.tm_sec = startTime.tm_sec;
384 std::time_t startTimestamp = std::mktime(&localTime);
386 auto elapsedSeconds = std::difftime(currentTime, startTimestamp);
387 if (elapsedSeconds < 0) {
388 elapsedSeconds += 24 * 60 * 60;
391 int hours =
static_cast<int>(elapsedSeconds) / 3600;
392 int minutes = (
static_cast<int>(elapsedSeconds) % 3600) / 60;
393 int seconds =
static_cast<int>(elapsedSeconds) % 60;
395 std::ostringstream oss;
396 oss << std::setfill(
'0') << std::setw(2) << hours <<
":"
397 << std::setfill(
'0') << std::setw(2) << minutes <<
":"
398 << std::setfill(
'0') << std::setw(2) << seconds;
405 std::string::size_type pos = str.find_last_not_of(
' ');
406 if(pos != std::string::npos)
409 pos = str.find_first_not_of(
' ');
410 if (pos != std::string::npos) {
414 str.erase(str.begin(), str.end());
422 dot.open(szFileName);
423 if (!dot.is_open()) {
427 dot<<
"digraph G {\n";
428 dot<<
"rankdir=LR\n;";
429 dot<<
"ranksep=0.0\n;";
430 dot<<
"nodesep=0.2\n;";
434 switch((*itr)->getType()) {
436 auto* mod = (
Module*)(*itr);
437 dot<<
"\""<<mod->getLabel()<<
"\"";
438 dot<<
" [label=\""<< mod->getName()<<
"\"";
439 dot<<
" shape=component, color=midnightblue, fillcolor=lightslategrey, peripheries=1, style=filled, penwidth=2];\n";
440 for(
int i=0; i<mod->sucCount(); i++)
442 Link l = mod->getLinkAt(i);
444 dot<<
"\""<<mod->getLabel()<<
"\" -> ";
445 dot<<
"\""<<in->getLabel()<<
"\"";
447 dot<<
" [label=\"\"];\n";
449 dot <<
" [label=\"\" style=dashed];\n";
457 dot<<
"\""<<in->getLabel()<<
"\"";
458 if(in->withPriority())
460 dot<<
" [color=red, fillcolor=lightgrey, peripheries=1, style=filled";
461 dot<<
" label=\""<< in->getName()<<
"\\n"<<in->getPort()<<
"\"];\n";
465 dot<<
" [color=black, fillcolor=lightgrey, peripheries=1, style=filled";
466 dot<<
" label=\""<< in->getName()<<
"\\n"<<in->getPort()<<
"\"];\n";
468 for(
int i=0; i<in->sucCount(); i++)
470 Link l = in->getLinkAt(i);
472 dot<<
"\""<<in->getLabel()<<
"\" -> ";
473 dot<<
"\""<<out->getLabel()<<
"\"";
475 dot<<
" [label=\""<<l.
weight()<<
"\"];\n";
477 dot <<
" [label=\"" << l.
weight() <<
"\" style=dashed];\n";
485 dot<<
"\""<<out->getLabel()<<
"\"";
486 dot<<
" [color=black, fillcolor=wheat, peripheries=1, style=filled";
487 dot<<
" label=\""<< out->getName()<<
"\\n"<<out->getPort()<<
"\"];\n";
488 for(
int i=0; i<out->sucCount(); i++)
490 Link l = out->getLinkAt(i);
492 dot<<
"\""<<out->getLabel()<<
"\" -> ";
493 dot<<
"\""<<mod->getLabel()<<
"\"";
494 dot<<
" [label=\"\" arrowhead=none];\n";
502 dot<<
"\""<<app->getLabel()<<
"\"";
503 dot<<
" [shape=folder, color=darkgreen, fillcolor=darkseagreen, peripheries=1, style=filled, penwidth=2";
504 dot<<
" label=\""<<app->getLabel()<<
"\""<<
"];\n";
505 for(
int i=0; i<app->sucCount(); i++)
507 Link l = app->getLinkAt(i);
509 dot<<
"\""<<app->getLabel()<<
"\" -> ";
510 dot<<
"\""<<mod->getLabel()<<
"\"";
512 dot<<
" [label=\"\"];\n";
514 dot <<
" [label=\"\" style=dashed];\n";
522 dot<<
"\""<<res->getLabel()<<
"\"";
524 dot<<
" [shape=rect, color=black, fillcolor=salmon, peripheries=1, style=filled ";
526 dot <<
" [shape=house, color=maroon, fillcolor=indianred, peripheries=1, style=filled, penwidth=2";
528 dot<<
" label=\""<<res->getName()<<
"\""<<
"];\n";
529 for(
int i=0; i<res->sucCount(); i++)
531 Link l = res->getLinkAt(i);
533 dot<<
"\""<<res->getLabel()<<
"\" -> ";
535 dot<<
" [label=\""<<l.
weight()<<
"\"];\n";
Singleton class For storing execution start time.
static ClockStart & getInstance()
std::string getStartTime() const
Get the starting time as a string in HH:MM:SS format.
Singleton class ErrorLogger.
const char * getLastError()
const char * getFormatedErrorString()
void addError(const char *szError)
void addWarning(const char *szWarning)
static ErrorLogger * Instance()
Singleton class ErrorLogger.
const char * getLastWarning()
const char * getFormatedWarningString()
Link holding all the links of a node.
StrStream & operator=(const char *sz)
friend std::ostream & operator<<(std::ostream &os, StrStream &sstr)
bool compareString(const char *szFirst, const char *szSecond)
void trimString(std::string &str)
std::stringstream OSTRINGSTREAM
OS strToOS(const char *szOS)
std::string getElapsedTimeString(const std::string &startTimeStr)
bool exportDotGraph(Graph &graph, const char *szFileName)
std::string getCurrentTimeString()
enum yarp::manager::__OS OS
const std::string GRAPH_LEGEND
std::ostream & operator<<(std::ostream &os, StrStream &sstr)