00001
00002
00003
00004
00005
00006
00007 #ifndef BALL_KERNEL_FOREACH_H
00008 #define BALL_KERNEL_FOREACH_H
00009
00010
00011 namespace BALL
00012 {
00013
00019
00027 #define BALL_FOREACH_MOLECULE(molecule_container, molecule_iterator) \
00028 for (molecule_iterator = (molecule_container).beginMolecule(); \
00029 !molecule_iterator.isEnd(); ++molecule_iterator)
00030
00031
00039 #define BALL_FOREACH_FRAGMENT(fragment_container, fragment_iterator) \
00040 for (fragment_iterator = (fragment_container).beginFragment(); \
00041 !fragment_iterator.isEnd(); ++fragment_iterator)
00042
00043
00051 #define BALL_FOREACH_ATOMCONTAINER(atom_containers, atom_container_iterator) \
00052 for (atom_container_iterator = (atom_containers).beginAtomContainer(); \
00053 !atom_container_iterator.isEnd(); ++atom_container_iterator)
00054
00055
00063 #define BALL_FOREACH_ATOM(atom_container, atom_iterator) \
00064 for (atom_iterator = (atom_container).beginAtom(); \
00065 !atom_iterator.isEnd(); ++atom_iterator)
00066
00067
00076 #define BALL_FOREACH_ATOM_BOND(bond_container, bond_iterator) \
00077 for (bond_iterator = (bond_container).beginBond(); \
00078 !bond_iterator.isEnd(); ++bond_iterator)
00079
00080
00089 #define BALL_FOREACH_ATOM_PAIR(atom_container, first_atom_iterator, second_atom_iterator) \
00090 for (first_atom_iterator = (atom_container).beginAtom(); \
00091 !first_atom_iterator.isEnd(); ++first_atom_iterator) \
00092 for (second_atom_iterator = (atom_container).beginAtom(); \
00093 !second_atom_iterator.isEnd(); ++second_atom_iterator) \
00094 if ((*first_atom_iterator) < (*second_atom_iterator))
00095
00096
00107 #define BALL_FOREACH_BOND(atom_container, atom_iterator, bond_iterator) \
00108 for (atom_iterator = (atom_container).beginAtom(); \
00109 !atom_iterator.isEnd(); ++atom_iterator) \
00110 for (bond_iterator = (*atom_iterator).beginBond(); \
00111 !bond_iterator.isEnd(); ++bond_iterator) \
00112 if ((*bond_iterator).getFirstAtom() == &(*atom_iterator) \
00113 || !(atom_container).isAncestorOf(*(*bond_iterator).getFirstAtom()))
00114
00115
00123 #define BALL_FOREACH_INTERBOND(atom_container, atom_iterator, bond_iterator) \
00124 for (atom_iterator = (atom_container).beginAtom(); \
00125 !atom_iterator.isEnd(); ++atom_iterator) \
00126 for (bond_iterator = (*atom_iterator).beginBond(); \
00127 !bond_iterator.isEnd(); ++bond_iterator) \
00128 if (((*bond_iterator).getFirstAtom() == &(*atom_iterator) \
00129 && !(atom_container).isAncestorOf(*(*bond_iterator).getSecondAtom())) \
00130 || !(atom_container).isAncestorOf(*(*bond_iterator).getFirstAtom()))
00131
00132
00140 #define BALL_FOREACH_INTRABOND(atom_container, atom_iterator, bond_iterator) \
00141 for (atom_iterator = (atom_container).beginAtom(); \
00142 !atom_iterator.isEnd(); ++atom_iterator) \
00143 for (bond_iterator = (*atom_iterator).beginBond(); \
00144 !bond_iterator.isEnd(); ++bond_iterator) \
00145 if ((*bond_iterator).getFirstAtom() == &(*atom_iterator) \
00146 && (atom_container).isAncestorOf(*(*bond_iterator).getSecondAtom()))
00147
00148
00155 #define BALL_FOREACH_PROTEIN(protein_container, protein_iterator) \
00156 for (protein_iterator = (protein_container).beginProtein(); \
00157 !protein_iterator.isEnd(); ++protein_iterator)
00158
00159
00165 #define BALL_FOREACH_CHAIN(chain_container, chain_iterator) \
00166 for (chain_iterator = (chain_container).beginChain(); \
00167 !chain_iterator.isEnd(); ++chain_iterator)
00168
00169
00176 #define BALL_FOREACH_SECONDARYSTRUCTURE(secondary_structure_container, secondary_structure_iterator) \
00177 for (secondary_structure_iterator = (secondary_structure_container).beginSecondaryStructure(); \
00178 !secondary_structure_iterator.isEnd(); ++secondary_structure_iterator)
00179
00180
00186 #define BALL_FOREACH_RESIDUE(residue_container, residue_iterator) \
00187 for (residue_iterator = (residue_container).beginResidue(); \
00188 !residue_iterator.isEnd(); \
00189 ++residue_iterator)
00190
00191
00197 #define BALL_FOREACH_PDBATOM(pdb_atom_container, pdb_atom_iterator) \
00198 for (pdb_atom_iterator = (pdb_atom_container).beginPDBAtom(); \
00199 !pdb_atom_iterator.isEnd(); ++pdb_atom_iterator)
00200
00202
00203 }
00204
00205 #endif // BALL_KERNEL_FOREACH_H