I have a class (MyClass) which I am trying to interface to via pyroot. The class involves data members which are c++ vectors of pointers to int, unsigned int, double and float. When trying to access these data members via PyROOT I receive the following warnings (see below), which consequently means I cannot access the values stored by the pointers. Is there a way to achieve what I am trying?
What I find a bit odd is that the warnings I receive apply only to ints, doubles and floats but not unsigned ints.
[code]<ROOT.vector<int*> object at 0x1058aa870>
<ROOT.vector<unsigned int*> object at 0x1058aa888>
<ROOT.vector<double*> object at 0x1058aa8a0>
<ROOT.vector<float*> object at 0x1058aa8b8>
pyroot.py:19: RuntimeWarning: return type not handled (using void): int*&
print 'int pointers:\t ’ + str(my_class.m_int_ptrs[0])
int pointers: None
unsigned int pointers: <UInt_t buffer, size 2147483647>
pyroot.py:23: RuntimeWarning: return type not handled (using void): double*&
print 'double pointers:\t ’ + str(my_class.m_double_ptrs[0])
double pointers: None
pyroot.py:25: RuntimeWarning: return type not handled (using void): float*&
print 'float pointers:\t ’ + str(my_class.m_float_ptrs[0])
float pointers: None
=========================================================[/code]
MyClass.h
[code]#ifndef MyClass_H
#define MyClass_H
#include
class MyClass
{
public:
// constructors
MyClass();
vector<int*> m_int_ptrs;
vector<unsigned int*> m_uint_ptrs;
vector<double*> m_double_ptrs;
vector<float*> m_float_ptrs;
};
#endif /* MYHEADER_H */[/code]
MyClass.cpp
[code]#include “MyClass.h”
// constructors
MyClass::MyClass()
{
int i(123);
m_int_ptrs.push_back(new int(i));
m_uint_ptrs.push_back(new unsigned int(i));
m_double_ptrs.push_back(new double(i));
m_float_ptrs.push_back(new float(i));
}[/code]
[code]from ROOT import *
gInterpreter.GenerateDictionary(“vector<int*>”, “vector”)
gInterpreter.GenerateDictionary(“vector<unsigned int*>”, “vector”)
gInterpreter.GenerateDictionary(“vector<double*>”, “vector”)
gInterpreter.GenerateDictionary(“vector<float*>”, “vector”)
gSystem.Load(‘MyClass_cpp’)
my_class = MyClass()
print my_class.m_int_ptrs
print my_class.m_uint_ptrs
print my_class.m_double_ptrs
print my_class.m_float_ptrs
print '========================================================='
print 'int pointers:\t ’ + str(my_class.m_int_ptrs[0])
print ‘=========================================================’
print 'unsigned int pointers:\t ’ + str(my_class.m_uint_ptrs[0])
print '========================================================='
print 'double pointers:\t ’ + str(my_class.m_double_ptrs[0])
print '========================================================='
print 'float pointers:\t ’ + str(my_class.m_float_ptrs[0])
print ‘=========================================================’[/code]