[C++-sig] examples for add_override_precall_code?

Nathan Stewart swarfrat at gmail.com
Thu Mar 25 21:33:52 CET 2010


I have pyplusplus churning out code, now I'm trying to get it to resemble
what I need. I need to use add_override_precall_code, to add some thread
locking to my overrides, but I can't seem to figure out how to use it from
the docs. Also, I have a set of overloaded virtual functions, and previously
I've had a wrapper class where the python exports rename the overloads, like
so:

class Connection
{
    virtual void Callback(const Type_A&);
    virtual void Callback(const Type_B&);
}

the wrapper looked like:

ConnectionWrap : Connection, wrapper<Connection>
{
    void Callback(const Type_A& arg)
    {
        ScopedGILLock lock(m_state); // the reason I'm trying to figure out
add_override_porecall_code
        if (override o = this->get_override("Callback_Type_A"))
        { o(arg);  }
    }
};


I'm getting the rest of the override as above, but setting
use_overload_macro doesn't rename the overloads as I need. Any clues (since
pointers are references are both 'overloaded' in this context')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20100325/b49a7329/attachment.html>


More information about the Cplusplus-sig mailing list