OpenMS  2.4.0
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Attributes | List of all members
MzXMLHandler Class Reference

#include <OpenMS/FORMAT/HANDLERS/MzXMLHandler.h>

Inheritance diagram for MzXMLHandler:
XMLHandler

Classes

struct  SpectrumData
 Data necessary to generate a single spectrum. More...
 

Public Member Functions

virtual LOADDETAIL getLoadDetail () const override
 handler which support partial loading, implement this method More...
 
virtual void setLoadDetail (const LOADDETAIL d) override
 handler which support partial loading, implement this method More...
 
void endElement (const XMLCh *const uri, const XMLCh *const local_name, const XMLCh *const qname) override
 
void startElement (const XMLCh *const uri, const XMLCh *const local_name, const XMLCh *const qname, const xercesc::Attributes &attributes) override
 
void characters (const XMLCh *const chars, const XMLSize_t length) override
 
void writeTo (std::ostream &os) override
 Write the contents to a stream. More...
 
void setOptions (const PeakFileOptions &options)
 Sets the options. More...
 
UInt getScanCount ()
 Gets the scan count. More...
 
void setMSDataConsumer (Interfaces::IMSDataConsumer *consumer)
 Set the IMSDataConsumer consumer which will consume the read data. More...
 
Constructors and destructor
 MzXMLHandler (MapType &exp, const String &filename, const String &version, ProgressLogger &logger)
 Constructor for a read-only handler. More...
 
 MzXMLHandler (const MapType &exp, const String &filename, const String &version, const ProgressLogger &logger)
 Constructor for a write-only handler. More...
 
 ~MzXMLHandler () override
 Destructor. More...
 
- Public Member Functions inherited from XMLHandler
 XMLHandler (const String &filename, const String &version)
 Default constructor. More...
 
 ~XMLHandler () override
 Destructor. More...
 
void reset ()
 Release internal memory used for parsing (call. More...
 
void fatalError (ActionMode mode, const String &msg, UInt line=0, UInt column=0) const
 Fatal error handler. Throws a ParseError exception. More...
 
void error (ActionMode mode, const String &msg, UInt line=0, UInt column=0) const
 Error handler for recoverable errors. More...
 
void warning (ActionMode mode, const String &msg, UInt line=0, UInt column=0) const
 Warning handler. More...
 
void characters (const XMLCh *const chars, const XMLSize_t length) override
 Parsing method for character data. More...
 
void startElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const xercesc::Attributes &attrs) override
 Parsing method for opening tags. More...
 
void endElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname) override
 Parsing method for closing tags. More...
 
String errorString ()
 Returns the last error description. More...
 
void fatalError (const xercesc::SAXParseException &exception) override
 
void error (const xercesc::SAXParseException &exception) override
 
void warning (const xercesc::SAXParseException &exception) override
 

Protected Types

typedef MapType::PeakType PeakType
 Peak type. More...
 
typedef MSSpectrum SpectrumType
 Spectrum type. More...
 

Protected Member Functions

std::ostream & writeAttributeIfExists_ (std::ostream &os, const MetaInfoInterface &meta, const String &metakey, const String &attname)
 write metaInfo to xml (usually in nameValue-tag) More...
 
void writeUserParam_ (std::ostream &os, const MetaInfoInterface &meta, int indent=4, String tag="nameValue")
 write metaInfo to xml (usually in nameValue-tag) More...
 
void doPopulateSpectraWithData_ (SpectrumData &spectrum_data)
 Fill a single spectrum with data from input. More...
 
void populateSpectraWithData_ ()
 Populate all spectra on the stack with data from input. More...
 
- Protected Member Functions inherited from XMLHandler
bool equal_ (const XMLCh *a, const XMLCh *b) const
 Returns if two Xerces strings are equal. More...
 
void writeUserParam_ (const String &tag_name, std::ostream &os, const MetaInfoInterface &meta, UInt indent) const
 Writes the content of MetaInfoInterface to the file. More...
 
