MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / setStatus

Method setStatus

src/tree_node.cpp:171–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171void TreeNode::setStatus(NodeStatus new_status)
172{
173 if(new_status == NodeStatus::IDLE)
174 {
175 throw RuntimeError("Node [", name(),
176 "]: you are not allowed to set manually the status to IDLE. "
177 "If you know what you are doing (?) use resetStatus() instead.");
178 }
179
180 NodeStatus prev_status = NodeStatus::IDLE;
181 {
182 const std::unique_lock<std::mutex> UniqueLock(_p->state_mutex);
183 prev_status = _p->status;
184 _p->status = new_status;
185 }
186 if(prev_status != new_status)
187 {
188 _p->state_condition_variable.notify_all();
189 _p->state_change_signal.notify(std::chrono::high_resolution_clock::now(), *this,
190 prev_status, new_status);
191 }
192}
193
194TreeNode::PreScripts& TreeNode::preConditionsScripts()
195{

Callers 1

TEST_FFunction · 0.80

Calls 2

RuntimeErrorClass · 0.85
notifyMethod · 0.45

Tested by 1

TEST_FFunction · 0.64