How would I go about creating a custom converter for a C++ type to use in PyROOT?
I have a set of classes that use the
nlohmann::json class for passing around configuration information. Now, obviously when I try and use methods on these classes that interact with
nlohmann::json PyROOT isn’t particularly happy because it doesn’t know about the class and spits out a warning+error combo
__main__:1: RuntimeWarning: creating converter for unknown type "const nlohmann::basic_json<map,vector,string,bool,long,unsigned long,double,allocator,adl_serializer>&" Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: void RDFPlotting::TConfigurable::configure(const nlohmann::basic_json<map,vector,string,bool,long,unsigned long,double,allocator,adl_serializer>& configuration) => could not convert argument 1
Would it be possible for me to write a converter (or whatever would be needed) to convert between a python
dict and a C++
nlohmann::json object? Ideally this would work two ways - when a C++ method returns
nlohmann::json this would become a
dict in PyROOT and when one receives a
nlohmann::json it would be provided as a
dict in PyROOT.
ROOT Version: 6.14/04
Platform: Not Provided
Compiler: gcc 5.4.0