BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
KERNEL/forEach.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 // $Id: forEach.h,v 1.16 2004/02/18 23:24:04 oliver Exp $
5 //
6 
7 #ifndef BALL_KERNEL_FOREACH_H
8 #define BALL_KERNEL_FOREACH_H
9 
10 // This is mostly to allow Doxygen to put the macros to where they belong
11 namespace BALL
12 {
13 
19 
27 #define BALL_FOREACH_MOLECULE(molecule_container, molecule_iterator) \
28 for (molecule_iterator = (molecule_container).beginMolecule(); \
29  !molecule_iterator.isEnd(); ++molecule_iterator)
30 
31 
39 #define BALL_FOREACH_FRAGMENT(fragment_container, fragment_iterator) \
40 for (fragment_iterator = (fragment_container).beginFragment(); \
41  !fragment_iterator.isEnd(); ++fragment_iterator)
42 
43 
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)
54 
55 
63 #define BALL_FOREACH_ATOM(atom_container, atom_iterator) \
64 for (atom_iterator = (atom_container).beginAtom(); \
65  !atom_iterator.isEnd(); ++atom_iterator)
66 
67 
76 #define BALL_FOREACH_ATOM_BOND(bond_container, bond_iterator) \
77 for (bond_iterator = (bond_container).beginBond(); \
78  !bond_iterator.isEnd(); ++bond_iterator)
79 
80 
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))
95 
96 
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()))
114 
115 
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()))
131 
132 
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()))
147 
148 
155 #define BALL_FOREACH_PROTEIN(protein_container, protein_iterator) \
156 for (protein_iterator = (protein_container).beginProtein(); \
157  !protein_iterator.isEnd(); ++protein_iterator)
158 
159 
165 #define BALL_FOREACH_CHAIN(chain_container, chain_iterator) \
166 for (chain_iterator = (chain_container).beginChain(); \
167  !chain_iterator.isEnd(); ++chain_iterator)
168 
169 
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)
179 
180 
186 #define BALL_FOREACH_RESIDUE(residue_container, residue_iterator) \
187 for (residue_iterator = (residue_container).beginResidue(); \
188  !residue_iterator.isEnd(); \
189  ++residue_iterator)
190 
191 
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)
200 
202 
203 } // namespace BALL
204 
205 #endif // BALL_KERNEL_FOREACH_H