Int asInt_ (const String &in)
 Conversion of a String to an integer value. More...
 
Int asInt_ (const XMLCh *in)
 Conversion of a Xerces string to an integer value. More...
 
UInt asUInt_ (const String &in)
 Conversion of a String to an unsigned integer value. More...
 
double asDouble_ (const String &in)
 Conversion of a String to a double value. More...
 
float asFloat_ (const String &in)
 Conversion of a String to a float value. More...
 
bool asBool_ (const String &in)
 Conversion of a string to a boolean value. More...
 
DateTime asDateTime_ (String date_string)
 Conversion of a xs:datetime string to a DateTime value. More...
 
String attributeAsString_ (const xercesc::Attributes &a, const char *name) const
 Converts an attribute to a String. More...
 
Int attributeAsInt_ (const xercesc::Attributes &a, const char *name) const
 Converts an attribute to a Int. More...
 
double attributeAsDouble_ (const xercesc::Attributes &a, const char *name) const
 Converts an attribute to a double. More...
 
DoubleList attributeAsDoubleList_ (const xercesc::Attributes &a, const char *name) const
 Converts an attribute to a DoubleList. More...
 
IntList attributeAsIntList_ (const xercesc::Attributes &a, const char *name) const
 Converts an attribute to an IntList. More...
 
StringList attributeAsStringList_ (const xercesc::Attributes &a, const char *name) const
 Converts an attribute to an StringList. More...
 
bool optionalAttributeAsString_ (String &value, const xercesc::Attributes &a, const char *name) const
 Assigns the attribute content to the String value if the attribute is present. More...
 
bool optionalAttributeAsInt_ (Int &value, const xercesc::Attributes &a, const char *name) const
 Assigns the attribute content to the Int value if the attribute is present. More...
 
bool optionalAttributeAsUInt_ (UInt &value, const xercesc::Attributes &a, const char *name) const
 Assigns the attribute content to the UInt value if the attribute is present. More...
 
bool optionalAttributeAsDouble_ (double &value, const xercesc::Attributes &a, const char *name) const
 Assigns the attribute content to the double value if the attribute is present. More...
 
bool optionalAttributeAsDoubleList_ (DoubleList &value, const xercesc::Attributes &a, const char *name) const
 Assigns the attribute content to the DoubleList value if the attribute is present. More...
 
bool optionalAttributeAsStringList_ (StringList &value, const xercesc::Attributes &a, const char *name) const
 Assigns the attribute content to the StringList value if the attribute is present. More...
 
bool optionalAttributeAsIntList_ (IntList &value, const xercesc::Attributes &a, const char *name) const
 Assigns the attribute content to the IntList value if the attribute is present. More...
 
String attributeAsString_ (const xercesc::Attributes &a, const XMLCh *name) const
 Converts an attribute to a String. More...
 
Int attributeAsInt_ (const xercesc::Attributes &a, const XMLCh *name) const
 Converts an attribute to a Int. More...
 
double attributeAsDouble_ (const xercesc::Attributes &a, const XMLCh *name) const
 Converts an attribute to a double. More...
 
DoubleList attributeAsDoubleList_ (const xercesc::Attributes &a, const XMLCh *name) const
 Converts an attribute to a DoubleList. More...
 
IntList attributeAsIntList_ (const xercesc::Attributes &a, const XMLCh *name) const
 Converts an attribute to a IntList. More...
 
StringList attributeAsStringList_ (const xercesc::Attributes &a, const XMLCh *name) const
 Converts an attribute to a StringList. More...
 
bool optionalAttributeAsString_ (String &value, const xercesc::Attributes &a, const XMLCh *name) const
 Assigns the attribute content to the String value if the attribute is present. More...
 
bool optionalAttributeAsInt_ (Int &value, const xercesc::Attributes &a, const XMLCh *name) const
 Assigns the attribute content to the Int value if the attribute is present. More...
 
