Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef OPENMS_FORMAT_MZMLFILE_H
00036 #define OPENMS_FORMAT_MZMLFILE_H
00037
00038 #include <OpenMS/FORMAT/XMLFile.h>
00039 #include <OpenMS/FORMAT/HANDLERS/MzMLHandler.h>
00040 #include <OpenMS/FORMAT/OPTIONS/PeakFileOptions.h>
00041 #include <OpenMS/CONCEPT/ProgressLogger.h>
00042 #include <OpenMS/CONCEPT/Exception.h>
00043 #include <OpenMS/METADATA/DocumentIdentifier.h>
00044
00045 namespace OpenMS
00046 {
00058 class OPENMS_DLLAPI MzMLFile :
00059 public Internal::XMLFile,
00060 public ProgressLogger
00061 {
00062 public:
00064 MzMLFile();
00066 ~MzMLFile();
00067
00069 PeakFileOptions & getOptions();
00070
00072 const PeakFileOptions & getOptions() const;
00073
00082 template <typename MapType>
00083 void load(const String & filename, MapType & map)
00084 {
00085 map.reset();
00086
00087
00088 map.setLoadedFileType(filename);
00089 map.setLoadedFilePath(filename);
00090
00091 Internal::MzMLHandler<MapType> handler(map, filename, schema_version_, *this);
00092 handler.setOptions(options_);
00093
00094 try
00095 {
00096 parse_(filename, &handler);
00097 }
00098 catch (Exception::BaseException & e)
00099 {
00100 std::string expr;
00101 expr.append(e.getFile());
00102 expr.append("@");
00103 std::stringstream ss;
00104 ss << e.getLine();
00105 expr.append(ss.str());
00106 expr.append("-");
00107 expr.append(e.getFunction());
00108 std::string mess = "- due to that error of type ";
00109 mess.append(e.getName());
00110 throw Exception::ParseError(__FILE__, __LINE__, __PRETTY_FUNCTION__, expr, mess);
00111 }
00112
00113 }
00114
00122 template <typename MapType>
00123 void store(const String & filename, const MapType & map) const
00124 {
00125 Internal::MzMLHandler<MapType> handler(map, filename, schema_version_, *this);
00126 handler.setOptions(options_);
00127 save_(filename, &handler);
00128 }
00129
00135 bool isValid(const String & filename, std::ostream & os = std::cerr);
00136
00146 bool isSemanticallyValid(const String & filename, StringList & errors, StringList & warnings);
00147
00148 private:
00149
00151 PeakFileOptions options_;
00152
00154 String indexed_schema_location_;
00155 };
00156
00157 }
00158
00159 #endif // OPENMS_FOMAT_MZMLFILE_H