dave at boost-consulting.com
Wed Nov 13 15:10:04 CET 2002
"Brett Calcott" <brett.calcott at paradise.net.nz> writes:
>> > The problem is I wanted to expose agent and py_agent,
> Here is some context:
> I am writing a multi-agent simulation. I have done a bit of this in C++, but
> this time I want to write just the core engine in C++ and use python for all
> the surrounding framework. I want to be able to create agents, save them,
> query them, all using a commandline or gui in python (wx probably). However,
> when it comes to the actual simulation I want this to happen in C++. It's a
> bit like Numeric - the workhorse calls involving iteration across lots of
> data happen in C. However, for experimental purposes, I want to be able
> create a python agent which inherits all of the features of the normal
> agent - but allows me to override certain things. Once I get something
> right, I can push the python code back into C++ for speed.
> So - I wanted agent to be exposed to python so I can create pure C++ agents,
> and py_agent exposed so I can choose to override the default compiled
> behaviour and sacrifice some speed whilst I mess around with new features.
For that you just need to expose agent, using py_agent as a
Holder. There's no need to expose py_agent itself.
> Actually (although it no longer matters with the solution I have no using
> to_python converters) I needed to expose agent otherwise the the python
> calls involving agent_ptr would not work.
> Koenig lookup. Sigh... You forget about that sort of thing after using the
> same broken compiler for 4 years. 'Whatever works' becomes your motto.
Heh, I understand.
dave at boost-consulting.com * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution
More information about the Cplusplus-sig