@@ -27,6 +27,25 @@ MinitraceLogger::~MinitraceLogger()
27
27
ref_count = false ;
28
28
}
29
29
30
+ const char * toConstStr (NodeType type)
31
+ {
32
+ switch (type)
33
+ {
34
+ case NodeType::ACTION:
35
+ return " Action" ;
36
+ case NodeType::CONDITION:
37
+ return " Condition" ;
38
+ case NodeType::DECORATOR:
39
+ return " Decorator" ;
40
+ case NodeType::CONTROL:
41
+ return " Control" ;
42
+ case NodeType::SUBTREE:
43
+ return " SubTree" ;
44
+ default :
45
+ return " Undefined" ;
46
+ }
47
+ }
48
+
30
49
void MinitraceLogger::callback (Duration /* timestamp*/ ,
31
50
const TreeNode& node, NodeStatus prev_status,
32
51
NodeStatus status)
@@ -35,20 +54,20 @@ void MinitraceLogger::callback(Duration /*timestamp*/,
35
54
36
55
const bool statusCompleted = (status == NodeStatus::SUCCESS || status == NodeStatus::FAILURE);
37
56
38
- const std::string& category = toStr (node.type ());
57
+ const char * category = toConstStr (node.type ());
39
58
const char * name = node.name ().c_str ();
40
59
41
60
if (prev_status == NodeStatus::IDLE && statusCompleted)
42
61
{
43
- MTR_INSTANT (category. c_str () , name);
62
+ MTR_INSTANT (category, name);
44
63
}
45
64
else if (status == NodeStatus::RUNNING)
46
65
{
47
- MTR_BEGIN (category. c_str () , name);
66
+ MTR_BEGIN (category, name);
48
67
}
49
68
else if (prev_status == NodeStatus::RUNNING && statusCompleted)
50
69
{
51
- MTR_END (category. c_str () , name);
70
+ MTR_END (category, name);
52
71
}
53
72
}
54
73
0 commit comments