What's the right way to create a templated class on the C++ side with Cxx?
I have an LCCollection
<http://lcio.desy.de/v02-07/doc/doxygen_api/html/classEVENT_1_1LCCollection.html>,
and I would like to create a CellIDDecoder
<http://lcio.desy.de/v02-07/doc/doxygen_api/html/classUTIL_1_1CellIDDecoder.html>,
which needs a template argument.
A simple
cxx"""UTIL::CellIDDecoder<SimCalorimeterHit>($(collection.coll)) x;
std::cout << x << std::endl;
results in
ERROR: LoadError: Creating LLVM constants for type `T` not implemented yet
in llvmconst(::Any) at /home/stru821/.julia/v0.5/Cxx/src/cxxstr.jl:22
in ArgCleanup(::Cxx.ClangCompiler, ::Cxx.CppPtr{Cxx.CxxQualType{Cxx.
CppBaseType{Symbol("EVENT::LCCollection")},(false,false,false)},(false,false
,false)}, ::Cxx.CppPtr{Cxx.CxxQualType{Cxx.CppBaseType{Symbol(
"clang::VarDecl")},(false,false,false)},(false,false,false)}) at /home/
stru821/.julia/v0.5/Cxx/src/cxxstr.jl:192
in macro expansion at /home/stru821/.julia/v0.5/Cxx/src/cxxstr.jl:634 [
inlined]
in getCellIDDecoder(::LCIO.LCCollection{Cxx.CppPtr{Cxx.CxxQualType{Cxx.
CppBaseType{Symbol("EVENT::SimCalorimeterHit")},(false,false,false)},(false,
false,false)}}) at /home/stru821/.julia/v0.5/LCIO/src/CaloHit.jl:29
in testReader(::String) at /home/stru821/.julia/v0.5/LCIO/examples/
testLCIOCxx.jl:14
in include_from_node1(::String) at ./loading.jl:426
in process_options(::Base.JLOptions) at ./client.jl:266
in _start() at ./client.jl:322
while loading /home/stru821/.julia/v0.5/LCIO/examples/testLCIOCxx.jl, in
expression starting on line 22
I have also tried to return the result of
icxx"""UTIL::CellIDDecoder<SimCalorimeterHit>($(collection.coll));
But that replies with an even stranger message:
:2:45: error: no matching constructor for initialization of
'UTIL::CellIDDecoder<SimCalorimeterHit>'
UTIL::CellIDDecoder < SimCalorimeterHit > ( __juliavar1 ) ;
^
/scratch/software/lcio-test/include/UTIL/CellIDDecoder.h:36:3: note:
candidate constructor not viable: requires single argument 'encoder_str',
but no arguments were provided
CellIDDecoder( const std::string& encoder_str ) : _oldHit(0) {
^
/scratch/software/lcio-test/include/UTIL/CellIDDecoder.h:47:5: note:
candidate constructor not viable: requires single argument 'col', but no
arguments were provided
CellIDDecoder( const EVENT::LCCollection* col ) : _oldHit(0) {
^
The code clearly has a constructor argument, so I don't understand why the
compiler things it doesn't...
If somebody knows how to construct such a templated class, please share.
Many thanks.