List Info

Thread: Re: R: Re: R: Re: Boost.Python type registry




Re: R: Re: R: Re: Boost.Python type registry
country flaguser name
United States
2007-10-05 13:46:26
Would it help you if you had an interface to extract an
array of
type_info objects known to the registry?
If you send patches with docs I'll review them.
BTW: What you need seems very unusual. Could you explain the
situation?
Did you consider alternative approaches?
Ralf

----- Original Message ----
From: François Duranleau <duranlefiro.umontreal.ca>
To: jumpjoefastwebnet.it; Development of Python/C++ integration
<c++-sigpython.org>
Sent: Friday, October 5, 2007 8:22:20 AM
Subject: Re: [C++-sig] R: Re:  R: Re:  Boost.Python type
registry

On Fri, 5 Oct 2007, jumpjoefastwebnet.it wrote:

>> I think that you can search the registry for entry
with m_class_object 
>> that matches your PyObject's type or search the
lvalue_chain(s) for a 
>> converter that returns !=0. But there is no api for
that so far.
>
> This is another interesting approach, but after a few
tries, I 
> discovered the registry is really hard to get by, as it
is a static 
> variable defined in a "hidden" function in an
anonymous namespace in the 
> registry.cpp file. Any suggestions on how to extract
it? As an "extern" 
> of some kind?

Without modifying the source code, there is no way. The only
way to search 
the registry externally is via the
boost::python::converter::query 
function, but then you need to provide a type_info, and to
do this 
exhaustively is not really simpler than using an
"inverse" registry like I 
mentionned.

-- 
Francois Duranleau
_______________________________________________
C++-sig mailing list
C++-sigpython.org
http:
//mail.python.org/mailman/listinfo/c++-sig



_______________________________________________
C++-sig mailing list
C++-sigpython.org
http:
//mail.python.org/mailman/listinfo/c++-sig

Re: R: Re: R: Re: Boost.Python type registry
country flaguser name
Canada
2007-10-05 20:29:07
On Fri, 5 Oct 2007, Ralf W. Grosse-Kunstleve wrote:

> Would it help you if you had an interface to extract an
array of
> type_info objects known to the registry?
> If you send patches with docs I'll review them.
> BTW: What you need seems very unusual. Could you
explain the situation?
> Did you consider alternative approaches?

I don't know why the OP required this. I once thought it
would be useful 
for implicit conversions to/from boost.function objects, but
then I 
realized that even if you get the type_info, you still need
to extract the 
object without having a (C++) type. So I ended up having to
register 
manually an implicit conversion to/from boost.function for
all exposed 
functors, which is not all that convenient. And I have yet
to make this 
work for functions.

-- 
Francois Duranleau
_______________________________________________
C++-sig mailing list
C++-sigpython.org
http:
//mail.python.org/mailman/listinfo/c++-sig

Re: Boost.Python type registry
user name
2007-10-08 03:48:07
On Friday 05 October 2007 20:46:26 Ralf W. Grosse-Kunstleve
wrote:

> BTW: What you need seems very unusual. Could you
explain the situation?
> Did you consider alternative approaches?

The situation is definitely unusual, but I will try to
explain.

I have a simulator that uses a C++ kernel and a bunch of
simulation 
components. Now I want to wrap both kernel and components
and add scripting 
and inspection functionality in Python. Python will be used
to instantiate 
the simulation components and run what I will call the
"architecture".
So far, so good, I have everything wrapped.

The problem is that I might want to debug the architecture.
I was thinking of 
using GDB, but since components are instantiated in Python
(note that I might 
have more objects that belong to one class), it is hard to
get a reference to 
them. Setting a breakpoint on the source code is be easy,
but putting a watch 
on a variable is much more tricky.

In the end what I would like to have is a sort of
python-controlled GDB 
breakpoint mechanism, where I set a condition in python and
C++ is stopped 
when the condition arises.
Getting a reference to the object/variable should be enough
to put a watch in 
GDB (and here's why I'm trying to pass from PyObject to the
C++ address).

Any suggestion is welcome!

-- 
Giovanni Beltrame
TEC-EDM Research Fellow
European Space Agency
_______________________________________________
C++-sig mailing list
C++-sigpython.org
http:
//mail.python.org/mailman/listinfo/c++-sig

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )