boost::python + observer pattern



  • Hallo,

    ich habe da mal eine Frage zu boost::python. Ich habe da ein Beobachtermuster in C++ moduliert und moechte nun als konkreten Beobachter eine Pythonklasse definiern. Prinzipiell sollte es ja kein Problem sein, nur weiss ich nicht wie ich die abstrakte Callbackmethode in boost definieren soll, damit sie in richtung Python richtig funktioniert.

    hier erstmal einwenig vereinfachten code, damit ihr wisst was ich meine :

    class Observable;
    
    class Observer
    {
       public :
         virtual void performEvent(Observable* observable) = 0;
    };
    
    class Observable
    {
       private :
          Observer* observer;
       public :
          void addObserver(Observer* observer); 
          void delObserver();
          void notify();
    };
    
    void Observable::addObserver(Observer*)
    {
       this->observer = observer;
    }
    
    void Observable::delObserver()
    {
       this->observer = NULL;
    }
    
    void Observable::notify()
    {
       if (observer != NULL)
          observer->eventPerform(this);
    }
    

    Soweit ist es ja alles noch klar, da es sich (fast) um das Standardversion des Observer Pattern handelt. Wenn ich jetzt eine konkrete Observable definiere ist es auch noch kein problem.

    class MyObservable : Observable
    {
       private :
          int wert;
       public :
          void setWert(int arg);
          int  getWert();
    };
    
    void MyObservable::setWert(int arg)
    {
       wert = arg;
       notify();
    }
    
    int  MyObservable::getWert()
    {
       return wert;
    }
    

    Meine Pythondefiniton wuerde sieht dafuer dann wie folgt aus :

    BOOST_PYTHON_MODULE(MyObservable)
    {
        class_<MyObservable>("MyObservable")
            .def("setWert",          &MyObservable::setWert)
            .def("getWert",          &MyObservable::getWert)
            .def("addObserver",      &MyObservable::addObserver)
            .def("delObserver",      &MyObservable::delObserver)
        ;
    }
    

    Soweit, so gut. Wie definiere ich aber das Observerinterface mit der abstrakten Methode, das ich sie in Python benutzen kann? zB so :

    class MyObserver(Observer):
       def __init__(self):
          self.__myobservable = MyObservable()
          self.__myobservable.addObserver(self)
    
       def eventPerform(self, observable) :
          print "treffer !!! ;) "
    

    Lange Rede, kurzer Sinn. Kann mir jemand weiterhelfen? bin fuer jede Idee dankbar.

    gruss
    tyr377



  • Schon mal pyste probiert?
    Evtl. hilft dir auch die Doku von pyste weiter:
    http://boost.org/libs/python/pyste/index.html



  • Eigentlich wollte ich das mit den Generatoren sein lassen. Zum einen ist das meine Schnittstelle nicht so groß dass ich es nicht auch von hand schreiben könnte und zum anderen würde ich gerne wissen wie es prinzipiell geht, wenn ich später mal einen Generator einsetzen sollte. Habe auch schon ne lösung unter http://www.boost.org/libs/python/doc/v2/wrapper.html gefunden. Nur will er noch nicht kompilieren.

    Die allgemeine Info dazu ist, dass man nen Wrapper braucht. Mein Wrapper sieht so aus:

    #include "observer.hpp"
    
    #include <boost/python/module.hpp>
    #include <boost/python/class.hpp>
    #include <boost/python/wrapper.hpp>
    #include <boost/python/call.hpp>
    
    using namespace boost::python;
    
    class PyObserver : public Observer, wrapper<Observer>
    {
    	public :
    	   void performEvent(Observable* observable);
    };
    void PyObserver::performEvent(Observable* observable)
    {
    	this->get_override("performEvent")(observable);	
    }
    

    und die definition fürs Pythonmodul :

    BOOST_PYTHON_MODULE(MyObservable)
    {
        class_<MyObservable>("MyObservable")
            .def("setWert",          &MyObservable::setWert)
            .def("getWert",          &MyObservable::getWert)
            .def("addObserver",      &MyObservable::addObserver)
            .def("delObserver",      &MyObservable::delObserver)
        ;
        class_<PyOserver,boost::noncopyable>("PyObserver")
            .def("performEvent", pure_virtual(&PyObserver::performEvent))
        ;
    }
    

    Es kann nur noch ne Kleinigkeit sein, die ich übersehe. 😕



  • tyr377 schrieb:

    Nur will er noch nicht kompilieren.

    Ich glaube kaum, daß dein Compiler sich da auf ein "das geht nicht" beschränkt 😉 (will sagen: Normalerweise geben Compiler recht detaillierte Hinweise darauf, was (und wo) nicht richtig ist)



  • CStoll schrieb:

    Ich glaube kaum, daß dein Compiler sich da auf ein "das geht nicht" beschränkt 😉

    wäre was, oder? Würde die Fehlersuche noch wesentlich spannender machen :D. Scherz beiseite, natürlich gibt er ne fehlermeldung aus.

    g++ -I../DCDEventLayer/boost/include/ -I/usr/include/python2.3 -c -o pyBoost.o pyBoost.cpp
    ../DCDEventLayer/boost/include/boost/python/class.hpp: In constructor boost::python::class_<T, X1, X2, X3>::id\_vector::id\_vector() [with W = PyObserver, X1 = boost::noncopyable, X2 = boost::python::detail::not\_specified, X3 = boost::python::detail::not\_specified]': ../DCDEventLayer/boost/include/boost/python/class.hpp:628: instantiated fromboost::python::class_<T, X1, X2, X3>::class_(const char*, const char*) [with W = PyObserver, X1 = boost::noncopyable, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]'
    pyBoost.cpp:48: instantiated from here
    ../DCDEventLayer/boost/include/boost/python/class.hpp:179: error: `boost::python::wrapper<Observer>' is an inaccessible base of `PyObserver'
    ../DCDEventLayer/boost/include/boost/python/object/class_metadata.hpp: In static member function static void boost::python::objects::class\_metadata<T, X1, X2, X3>::register_() [with T = PyObserver, X1 = boost::noncopyable, X2 = boost::python::detail::not\_specified, X3 = boost::python::detail::not\_specified]': ../DCDEventLayer/boost/include/boost/python/class.hpp:496: instantiated fromvoid boost::python::class_<T, X1, X2, X3>::initialize(const DefVisitor&) [with DefVisitor = boost::python::init<mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_>, W = PyObserver, X1 = boost::noncopyable, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]'
    ../DCDEventLayer/boost/include/boost/python/class.hpp:629: instantiated from boost::python::class_<T, X1, X2, X3>::class_(const char*, const char*) [with W = PyObserver, X1 = boost::noncopyable, X2 = boost::python::detail::not\_specified, X3 = boost::python::detail::not\_specified]' pyBoost.cpp:48: instantiated from here ../DCDEventLayer/boost/include/boost/python/object/class_metadata.hpp:205: error: \boost::python::wrapper<Observer>' is an inaccessible base of `PyObserver'
    ../DCDEventLayer/boost/include/boost/python/detail/is_wrapper.hpp: At global scope:
    ../DCDEventLayer/boost/include/boost/python/detail/is_wrapper.hpp: In instantiation of boost::python::detail::is\_wrapper<PyObserver>': ../DCDEventLayer/boost/include/boost/utility/enable\_if.hpp:59: instantiated fromboost::disable_if<boost::python::detail::is_wrapper<PyObserver>, PyObserver*>'
    ../DCDEventLayer/boost/include/boost/python/detail/enable_if.hpp:66: instantiated from boost::python::detail::disable\_if\_ret<boost::python::detail::is\_wrapper<PyObserver>, PyObserver*>' ../DCDEventLayer/boost/include/boost/python/class.hpp:608: instantiated fromvoid boost::python::class_<T, X1, X2, X3>::def_maybe_overloads(const char*, Fn, const A1&, ...) [with Fn = boost::python::api::object, A1 = const char*, W = PyObserver, X1 = boost::noncopyable, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]'
    ../DCDEventLayer/boost/include/boost/python/class.hpp:244: instantiated from boost::python::class_<T, X1, X2, X3>& boost::python::class_<T, X1, X2, X3>::def(const char*, A1, const A2&) [with A1 = boost::python::api::object, A2 = const char*, W = PyObserver, X1 = boost::noncopyable, X2 = boost::python::detail::not\_specified, X3 = boost::python::detail::not\_specified]' ../DCDEventLayer/boost/include/boost/python/init.hpp:330: instantiated fromvoid boost::python::detail::def_init_aux(ClassT&, const Signature&, NArgs, const CallPoliciesT&, const char*, const boost::python::detail::keyword_range&) [with ClassT = boost::python::class_<PyObserver, boost::noncopyable, boost::python::detail::not_specified, boost::python::detail::not_specified>, CallPoliciesT = boost::python::default_call_policies, Signature = boost::mpl::vector0<mpl_::na>, NArgs = boost::mpl::size<boost::mpl::vector0<mpl_::na> >]'
    ../DCDEventLayer/boost/include/boost/python/init.hpp:399: instantiated from static void boost::python::detail::define\_class\_init\_helper<0>::apply(ClassT&, const CallPoliciesT&, const Signature&, NArgs, const char*, const boost::python::detail::keyword\_range&) [with ClassT = boost::python::class_<PyObserver, boost::noncopyable, boost::python::detail::not\_specified, boost::python::detail::not\_specified>, CallPoliciesT = boost::python::default\_call\_policies, Signature = boost::mpl::vector0<mpl_::na>, NArgs = boost::mpl::size<boost::mpl::vector0<mpl_::na> >]' ../DCDEventLayer/boost/include/boost/python/init.hpp:171: instantiated fromvoid boost::python::init_base<DerivedT>::visit(classT&) const [with classT = boost::python::class_<PyObserver, boost::noncopyable, boost::python::detail::not_specified, boost::python::detail::not_specified>, DerivedT = boost::python::init<mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_>]'
    ../DCDEventLayer/boost/include/boost/python/def_visitor.hpp:31: instantiated from static void boost::python::def\_visitor\_access::visit(const V&, classT&) [with V = boost::python::def\_visitor<boost::python::init<mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_> >, classT = boost::python::class_<PyObserver, boost::noncopyable, boost::python::detail::not\_specified, boost::python::detail::not\_specified>]' ../DCDEventLayer/boost/include/boost/python/def\_visitor.hpp:67: instantiated fromvoid boost::python::def_visitor<DerivedVisitor>::visit(classT&) const [with classT = boost::python::class_<PyObserver, boost::noncopyable, boost::python::detail::not_specified, boost::python::detail::not_specified>, DerivedVisitor = boost::python::init<mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_>]'
    ../DCDEventLayer/boost/include/boost/python/class.hpp:225: instantiated from boost::python::class_<T, X1, X2, X3>& boost::python::class_<T, X1, X2, X3>::def(const boost::python::def\_visitor<Derived>&) [with Derived = boost::python::init<mpl\_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_>, W = PyObserver, X1 = boost::noncopyable, X2 = boost::python::detail::not\_specified, X3 = boost::python::detail::not\_specified]' ../DCDEventLayer/boost/include/boost/python/class.hpp:501: instantiated fromvoid boost::python::class_<T, X1, X2, X3>::initialize(const DefVisitor&) [with DefVisitor = boost::python::init<mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_>, W = PyObserver, X1 = boost::noncopyable, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]'
    ../DCDEventLayer/boost/include/boost/python/class.hpp:629: instantiated from boost::python::class_<T, X1, X2, X3>::class_(const char*, const char*) [with W = PyObserver, X1 = boost::noncopyable, X2 = boost::python::detail::not\_specified, X3 = boost::python::detail::not\_specified]' pyBoost.cpp:48: instantiated from here ../DCDEventLayer/boost/include/boost/python/detail/is_wrapper.hpp:25: error: \boost::python::wrapper<Observer>' is an inaccessible base of `PyObserver'
    ../DCDEventLayer/boost/include/boost/python/class.hpp: In member function void boost::python::class_<T, X1, X2, X3>::def\_maybe\_overloads(const char*, Fn, const A1&, ...) [with Fn = boost::python::api::object, A1 = const char*, W = PyObserver, X1 = boost::noncopyable, X2 = boost::python::detail::not\_specified, X3 = boost::python::detail::not\_specified]': ../DCDEventLayer/boost/include/boost/python/class.hpp:244: instantiated fromboost::python::class_<T, X1, X2, X3>& boost::python::class_<T, X1, X2, X3>::def(const char*, A1, const A2&) [with A1 = boost::python::api::object, A2 = const char*, W = PyObserver, X1 = boost::noncopyable, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]'
    ../DCDEventLayer/boost/include/boost/python/init.hpp:330: instantiated from void boost::python::detail::def\_init\_aux(ClassT&, const Signature&, NArgs, const CallPoliciesT&, const char*, const boost::python::detail::keyword\_range&) [with ClassT = boost::python::class\_<PyObserver, boost::noncopyable, boost::python::detail::not\_specified, boost::python::detail::not\_specified>, CallPoliciesT = boost::python::default\_call\_policies, Signature = boost::mpl::vector0<mpl_::na>, NArgs = boost::mpl::size<boost::mpl::vector0<mpl_::na> >]' ../DCDEventLayer/boost/include/boost/python/init.hpp:399: instantiated fromstatic void boost::python::detail::define_class_init_helper<0>::apply(ClassT&, const CallPoliciesT&, const Signature&, NArgs, const char*, const boost::python::detail::keyword_range&) [with ClassT = boost::python::class_<PyObserver, boost::noncopyable, boost::python::detail::not_specified, boost::python::detail::not_specified>, CallPoliciesT = boost::python::default_call_policies, Signature = boost::mpl::vector0<mpl_::na>, NArgs = boost::mpl::size<boost::mpl::vector0<mpl_::na> >]'
    ../DCDEventLayer/boost/include/boost/python/init.hpp:171: instantiated from void boost::python::init\_base<DerivedT>::visit(classT&) const [with classT = boost::python::class\_<PyObserver, boost::noncopyable, boost::python::detail::not\_specified, boost::python::detail::not\_specified>, DerivedT = boost::python::init<mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_>]' ../DCDEventLayer/boost/include/boost/python/def\_visitor.hpp:31: instantiated fromstatic void boost::python::def_visitor_access::visit(const V&, classT&) [with V = boost::python::def_visitor<boost::python::init<mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_> >, classT = boost::python::class_<PyObserver, boost::noncopyable, boost::python::detail::not_specified, boost::python::detail::not_specified>]'
    ../DCDEventLayer/boost/include/boost/python/def_visitor.hpp:67: instantiated from void boost::python::def\_visitor<DerivedVisitor>::visit(classT&) const [with classT = boost::python::class_<PyObserver, boost::noncopyable, boost::python::detail::not\_specified, boost::python::detail::not\_specified>, DerivedVisitor = boost::python::init<mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_>]' ../DCDEventLayer/boost/include/boost/python/class.hpp:225: instantiated fromboost::python::class_<T, X1, X2, X3>& boost::python::class_<T, X1, X2, X3>::def(const boost::python::def_visitor<Derived>&) [with Derived = boost::python::init<mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_>, W = PyObserver, X1 = boost::noncopyable, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]'
    ../DCDEventLayer/boost/include/boost/python/class.hpp:501: instantiated from void boost::python::class_<T, X1, X2, X3>::initialize(const DefVisitor&) [with DefVisitor = boost::python::init<mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_>, W = PyObserver, X1 = boost::noncopyable, X2 = boost::python::detail::not\_specified, X3 = boost::python::detail::not\_specified]' ../DCDEventLayer/boost/include/boost/python/class.hpp:629: instantiated fromboost::python::class_<T, X1, X2, X3>::class_(const char*, const char*) [with W = PyObserver, X1 = boost::noncopyable, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]'
    pyBoost.cpp:48: instantiated from here
    ../DCDEventLayer/boost/include/boost/python/class.hpp:608: error: `boost::python::wrapper<Observer>' is an inaccessible base of `PyObserver'
    ../DCDEventLayer/boost/include/boost/python/object/value_holder.hpp: In constructor boost::python::objects::value\_holder<Value>::value_holder(PyObject*) [with Value = PyObserver]': ../DCDEventLayer/boost/include/boost/python/object/make\_holder.hpp:83: instantiated fromstatic void boost::python::objects::make_holder<0>::apply<Holder, ArgList>::execute(PyObject*) [with Holder = boost::python::objects::value_holder<PyObserver>, ArgList = boost::mpl::vector0<mpl_::na>]'
    ../DCDEventLayer/boost/include/boost/python/detail/make_keyword_range_fn.hpp:60: instantiated from boost::python::api::object boost::python::detail::make\_keyword\_range\_constructor(const CallPolicies&, const boost::python::detail::keyword\_range&, Holder*, ArgList*, Arity*) [with ArgList = boost::mpl::vector0<mpl\_::na>, Arity = boost::mpl::size<boost::mpl::vector0<mpl_::na> >, Holder = boost::python::objects::value\_holder<PyObserver>, CallPolicies = boost::python::default\_call_policies]' ../DCDEventLayer/boost/include/boost/python/init.hpp:330: instantiated fromvoid boost::python::detail::def_init_aux(ClassT&, const Signature&, NArgs, const CallPoliciesT&, const char*, const boost::python::detail::keyword_range&) [with ClassT = boost::python::class_<PyObserver, boost::noncopyable, boost::python::detail::not_specified, boost::python::detail::not_specified>, CallPoliciesT = boost::python::default_call_policies, Signature = boost::mpl::vector0<mpl_::na>, NArgs = boost::mpl::size<boost::mpl::vector0<mpl_::na> >]'
    ../DCDEventLayer/boost/include/boost/python/init.hpp:399: instantiated from static void boost::python::detail::define\_class\_init\_helper<0>::apply(ClassT&, const CallPoliciesT&, const Signature&, NArgs, const char*, const boost::python::detail::keyword\_range&) [with ClassT = boost::python::class_<PyObserver, boost::noncopyable, boost::python::detail::not\_specified, boost::python::detail::not\_specified>, CallPoliciesT = boost::python::default\_call\_policies, Signature = boost::mpl::vector0<mpl_::na>, NArgs = boost::mpl::size<boost::mpl::vector0<mpl_::na> >]' ../DCDEventLayer/boost/include/boost/python/init.hpp:171: instantiated fromvoid boost::python::init_base<DerivedT>::visit(classT&) const [with classT = boost::python::class_<PyObserver, boost::noncopyable, boost::python::detail::not_specified, boost::python::detail::not_specified>, DerivedT = boost::python::init<mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_>]'
    ../DCDEventLayer/boost/include/boost/python/def_visitor.hpp:31: instantiated from static void boost::python::def\_visitor\_access::visit(const V&, classT&) [with V = boost::python::def\_visitor<boost::python::init<mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_> >, classT = boost::python::class_<PyObserver, boost::noncopyable, boost::python::detail::not\_specified, boost::python::detail::not\_specified>]' ../DCDEventLayer/boost/include/boost/python/def\_visitor.hpp:67: instantiated fromvoid boost::python::def_visitor<DerivedVisitor>::visit(classT&) const [with classT = boost::python::class_<PyObserver, boost::noncopyable, boost::python::detail::not_specified, boost::python::detail::not_specified>, DerivedVisitor = boost::python::init<mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_>]'
    ../DCDEventLayer/boost/include/boost/python/class.hpp:225: instantiated from boost::python::class_<T, X1, X2, X3>& boost::python::class_<T, X1, X2, X3>::def(const boost::python::def\_visitor<Derived>&) [with Derived = boost::python::init<mpl\_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_>, W = PyObserver, X1 = boost::noncopyable, X2 = boost::python::detail::not\_specified, X3 = boost::python::detail::not\_specified]' ../DCDEventLayer/boost/include/boost/python/class.hpp:501: instantiated fromvoid boost::python::class_<T, X1, X2, X3>::initialize(const DefVisitor&) [with DefVisitor = boost::python::init<mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_, mpl_::void_>, W = PyObserver, X1 = boost::noncopyable, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]'
    ../DCDEventLayer/boost/include/boost/python/class.hpp:629: instantiated from boost::python::class_<T, X1, X2, X3>::class_(const char*, const char*) [with W = PyObserver, X1 = boost::noncopyable, X2 = boost::python::detail::not\_specified, X3 = boost::python::detail::not\_specified]' pyBoost.cpp:48: instantiated from here ../DCDEventLayer/boost/include/boost/python/object/value\_holder.hpp:136: error: \boost::python::detail::wrapper_base' is an inaccessible base of `PyObserver'
    make: *** [pyBoost.o] Error 1

    Zwei drei kleinere Fehler hatte ich auch im source, aber diese Meldung kommt von der Definition im BOOST_PYTHON_MODULE_INIT.



  • tyr377 schrieb:

    g++ -I../DCDEventLayer/boost/include/ -I/usr/include/python2.3 -c -o pyBoost.o pyBoost.cpp
    ../DCDEventLayer/boost/include/boost/python/class.hpp: In constructor boost::python::class_<T, X1, X2, X3>::id\_vector::id\_vector() [with W = PyObserver, X1 = boost::noncopyable, X2 = boost::python::detail::not\_specified, X3 = boost::python::detail::not\_specified]': ../DCDEventLayer/boost/include/boost/python/class.hpp:628: instantiated fromboost::python::class_<T, X1, X2, X3>::class_(const char*, const char*) [with W = PyObserver, X1 = boost::noncopyable, X2 = boost::python::detail::not_specified, X3 = boost::python::detail::not_specified]'
    pyBoost.cpp:48: instantiated from here
    ../DCDEventLayer/boost/include/boost/python/class.hpp:179: error: `boost::python::wrapper<Observer>' is an inaccessible base of `PyObserver'

    Da fehlt anscheindend ein 'public' vor dem 'wrapper<Observer>' (Default-Ableitung ist 'private' - und die erlaubt keine implizite Typumwandlung).

    Kleiner Tip: Wenn's die Übersicht stört, kannst du die ganzen "instanciated from"-Zeilen auch überlesen 😉



  • Ich geb zu, die Ausgabe hat mich erschlagen. Aber du hast recht. nun macht er's. vielen Dank, du hast meinen Tag gerettet. 😉


Log in to reply