Classes hidden in a namespace

Hello,

I’m importing a compiled library into PyRoot which contains a rootcint generated dictionnary.

The linkdef files contain something like :

#ifdef __CINT__

#pragma link off all global;
#pragma link off all classes;
#pragma link off all function;

#pragma link C++ namespace BLA;
#pragma link C++ class BLA::CutE;
...

I load it via gSystem.Load(“libBLA.so”).
I’d like to get in python the list of all classes under the BLA namespace…
Is there a way to do that ?
For example BLA.dict.keys() will show BLA.CutE only if the later was previously explicitly requested… but how could I guess it is there and known to python ?

As an aside is there a recommeded way to generate dictionnaries for use in PyRoot ? I mean, is there better alternatives than rootcint (reflex ,… ) ?

Thanks !

Hi,

classes are created lazily, so no, they won’t show up in dir() until explicitly requested. Any class available to CINT however, can have it’s binding created.

Not sure what you mean in terms of other technology than rootcint/reflex? PyROOT needs a dictionary. Of course, you can always use SWIG or SIP or any other bindings generator and use those classes from python.

Cheers,
Wim

Hello Wim,

Thanks a lot for your answer.

Ah, so I guess this means that there is no way to force the creation of classes ? (I though there were because the information of what classes exists must be “somewhere”)

Sorry, probably my ignorance here. I’m not thinking about swig or anything else… Are rootcint and reflex 2 different technologies ? if so would you recommend one in particular ? (and maybe it can be linked to the above question… or maybe I’m just speaking out of nowhere !)

Cheers

P.A.

Hi,

the only place knowing all classes is TClassTable; you will have to iterate it to find what you’re looking for.

Unless you hit a wall with it I’d stick to rootcint for generating dictionaries; it’s better embedded in ROOT (ACLiC uses it, ROOT’s own dictionaries are created with it, etc), faster, and uses less memory.

Cheers, Axel.