Skip to content

Commit b425c91

Browse files
committed
Add docs for JsonExporter::fromJson.
1 parent 2584aec commit b425c91

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Diff for: include/behaviortree_cpp/json_export.h

+9-1
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,18 @@ class JsonExporter{
3939
dst = val;
4040
}
4141

42+
/**
43+
* @brief fromJson tries to convert arbitrary JSON data into the type T.
44+
*
45+
* Calls only compile if `nlohmann::from_json(const nlohmann::json&, T&)` is
46+
* defined in T's namespace.
47+
*/
4248
template <typename T>
4349
T fromJson(const nlohmann::json& src) const
4450
{
45-
// TODO: Implement a similar "converter" interface as toJson.
51+
// We don't need to implement a similar `type_converters` interface as
52+
// `toJson` here because the type T must be know statically. There is no
53+
// opaque BT::Any wrapper here requiring RTTI.
4654
return src.template get<T>();
4755
}
4856

0 commit comments

Comments
 (0)