Cast of enum to ROOT.Long

Dear experts,

I have a compiled C++ class with a member enum which I want to use within PyROOT. It look like

class foo{

public:
enum bar{id1=1, id2, id3}
double myFunc(const bar& id);

}

Now I want to call myFunc by:

gSystem.Load(‘libfoo’)
obj = foo()
obj.myFunc(obj.id1)

This unfortunately doesn’t work, but I need to cast my enum to ROOT.Long. In principle this is working, but I was wondering if there is any work around to prevent the cast, since this function call may be executed quite often at different places. Further if I want to pass an integer I would need to cast it as well.

Many thanks in advance!

Cheers,

Marcus

Marcus,

no, you ran into a bug: for const-ref there should be no need for ROOT.Long (it is needed for non-const-ref). Thanks for reporting: fixed in v5-34 (and will show up in trunk once I’m done with some other things).

Cheers,
Wim

Hi Wim,

thanks for clarification. I will wait for the update.

Thanks,

Marcus