| 176 | } |
| 177 | |
| 178 | String Adduct::checkFormula_(const String& formula) |
| 179 | { |
| 180 | EmpiricalFormula ef(formula); |
| 181 | if (ef.getCharge() != 0) |
| 182 | { |
| 183 | std::cerr << "Warning: Adduct contains explicit charge (alternating mass)! (" << formula << ")\n"; |
| 184 | } |
| 185 | if (ef.isEmpty()) |
| 186 | { |
| 187 | std::cerr << "Warning: Adduct was given empty formula! (" << formula << ")\n"; |
| 188 | } |
| 189 | if ((ef.getNumberOfAtoms() > 1) && (std::distance(ef.begin(), ef.end()) == 1)) |
| 190 | { |
| 191 | std::cerr << "Warning: Adduct was given only a single element but with an abundance>1. This might lead to errors! (" << formula << ")\n"; |
| 192 | } |
| 193 | |
| 194 | return ef.toString(); |
| 195 | } |
| 196 | |
| 197 | ///Print the contents of an Adduct to a stream. |
| 198 | OPENMS_DLLAPI std::ostream& operator<<(std::ostream& os, const Adduct& a) |