| 28 | } |
| 29 | |
| 30 | void ParamXMLFile::store(const String& filename, const Param& param) const |
| 31 | { |
| 32 | //open file |
| 33 | std::ofstream os_; |
| 34 | std::ostream* os_ptr; |
| 35 | if (filename != "-") |
| 36 | { |
| 37 | os_.open(filename.c_str(), std::ofstream::out); |
| 38 | if (!os_) |
| 39 | { |
| 40 | throw Exception::UnableToCreateFile(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, filename); |
| 41 | } |
| 42 | os_ptr = &os_; |
| 43 | } |
| 44 | else |
| 45 | { |
| 46 | os_ptr = &std::cout; |
| 47 | } |
| 48 | |
| 49 | //write to file stream |
| 50 | writeXMLToStream(os_ptr, param); |
| 51 | |
| 52 | os_.close(); |
| 53 | } |
| 54 | |
| 55 | void ParamXMLFile::writeXMLToStream(std::ostream* os_ptr, const Param& param) const |
| 56 | { |