bool optionalAttributeAsUInt_ (UInt &value, const xercesc::Attributes &a, const XMLCh *name) const
 Assigns the attribute content to the UInt value if the attribute is present. More...
 
bool optionalAttributeAsDouble_ (double &value, const xercesc::Attributes &a, const XMLCh *name) const
 Assigns the attribute content to the double value if the attribute is present. More...
 
bool optionalAttributeAsDoubleList_ (DoubleList &value, const xercesc::Attributes &a, const XMLCh *name) const
 Assigns the attribute content to the DoubleList value if the attribute is present. More...
 
bool optionalAttributeAsIntList_ (IntList &value, const xercesc::Attributes &a, const XMLCh *name) const
 Assigns the attribute content to the IntList value if the attribute is present. More...
 
bool optionalAttributeAsStringList_ (StringList &value, const xercesc::Attributes &a, const XMLCh *name) const
 Assigns the attribute content to the StringList value if the attribute is present. More...
 
SignedSize cvStringToEnum_ (const Size section, const String &term, const char *message, const SignedSize result_on_error=0)
 

Protected Attributes

MapTypeexp_
 map pointer for reading More...
 
const MapTypecexp_
 map pointer for writing More...
 
PeakFileOptions options_
 Options for loading and storing. More...
 
bool skip_spectrum_
 Flag that indicates whether this spectrum should be skipped (due to options) More...
 
UInt spec_write_counter_
 spectrum counter (spectra without peaks are not written) More...
 
Interfaces::IMSDataConsumerconsumer_
 Consumer class to work on spectra. More...
 
UInt scan_count_
 Consumer class to work on spectra. More...
 
const ProgressLoggerlogger_
 Progress logging class. More...
 
std::vector< boost::shared_ptr< DataProcessing > > data_processing_
 data processing auxiliary variable More...
 
temporary data structures to hold parsed data
Int nesting_level_
 
std::vector< SpectrumDataspectrum_data_
 Vector of spectrum data stored for later parallel processing. More...
 
- Protected Attributes inherited from XMLHandler
String error_message_
 Error message of the last error. More...
 
String file_
 File name. More...
 
String version_
 Schema version. More...
 
StringManager sm_
 Helper class for string conversion. More...
 
std::vector< Stringopen_tags_
 Stack of open XML tags. More...
 
LOADDETAIL load_detail_
 parse only until total number of scans and chroms have been determined from attributes More...
 
