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

Method copyInto

include/behaviortree_cpp/utils/safe_any.hpp:356–393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

354}
355
356inline void Any::copyInto(Any& dst) const
357{
358 if(dst.empty())
359 {
360 dst = *this;
361 return;
362 }
363
364 const auto& dst_type = dst.castedType();
365
366 if((castedType() == dst_type) || (isString() && dst.isString()))
367 {
368 dst._any = _any;
369 }
370 else if(isNumber() && dst.isNumber())
371 {
372 if(dst_type == typeid(int64_t))
373 {
374 dst._any = cast<int64_t>();
375 }
376 else if(dst_type == typeid(uint64_t))
377 {
378 dst._any = cast<uint64_t>();
379 }
380 else if(dst_type == typeid(double))
381 {
382 dst._any = cast<double>();
383 }
384 else
385 {
386 throw std::runtime_error("Any::copyInto fails");
387 }
388 }
389 else
390 {
391 throw std::runtime_error("Any::copyInto fails");
392 }
393}
394
395template <typename DST>
396inline nonstd::expected<DST, std::string> Any::convert(EnableString<DST>) const

Callers 3

setMethod · 0.80
assignMethod · 0.80
evaluateMethod · 0.80

Calls 3

isStringMethod · 0.80
isNumberMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected