[C++-sig] splitting it into multiple pieces
Ralf W. Grosse-Kunstleve
rwgk at yahoo.com
Wed Oct 23 01:33:30 CEST 2002
--- greg Landrum <greglandrum at mindspring.com> wrote:
> The problem is that I've got a bunch of interconnected objects:
> Molecules are made up of Atoms and Bonds (and have GetAtom/Bond methods)
> Atoms and Bonds each contain a pointer back to their parent Molecule (and
> have GetParent methods)
>
> I'd like to have separate modules for Mols, Atoms and Bonds. Can I do this
> given the interdependencies?
Yes, this is no problem if you are using Boost.Python V2. I do this all the
time.
> If so, is there a convenient example laying around somewhere I can
> look at/steal code from?
I got into the habit of binding one class per file. E.g.:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/cctbx/cctbx/sgtbx/boost_python/?only_with_tag=boost_python_v2_transition_2
The "top-level" module in this directory is sgtbx_module.cpp. This module calls
the bindings in all the other files (e.g. wrap_brick();). I am pointing you to
this directory specifically because MSVC 7 even made me split up the bindings
for one class: files space_group.cpp and space_group_2.cpp . It all works
without a problem on a variety of platforms.
Related suggestion: you could try lowering BOOST_PYTHON_MAX_ARITY and
BOOST_PYTHON_MAX_BASES (see Boost.Python configuration docs). Maybe this helps
MSVC, but I am not sure.
Ralf
__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/
More information about the Cplusplus-sig
mailing list