Go to the documentation of this file.
7 #ifndef BALL_KERNEL_FOREACH_H
8 #define BALL_KERNEL_FOREACH_H
27 #define BALL_FOREACH_MOLECULE(molecule_container, molecule_iterator) \
28 for (molecule_iterator = (molecule_container).beginMolecule(); \
29 !molecule_iterator.isEnd(); ++molecule_iterator)
39 #define BALL_FOREACH_FRAGMENT(fragment_container, fragment_iterator) \
40 for (fragment_iterator = (fragment_container).beginFragment(); \
41 !fragment_iterator.isEnd(); ++fragment_iterator)
51 #define BALL_FOREACH_ATOMCONTAINER(atom_containers, atom_container_iterator) \
52 for (atom_container_iterator = (atom_containers).beginAtomContainer(); \
53 !atom_container_iterator.isEnd(); ++atom_container_iterator)
63 #define BALL_FOREACH_ATOM(atom_container, atom_iterator) \
64 for (atom_iterator = (atom_container).beginAtom(); \
65 !atom_iterator.isEnd(); ++atom_iterator)
76 #define BALL_FOREACH_ATOM_BOND(bond_container, bond_iterator) \
77 for (bond_iterator = (bond_container).beginBond(); \
78 !bond_iterator.isEnd(); ++bond_iterator)
89 #define BALL_FOREACH_ATOM_PAIR(atom_container, first_atom_iterator, second_atom_iterator) \
90 for (first_atom_iterator = (atom_container).beginAtom(); \
91 !first_atom_iterator.isEnd(); ++first_atom_iterator) \
92 for (second_atom_iterator = (atom_container).beginAtom(); \
93 !second_atom_iterator.isEnd(); ++second_atom_iterator) \
94 if ((*first_atom_iterator) < (*second_atom_iterator))
107 #define BALL_FOREACH_BOND(atom_container, atom_iterator, bond_iterator) \
108 for (atom_iterator = (atom_container).beginAtom(); \
109 !atom_iterator.isEnd(); ++atom_iterator) \
110 for (bond_iterator = (*atom_iterator).beginBond(); \
111 !bond_iterator.isEnd(); ++bond_iterator) \
112 if ((*bond_iterator).getFirstAtom() == &(*atom_iterator) \
113 || !(atom_container).isAncestorOf(*(*bond_iterator).getFirstAtom()))
123 #define BALL_FOREACH_INTERBOND(atom_container, atom_iterator, bond_iterator) \
124 for (atom_iterator = (atom_container).beginAtom(); \
125 !atom_iterator.isEnd(); ++atom_iterator) \
126 for (bond_iterator = (*atom_iterator).beginBond(); \
127 !bond_iterator.isEnd(); ++bond_iterator) \
128 if (((*bond_iterator).getFirstAtom() == &(*atom_iterator) \
129 && !(atom_container).isAncestorOf(*(*bond_iterator).getSecondAtom())) \
130 || !(atom_container).isAncestorOf(*(*bond_iterator).getFirstAtom()))
140 #define BALL_FOREACH_INTRABOND(atom_container, atom_iterator, bond_iterator) \
141 for (atom_iterator = (atom_container).beginAtom(); \
142 !atom_iterator.isEnd(); ++atom_iterator) \
143 for (bond_iterator = (*atom_iterator).beginBond(); \
144 !bond_iterator.isEnd(); ++bond_iterator) \
145 if ((*bond_iterator).getFirstAtom() == &(*atom_iterator) \
146 && (atom_container).isAncestorOf(*(*bond_iterator).getSecondAtom()))
155 #define BALL_FOREACH_PROTEIN(protein_container, protein_iterator) \
156 for (protein_iterator = (protein_container).beginProtein(); \
157 !protein_iterator.isEnd(); ++protein_iterator)
165 #define BALL_FOREACH_CHAIN(chain_container, chain_iterator) \
166 for (chain_iterator = (chain_container).beginChain(); \
167 !chain_iterator.isEnd(); ++chain_iterator)
176 #define BALL_FOREACH_SECONDARYSTRUCTURE(secondary_structure_container, secondary_structure_iterator) \
177 for (secondary_structure_iterator = (secondary_structure_container).beginSecondaryStructure(); \
178 !secondary_structure_iterator.isEnd(); ++secondary_structure_iterator)
186 #define BALL_FOREACH_RESIDUE(residue_container, residue_iterator) \
187 for (residue_iterator = (residue_container).beginResidue(); \
188 !residue_iterator.isEnd(); \
197 #define BALL_FOREACH_PDBATOM(pdb_atom_container, pdb_atom_iterator) \
198 for (pdb_atom_iterator = (pdb_atom_container).beginPDBAtom(); \
199 !pdb_atom_iterator.isEnd(); ++pdb_atom_iterator)
205 #endif // BALL_KERNEL_FOREACH_H