Hi,
following a discussion a few hours ago with Donald, I’m wondering what should
be the preferred way to iterate over the atoms of a molecule in Avo.
Currently, we’re using the deprecated BeginAtom and NextAtom, and that’s ugly!
In a const method of Molecule, it looks like:
for( Atom* atom = static_cast<Atom*>(const_cast<Molecule*>(this))
->BeginAtom(atom_iterator);
atom;
atom = static_cast<Atom*>(const_cast<Molecule*>(this))
->NextAtom(atom_iterator) )
{
…
}
So I think a better solution is needed!
I was suggesting subclassing OBMolAtomIter, and making a macro similar to
FOR_ATOMS_OF_MOL, but Donald didn’t seem 100% convinced, and suggested to
write here to ask your opinion, Geoff.
Cheers,
Benoit
I certainly will prefer stl syntax as much as possible and const correctness
Armando
Hi,
following a discussion a few hours ago with Donald, I’m wondering what
should be the preferred way to iterate over the atoms of a molecule in Avo.
Currently, we’re using the deprecated BeginAtom and NextAtom, and that’s
ugly! In a const method of Molecule, it looks like:
for( Atom* atom = static_cast<Atom*>(const_cast<Molecule*>(this))
->BeginAtom(atom_iterator);
atom;
atom = static_cast<Atom*>(const_cast<Molecule*>(this))
->NextAtom(atom_iterator) )
{
…
}
So I think a better solution is needed!
I was suggesting subclassing OBMolAtomIter, and making a macro similar to
FOR_ATOMS_OF_MOL, but Donald didn’t seem 100% convinced, and suggested to
write here to ask your opinion, Geoff.
Cheers,
Benoit
–
Dr. Armando Navarro-Vázquez
RIAIDT. Univdade de Resonancia Magnetica
Universidade de Santiago de Compostela
http://desoft03.usc.es/armando/index.html
On Mar 16, 2007, at 9:28 AM, Benoît Jacob wrote:
Currently, we’re using the deprecated BeginAtom and NextAtom, and
that’s ugly!
I’m not actually sure they’ll be eliminated from Open Babel, but they
are ugly.
I was suggesting subclassing OBMolAtomIter, and making a macro
similar to
FOR_ATOMS_OF_MOL, but Donald didn’t seem 100% convinced, and
suggested to
write here to ask your opinion, Geoff.
Yes, 100%. It’s a much cleaner way to do it.
Cheers,
-Geoff
On Friday 16 March 2007 16:26:06 Geoffrey Hutchison wrote:
Yes, 100%. It’s a much cleaner way to do it.
OK, will do it.
Benoit
Cheers,
-Geoff