std::vector< std::vector< String > > cv_terms_
 Array of CV term lists (one sublist denotes one term and it's children) More...
 

Private Member Functions

 MzXMLHandler ()
 Not implemented. More...
 
void init_ ()
 initialize members (call from C'tor) More...
 
void initStaticMembers_ ()
 

Static Private Attributes

static const XMLCh * s_value_
 
static const XMLCh * s_count_
 
static const XMLCh * s_type_
 
static const XMLCh * s_name_
 
static const XMLCh * s_version_
 
static const XMLCh * s_filename_
 
static const XMLCh * s_filetype_
 
static const XMLCh * s_filesha1_
 
static const XMLCh * s_completiontime_
 
static const XMLCh * s_precision_
 
static const XMLCh * s_byteorder_
 
static const XMLCh * s_contentType_
 
static const XMLCh * s_compressionType_
 
static const XMLCh * s_precursorintensity_
 
static const XMLCh * s_precursorcharge_
 
static const XMLCh * s_windowwideness_
 
static const XMLCh * s_mslevel_
 
static const XMLCh * s_peakscount_
 
static const XMLCh * s_polarity_
 
static const XMLCh * s_scantype_
 
static const XMLCh * s_filterline_
 
static const XMLCh * s_retentiontime_
 
static const XMLCh * s_startmz_
 
static const XMLCh * s_endmz_
 
static const XMLCh * s_first_
 
static const XMLCh * s_last_
 
static const XMLCh * s_phone_
 
static const XMLCh * s_email_
 
static const XMLCh * s_uri_
 
static const XMLCh * s_num_
 
static const XMLCh * s_intensitycutoff_
 
static const XMLCh * s_centroided_
 
static const XMLCh * s_deisotoped_
 
static const XMLCh * s_chargedeconvoluted_
 

Additional Inherited Members

- Public Types inherited from XMLHandler
enum  ActionMode { LOAD, STORE }
 Action to set the current mode (for error messages) More...
 
enum  LOADDETAIL { LD_ALLDATA, LD_RAWCOUNTS, LD_COUNTS_WITHOPTIONS }
 
- Static Public Member Functions inherited from XMLHandler
static String writeXMLEscape (const String &to_escape)
 Escapes a string and returns the escaped string. More...
 

Member Typedef Documentation

◆ PeakType

typedef MapType::PeakType PeakType
protected

Peak type.

◆ SpectrumType

typedef MSSpectrum SpectrumType
protected

Spectrum type.

Constructor & Destructor Documentation

◆ MzXMLHandler() [1/3]

MzXMLHandler ( MapType exp,
const String filename,
const String version,
ProgressLogger logger 
)

Constructor for a read-only handler.

◆ MzXMLHandler() [2/3]

MzXMLHandler ( const MapType exp,
const String filename,
const String version,
const ProgressLogger logger 
)

Constructor for a write-only handler.

◆ ~MzXMLHandler()

~MzXMLHandler ( )
inlineoverride

Destructor.

◆ MzXMLHandler() [3/3]

MzXMLHandler ( )
private

Not implemented.

Member Function Documentation

◆ characters()

void characters ( const XMLCh *const  chars,
const XMLSize_t  length 
)
override

◆ doPopulateSpectraWithData_()

void doPopulateSpectraWithData_ ( SpectrumData spectrum_data)
protected

Fill a single spectrum with data from input.

Note
Do not modify any internal state variables of the class since this function will be executed in parallel.

◆ endElement()

void endElement ( const XMLCh *const  uri,
const XMLCh *const  local_name,
const XMLCh *const  qname 
)
override

◆ getLoadDetail()

virtual LOADDETAIL getLoadDetail ( ) const
overridevirtual

handler which support partial loading, implement this method

Reimplemented from XMLHandler.

◆ getScanCount()

UInt getScanCount ( )
inline

Gets the scan count.

◆ init_()

void init_ ( )
private

initialize members (call from C'tor)

◆ initStaticMembers_()

void initStaticMembers_ ( )
private

◆ populateSpectraWithData_()

void populateSpectraWithData_ ( )
protected

Populate all spectra on the stack with data from input.

Will populate all spectra on the current work stack with data (using multiple threads if available) and append them to the result.

◆ setLoadDetail()

virtual void setLoadDetail ( const LOADDETAIL  d)
overridevirtual

handler which support partial loading, implement this method

Reimplemented from XMLHandler.

◆ setMSDataConsumer()

void setMSDataConsumer ( Interfaces::IMSDataConsumer consumer)
inline

Set the IMSDataConsumer consumer which will consume the read data.

◆ setOptions()

void setOptions ( const PeakFileOptions options)
inline

Sets the options.

◆ startElement()

void startElement ( const XMLCh *const  uri,
const XMLCh *const  local_name,
const XMLCh *const  qname,
const xercesc::Attributes &  attributes 
)
override

◆ writeAttributeIfExists_()

std::ostream& writeAttributeIfExists_ ( std::ostream &  os,
const MetaInfoInterface meta,
const String metakey,
const String attname 
)
inlineprotected

write metaInfo to xml (usually in nameValue-tag)

◆ writeTo()

void writeTo ( std::ostream &  os)
overridevirtual

Write the contents to a stream.

Reimplemented from XMLHandler.

◆ writeUserParam_()

void writeUserParam_ ( std::ostream &  os,
const MetaInfoInterface meta,
int  indent = 4,
String  tag = "nameValue" 
)
inlineprotected

write metaInfo to xml (usually in nameValue-tag)

Member Data Documentation

◆ cexp_

const MapType* cexp_
protected

map pointer for writing

◆ consumer_

Interfaces::IMSDataConsumer* consumer_
protected

Consumer class to work on spectra.

◆ data_processing_

std::vector< boost::shared_ptr< DataProcessing> > data_processing_
protected

data processing auxiliary variable

◆ exp_

MapType* exp_
protected

map pointer for reading

◆ logger_

const ProgressLogger& logger_
protected

Progress logging class.

◆ nesting_level_

Int nesting_level_
protected

◆ options_

PeakFileOptions options_
protected

Options for loading and storing.

◆ s_byteorder_

const XMLCh* s_byteorder_
staticprivate

◆ s_centroided_

const XMLCh* s_centroided_
staticprivate

◆ s_chargedeconvoluted_

const XMLCh* s_chargedeconvoluted_
staticprivate

◆ s_completiontime_

const XMLCh* s_completiontime_
staticprivate

◆ s_compressionType_

const XMLCh* s_compressionType_
staticprivate

◆ s_contentType_

const XMLCh* s_contentType_
staticprivate

◆ s_count_

const XMLCh* s_count_
staticprivate

◆ s_deisotoped_

const XMLCh* s_deisotoped_
staticprivate

◆ s_email_

const XMLCh* s_email_
staticprivate

◆ s_endmz_

const XMLCh* s_endmz_
staticprivate

◆ s_filename_

const XMLCh* s_filename_
staticprivate

◆ s_filesha1_

const XMLCh* s_filesha1_
staticprivate

◆ s_filetype_

const XMLCh* s_filetype_
staticprivate

◆ s_filterline_

const XMLCh* s_filterline_
staticprivate

◆ s_first_

const XMLCh* s_first_
staticprivate

◆ s_intensitycutoff_

const XMLCh* s_intensitycutoff_
staticprivate

◆ s_last_

const XMLCh* s_last_
staticprivate

◆ s_mslevel_

const XMLCh* s_mslevel_
staticprivate

◆ s_name_

const XMLCh* s_name_
staticprivate

◆ s_num_

const XMLCh* s_num_
staticprivate

◆ s_peakscount_

const XMLCh* s_peakscount_
staticprivate

◆ s_phone_

const XMLCh* s_phone_
staticprivate

◆ s_polarity_

const XMLCh* s_polarity_
staticprivate

◆ s_precision_

const XMLCh* s_precision_
staticprivate

◆ s_precursorcharge_

const XMLCh* s_precursorcharge_
staticprivate

◆ s_precursorintensity_

const XMLCh* s_precursorintensity_
staticprivate

◆ s_retentiontime_

const XMLCh* s_retentiontime_
staticprivate

◆ s_scantype_

const XMLCh* s_scantype_
staticprivate

◆ s_startmz_

const XMLCh* s_startmz_
staticprivate

◆ s_type_

const XMLCh* s_type_
staticprivate

◆ s_uri_

const XMLCh* s_uri_
staticprivate

◆ s_value_

const XMLCh* s_value_
staticprivate

◆ s_version_

const XMLCh* s_version_
staticprivate

◆ s_windowwideness_

const XMLCh* s_windowwideness_
staticprivate

◆ scan_count_

UInt scan_count_
protected

Consumer class to work on spectra.

◆ skip_spectrum_

bool skip_spectrum_
protected

Flag that indicates whether this spectrum should be skipped (due to options)

◆ spec_write_counter_

UInt spec_write_counter_
protected

spectrum counter (spectra without peaks are not written)

◆ spectrum_data_

std::vector< SpectrumData > spectrum_data_
protected

Vector of spectrum data stored for later parallel processing.