No cooperation between dictionaries from Cint and Reflex

From: Roel Aaij <Roel.Aaij_at_cern.ch>
Date: Tue, 31 Jan 2012 15:45:01 +0100


Hi,

The LHCb software framework uses Reflex dictionaries to provide python bindings for most of its C++ classes. To be able to interact with one of the C++ classes from python, I need to be able to create a std::map<std::string, double>. A dictionary for this type exists, but it does not allow me to do the following:

>>> import ROOT
>>> m = ROOT.std.map('string', 'double')()
>>> p = ROOT.std.pair('string', 'double')('one', 1.)
>>> m.insert(p)

The full error message is included at the bottom. It seems that a dictionary is not being picked up for the return type of the insert method, while I believe I have created it as a Reflex dictionary (log of genreflex is attached).

For a similar type, std::map<unsigned long, bool>, generating appropriate dictionaries for the map, pair<const unsigned long, bool>, iterators and the return type of map.insert allows me to perform the same operation. Since the map<string, double> dictionary seems to be a Cint dictionary, I suspect that cooperation between Cint dictionaries and Reflex dictionaries has a problem here. Perhaps the types are slightly differently defined?

Any ideas on what is going wrong?

Cheers, Roel

Full error message:
TClass::TClass:0: RuntimeWarning: no dictionary for class pair<map<string,double>::iterator,bool> is available Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: none of the 4 overloaded methods succeeded. Full details:   type object 'ROOT' has no attribute 'pair<map<string,double>::iterator,bool>'   map<string,double,less<string>,allocator<pair<const string,double> > >::iterator map<string,double,less<string>,allocator<pair<const string,double> > >::insert(map<string,double,less<string>,allocator<pair<const string,double> > >::iterator position, const map<string,double,less<string>,allocator<pair<const string,double> > >::value_type& x) =>     takes at least 2 arguments (1 given)   void map<string,double,less<string>,allocator<pair<const string,double> > >::insert(map<string,double,less<string>,allocator<pair<const string,double> > >::iterator first, map<string,double,less<string>,allocator<pair<const string,double> > >::iterator last) =>     takes at least 2 arguments (1 given)   void map<string,double,less<string>,allocator<pair<const string,double> > >::insert(map<string,double,less<string>,allocator<pair<const string,double> > >::reverse_iterator first, map<string,double,less<string>,allocator<pair<const string,double> > >::reverse_iterator last) =>     takes at least 2 arguments (1 given)

-- 
Roel Aaij                   
Cern, office 13-1-20        Tel: +41 (0)22 76 76284
CH-1211 Genève              Mob: +41 (0)79 9272 882

Received on Tue Jan 31 2012 - 15:47:38 CET

This archive was generated by hypermail 2.2.0 : Tue Jan 31 2012 - 23:50:01 CET