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

Function convertFromString

tests/gtest_blackboard.cpp:421–437  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419{
420template <>
421[[nodiscard]] Point convertFromString(StringView str)
422{
423 // We expect real numbers separated by semicolons
424 auto parts = splitString(str, ';');
425 if(parts.size() != 2)
426 {
427 throw RuntimeError("invalid input)");
428 }
429 else
430 {
431 Point output{ 0.0, 0.0 };
432 output.x = convertFromString<double>(parts[0]);
433 output.y = convertFromString<double>(parts[1]);
434 // std::cout << "Building a position 2d object " << output.x << "; " << output.y << "\n" << std::flush;
435 return output;
436 }
437}
438} // end namespace BT
439
440TEST(BlackboardTest, SetBlackboard_Issue725)

Callers

nothing calls this directly

Calls 3

splitStringFunction · 0.85
RuntimeErrorClass · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected