Boost logo

Boost Users :

From: Lana Abadie (Lana.Abadie_at_[hidden])
Date: 2005-08-12 11:13:37


Hello,
I am using boost for the first time.
 I have the following boost.cpp file:
#include "../confDBAPIpython/test1.h"
#include <boost/python.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
#include <boost/python/implicit.hpp>

using namespace boost::python;

BOOST_PYTHON_MODULE(confDBAPIpython)
{
    // Compile check only...
    class_<std::vector<int> >("IntVec")
        .def(vector_indexing_suite<std::vector<int> >());

        class_<std::vector<std::string> >("StringVec")
        .def(vector_indexing_suite<std::vector<std::string> >());
    
        def("DBConnexion",PyDBConnexion);
        def("DBDeconnexion",PyDBDeconnexion);
        def("GetDeviceTypeRow",PyGetDeviceTypeRow);
        def("GetDeviceRow_devicename",PyGetDeviceRow_devicename);
        def("GetDeviceRow_deviceid",PyGetDeviceRow_deviceid);
        
def("GetDetailedConnectivityBetweenDevices",PyGetDetailedConnectivityBet
weenDevices);
        
def("GetConnectivityBetweenDevices",PyGetConnectivityBetweenDevices);
}

The two last fct returns vector<std::string>.
When I try to use them in python, I have the following error message:
list_str=libconfDBAPIpython.GetConnectivityBetweenDevices("TFC","THOR_00
","ECAL_L1FE06_02_00");
 print list_str[0];
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: No Python class registered for C++ class std::string
I don't understand why. I thought it will be handled by the
vector_indexing_suite.
I have no problem when a fcuntion returns a string or a vector<int>
Thanks for helping
Lana


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net