[C++-sig] Wrapping a pure virtual method with multiple arguments
Hello, I followed the "official" tutorial and others but still don't manage to expose this pure virtual method (getPeptide) : ms_mascotresults.hpp class ms_mascotresults { public: ms_mascotresults(ms_mascotresfile &resfile, const unsigned int flags, double minProbability, intmaxHitsToReport, const char * unigeneIndexFile, const char * singleHit = 0); ... virtual ms_peptide getPeptide(const int q, const int p) const = 0; } ms_mascotresults.cpp #include using namespace boost::python; #include "msparser.hpp" // which includes "ms_mascotresults.hpp" using namespace matrix_science; #include #include struct ms_mascotresults_wrapper : ms_mascotresults, wrapper { ms_peptide getPeptide(const int q, const int p) { this->get_override("getPeptide")(q); this->get_override("getPeptide")(p); } }; BOOST_PYTHON_MODULE(ms_mascotresults) { class_("ms_mascotresults") .def("getPeptide", pure_virtual(&ms_mascotresults::getPeptide) ) ; } Here are the bjam's errors : /usr/local/boost_1_42_0/boost/python/object/value_holder.hpp:66: error: cannot declare field ‘boost::python::objects::value_holder::m_held’ to be of abstract type ‘ms_mascotresults_wrapper’ ms_mascotresults.cpp:12: note: because the following virtual functions are pure within ‘ms_mascotresults_wrapper’: ... include/ms_mascotresults.hpp:334: note: virtual matrix_science::ms_peptide matrix_science::ms_mascotresults::getPeptide(int, int) const ms_mascotresults.cpp: In constructor ‘ms_mascotresults_wrapper::ms_mascotresults_wrapper()’: ms_mascotresults.cpp:12: error: no matching function for call to ‘matrix_science::ms_mascotresults::ms_mascotresults()’ include/ms_mascotresults.hpp:284: note: candidates are: matrix_science::ms_mascotresults::ms_mascotresults(matrix_science::ms_mascotresfile&, unsigned int, double, int, const char*, const char*) include/ms_mascotresults.hpp:109: note: matrix_science::ms_mascotresults::ms_mascotresults(const matrix_science::ms_mascotresults&) ... /usr/local/boost_1_42_0/boost/python/object/value_holder.hpp: In constructor ‘boost::python::objects::value_holder::value_holder(PyObject*) [with Value = ms_mascotresults_wrapper]’: /usr/local/boost_1_42_0/boost/python/object/value_holder.hpp:137: note: synthesized method ‘ms_mascotresults_wrapper::ms_mascotresults_wrapper()’ first required here /usr/local/boost_1_42_0/boost/python/object/value_holder.hpp:137: error: cannot allocate an object of abstract type ‘ms_mascotresults_wrapper’ ms_mascotresults.cpp:12: note: since type ‘ms_mascotresults_wrapper’ has pure vi Hello, I followed the "official" tutorial and others but still don't manage to expose this pure virtual method (getPeptide) : ms_mascotresults.hpp class ms_mascotresults { public: ms_mascotresults(ms_mascotresfile &resfile, const unsigned int flags, double minProbability, intmaxHitsToReport, const char * unigeneIndexFile, const char * singleHit = 0); ... virtual ms_peptide getPeptide(const int q, const int p) const = 0; } ms_mascotresults.cpp #include using namespace boost::python; #include "msparser.hpp" // which includes "ms_mascotresults.hpp" using namespace matrix_science; #include #include struct ms_mascotresults_wrapper : ms_mascotresults, wrapper { ms_peptide getPeptide(const int q, const int p) { this->get_override("getPeptide")(q); this->get_override("getPeptide")(p); } }; BOOST_PYTHON_MODULE(ms_mascotresults) { class_("ms_mascotresults") .def("getPeptide", pure_virtual(&ms_mascotresults::getPeptide) ) ; } Here are the bjam's errors : /usr/local/boost_1_42_0/boost/python/object/value_holder.hpp:66: error: cannot declare field ‘boost::python::objects::value_holder::m_held’ to be of abstract type ‘ms_mascotresults_wrapper’ ms_mascotresults.cpp:12: note: because the following virtual functions are pure within ‘ms_mascotresults_wrapper’: ... include/ms_mascotresults.hpp:334: note: virtual matrix_science::ms_peptide matrix_science::ms_mascotresults::getPeptide(int, int) const ms_mascotresults.cpp: In constructor ‘ms_mascotresults_wrapper::ms_mascotresults_wrapper()’: ms_mascotresults.cpp:12: error: no matching function for call to ‘matrix_science::ms_mascotresults::ms_mascotresults()’ include/ms_mascotresults.hpp:284: note: candidates are: matrix_science::ms_mascotresults::ms_mascotresults(matrix_science::ms_mascotresfile&, unsigned int, double, int, const char*, const char*) include/ms_mascotresults.hpp:109: note: matrix_science::ms_mascotresults::ms_mascotresults(const matrix_science:
Re: [C++-sig] Generating API documentation when using boost::python
James Amundson wrote: On 04/15/2010 03:53 AM, Murray Cumming wrote: (If anyone can suggest a better alternative to nasty pydoc, I'd be glad.) I always thought it should be possible make boost.python configurable so the user can choose which docstring format is output (standard, epytext markup, rst, ...) and have some control of how much detail is provided in the docstring by default. I did have a quick look in the code but didn't manage to work out what was going on. ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig
Re: [C++-sig] Wrapping a pure virtual method with multiple arguments
Hello. You have provided too much information. Small example with short problem description can definitely help ( you ) On Fri, Apr 16, 2010 at 11:42 AM, François ALLAIN wrote: > Hello, I followed the "official" tutorial and others but still don't manage > to expose this pure virtual method (getPeptide) : > > ms_mascotresults.hpp > > class ms_mascotresults { > public: > > > > ms_mascotresults(ms_mascotresfile &resfile, > const unsigned int flags, > > > double minProbability, > int maxHitsToReport, > > > const char * unigeneIndexFile, > > > const char * singleHit = 0); > > > ... > > virtual ms_peptide getPeptide(const int q, const int p) const = 0; > > > } > > > > ms_mascotresults.cpp > > #include > > > using namespace boost::python; > > > #include "msparser.hpp" // which includes "ms_mascotresults.hpp" > > > using namespace matrix_science; > #include > > > #include > > struct ms_mascotresults_wrapper : ms_mascotresults, > wrapper { > > > ms_peptide getPeptide(const int q, const int p) { > > > this->get_override("getPeptide")(q); > > > this->get_override("getPeptide")(p); > > > } > }; > > BOOST_PYTHON_MODULE(ms_mascotresults) > > > { > class_("ms_mascotresults") > > > .def("getPeptide", pure_virtual(&ms_mascotresults::getPeptide) ) > > > ; > } > > > > Here are the bjam's errors : > > /usr/local/boost_1_42_0/boost/python/object/value_holder.hpp:66: error: > cannot declare field > ‘boost::python::objects::value_holder::m_held’ to > be of abstract type ‘ms_mascotresults_wrapper’ > > > ms_mascotresults.cpp:12: note: because the following virtual functions are > pure within ‘ms_mascotresults_wrapper’: > > > ... > include/ms_mascotresults.hpp:334: note: virtual > matrix_science::ms_peptide matrix_science::ms_mascotresults::getPeptide(int, > int) const > > > ms_mascotresults.cpp: In constructor > ‘ms_mascotresults_wrapper::ms_mascotresults_wrapper()’: > > > ms_mascotresults.cpp:12: error: no matching function for call to > ‘matrix_science::ms_mascotresults::ms_mascotresults()’ > > > include/ms_mascotresults.hpp:284: note: candidates are: > matrix_science::ms_mascotresults::ms_mascotresults(matrix_science::ms_mascotresfile&, > unsigned int, double, int, const char*, const char*) > > > include/ms_mascotresults.hpp:109: note: > matrix_science::ms_mascotresults::ms_mascotresults(const > matrix_science::ms_mascotresults&) > > > ... > /usr/local/boost_1_42_0/boost/python/object/value_holder.hpp: In constructor > ‘boost::python::objects::value_holder::value_holder(PyObject*) [with > Value = ms_mascotresults_wrapper]’: > > > /usr/local/boost_1_42_0/boost/python/object/value_holder.hpp:137: note: > synthesized method ‘ms_mascotresults_wrapper::ms_mascotresults_wrapper()’ > first required here > > > /usr/local/boost_1_42_0/boost/python/object/value_holder.hpp:137: error: > cannot allocate an object of abstract type ‘ms_mascotresults_wrapper’ > > > ms_mascotresults.cpp:12: note: since type ‘ms_mascotresults_wrapper’ has > pure vi > > Hello, I followed the "official" tutorial and others but still don't manage > to expose this pure virtual method (getPeptide) : > > ms_mascotresults.hpp > > class ms_mascotresults { > public: > > > > ms_mascotresults(ms_mascotresfile &resfile, > const unsigned int flags, > > > double minProbability, > int maxHitsToReport, > > > const char * unigeneIndexFile, > > > const char * singleHit = 0); > > > ... > > virtual ms_peptide getPeptide(const int q, const int p) const = 0; > > > } > > ms_mascotresults.cpp > > #include > > > using namespace boost::python; > > > #include "msparser.hpp" // which includes "ms_mascotresults.hpp" > > > using namespace matrix_science; > #include > > > #include > > struct ms_mascotresults_wrapper : ms_mascotresults, > wrapper { > > > ms_peptide getPeptide(const int q, const int p) { > > > this->get_override("getPeptide")(q); > > > this->get_override("getPeptide")(p); > > > } > }; > > BOOST_PYTHON_MODULE(ms_mascotresults) > > > { > class_("ms_mascotresults") > > > .def("getPeptide", pure_virtual(&ms_mascotresults::getPeptide) ) > > > ; > } > > Here are the bjam's errors : > > /usr/local/boost_1_42_0/boost/python/object/value_holder.hpp:66: error: > cannot declare field > ‘boost::python::objects::value_holder::m_held’ to > be of abstract type ‘ms_mascotresults_wrapper’ > > > ms_mascotresults.cpp:12: note: because the following virtual functions are > pure within ‘ms_mascotresults_wrapper’: > > > ... > include/ms_mascotresults.hpp:334: note: virtual > matrix_science::ms_peptide matrix_s