Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Attributes | List of all members
MzXMLHandler< MapType > Class Template Reference

XML handlers for MzXMLFile. More...

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

Inheritance diagram for MzXMLHandler< MapType >:
XMLHandler

Public Member Functions

virtual void endElement (const XMLCh *const uri, const XMLCh *const local_name, const XMLCh *const qname)
 Parsing method for closing tags. More...
 
virtual void startElement (const XMLCh *const uri, const XMLCh *const local_name, const XMLCh *const qname, const xercesc::Attributes &attributes)
 Parsing method for opening tags. More...
 
virtual void characters (const XMLCh *const chars, const XMLSize_t length)
 Parsing method for character data. More...
 
void writeTo (std::ostream &os)
 Write the contents to a stream. More...
 
void setOptions (const PeakFileOptions &options)
 Sets the options. 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...
 
virtual ~MzXMLHandler ()
 Destructor. More...
 
- Public Member Functions inherited from XMLHandler
 XMLHandler (const String &filename, const String &version)
 Default constructor. More...
 
virtual ~XMLHandler ()
 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...
 
String errorString ()
 Returns the last error description. More...
 
void fatalError (const xercesc::SAXParseException &exception)
 
void error (const xercesc::SAXParseException &exception)
 
void warning (const xercesc::SAXParseException &exception)
 

Protected Types

typedef MapType::PeakType PeakType
 Peak type. More...
 
typedef MSSpectrum< PeakTypeSpectrumType
 Spectrum type. More...
 
typedef SpectrumType::Iterator PeakIterator
 

Protected Member Functions

void writeUserParam_ (std::ostream &os, const MetaInfoInterface &meta, int indent=4, String tag="nameValue")
 write metaInfo to xml (usually in nameValue-tag) More...
 
- Protected Member Functions inherited from XMLHandler
bool equal_ (const XMLCh *a, const XMLCh *b)
 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 DataTime value. More...
 
char * 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...
 
DoubleReal attributeAsDouble_ (const xercesc::Attributes &a, const char *name) const
 Converts an attribute to a DoubleReal. 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_ (DoubleReal &value, const xercesc::Attributes &a, const char *name) const
 Assigns the attribute content to the DoubleReal 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...
 
char * 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...
 
DoubleReal attributeAsDouble_ (const xercesc::Attributes &a, const XMLCh *name) const
 Converts an attribute to a DoubleReal. 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_ (DoubleReal &value, const xercesc::Attributes &a, const XMLCh *name) const
 Assigns the attribute content to the DoubleReal 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

MapType * exp_
 map pointer for reading More...
 
const MapType * cexp_
 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...
 
const ProgressLoggerlogger_
 Progress logging class. More...
 
std::vector< DataProcessingdata_processing_
 data processing auxilary variable More...
 
temporary data structures to hold parsed data
Base64 decoder_
 
UInt peak_count_
 
String precision_
 
String compressionType_
 
String char_rest_
 
- 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...
 
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

void init_ ()
 
 MzXMLHandler ()
 Not implemented. More...
 
void initStaticMembers_ ()
 

Static Private Attributes

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

Additional Inherited Members

- Public Types inherited from XMLHandler
enum  ActionMode { LOAD, STORE }
 Action to set the current mode (for error messages) More...
 

Detailed Description

template<typename MapType>
class OpenMS::Internal::MzXMLHandler< MapType >

XML handlers for MzXMLFile.

MapType has to be a MSExperiment or have the same interface. Do not use this class. It is only needed in MzXMLFile.

Member Typedef Documentation

typedef MapType::PeakType PeakType
protected

Peak type.

typedef MSSpectrum<PeakType> SpectrumType
protected

Spectrum type.

Constructor & Destructor Documentation

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

Constructor for a read-only handler.

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

Constructor for a write-only handler.

References MzXMLHandler< MapType >::init_().

virtual ~MzXMLHandler ( )
inlinevirtual

Destructor.

MzXMLHandler ( )
private

Not implemented.

Member Function Documentation

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

Parsing method for character data.

Reimplemented from XMLHandler.

References String::trim().

void endElement ( const XMLCh *const  uri,
const XMLCh *const  localname,
const XMLCh *const  qname 
)
virtual

Parsing method for closing tags.

Reimplemented from XMLHandler.

References Base64::BYTEORDER_BIGENDIAN.

void init_ ( )
inlineprivate
void initStaticMembers_ ( )
inlineprivate
void setOptions ( const PeakFileOptions options)
inline

Sets the options.

References MzXMLHandler< MapType >::options_.

Referenced by MzXMLFile::load().

void startElement ( const XMLCh *const  uri,
const XMLCh *const  localname,
const XMLCh *const  qname,
const xercesc::Attributes &  attrs 
)
virtual
void writeTo ( std::ostream &  os)
virtual

Write the contents to a stream.

Reimplemented from XMLHandler.

References Base64::BYTEORDER_BIGENDIAN, DataProcessing::CHARGE_DECONVOLUTION, InstrumentSettings::CRM, DataProcessing::DEISOTOPING, DateTime::get(), Precursor::getCharge(), SourceFile::getChecksum(), SourceFile::getChecksumType(), SpectrumSettings::getComment(), DataProcessing::getCompletionTime(), ContactPerson::getEmail(), SourceFile::getFileType(), ContactPerson::getFirstName(), SpectrumSettings::getInstrumentSettings(), Peak1D::getIntensity(), Instrument::getIonDetectors(), Instrument::getIonSources(), Precursor::getIsolationWindowLowerOffset(), Precursor::getIsolationWindowUpperOffset(), ContactPerson::getLastName(), Instrument::getMassAnalyzers(), MetaInfoInterface::getMetaValue(), Instrument::getModel(), MSSpectrum< PeakT >::getMSLevel(), Peak1D::getMZ(), Software::getName(), SourceFile::getNameOfFile(), SpectrumSettings::getNativeID(), InstrumentSettings::getPolarity(), SpectrumSettings::getPrecursors(), DataProcessing::getProcessingActions(), MSSpectrum< PeakT >::getRT(), InstrumentSettings::getScanMode(), InstrumentSettings::getScanWindows(), DataProcessing::getSoftware(), Instrument::getSoftware(), ContactPerson::getURL(), Instrument::getVendor(), Software::getVersion(), InstrumentSettings::getZoomScan(), String::hasPrefix(), String::hasSubstring(), InstrumentSettings::MASSSPECTRUM, MetaInfoInterface::metaValueExists(), InstrumentSettings::MS1SPECTRUM, InstrumentSettings::MSNSPECTRUM, InstrumentSettings::NamesOfScanMode, IonSource::NEGATIVE, DataProcessing::PEAK_PICKING, IonSource::POSITIVE, SourceFile::SHA1, InstrumentSettings::SIM, InstrumentSettings::SRM, String::substr(), String::toInt(), String::toLower(), DataValue::toString(), and InstrumentSettings::UNKNOWN.

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

write metaInfo to xml (usually in nameValue-tag)

References MetaInfoInterface::getKeys(), and MetaInfoInterface::getMetaValue().

Member Data Documentation

const MapType* cexp_
protected

map pointer for writing

String char_rest_
protected
String compressionType_
protected
std::vector<DataProcessing> data_processing_
protected

data processing auxilary variable

Base64 decoder_
protected
MapType* exp_
protected

map pointer for reading

const ProgressLogger& logger_
protected

Progress logging class.

PeakFileOptions options_
protected

Options for loading and storing.

Referenced by MzXMLHandler< MapType >::setOptions().

UInt peak_count_
protected
String precision_
protected
const XMLCh * s_byteorder_ = 0
staticprivate
const XMLCh * s_centroided_ = 0
staticprivate
const XMLCh * s_chargedeconvoluted_ = 0
staticprivate
const XMLCh * s_completiontime_ = 0
staticprivate
const XMLCh * s_compressionType_ = 0
staticprivate
const XMLCh * s_count_ = 0
staticprivate
const XMLCh * s_deisotoped_ = 0
staticprivate
const XMLCh * s_email_ = 0
staticprivate
const XMLCh * s_endmz_ = 0
staticprivate
const XMLCh * s_filename_ = 0
staticprivate
const XMLCh * s_filesha1_ = 0
staticprivate
const XMLCh * s_filetype_ = 0
staticprivate
const XMLCh * s_first_ = 0
staticprivate
const XMLCh * s_intensitycutoff_ = 0
staticprivate
const XMLCh * s_last_ = 0
staticprivate
const XMLCh * s_mslevel_ = 0
staticprivate
const XMLCh * s_name_ = 0
staticprivate
const XMLCh * s_num_ = 0
staticprivate
const XMLCh * s_pairorder_ = 0
staticprivate
const XMLCh * s_peakscount_ = 0
staticprivate
const XMLCh * s_phone_ = 0
staticprivate
const XMLCh * s_polarity_ = 0
staticprivate
const XMLCh * s_precision_ = 0
staticprivate
const XMLCh * s_precursorcharge_ = 0
staticprivate
const XMLCh * s_precursorintensity_ = 0
staticprivate
const XMLCh * s_retentiontime_ = 0
staticprivate
const XMLCh * s_scantype_ = 0
staticprivate
const XMLCh * s_startmz_ = 0
staticprivate
const XMLCh * s_type_ = 0
staticprivate
const XMLCh * s_uri_ = 0
staticprivate
const XMLCh * s_value_ = 0
staticprivate
const XMLCh * s_version_ = 0
staticprivate
const XMLCh * s_windowwideness_ = 0
staticprivate
bool skip_spectrum_
protected

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

UInt spec_write_counter_
protected

spectrum counter (spectra without peaks are not written)


OpenMS / TOPP release 1.11.1 Documentation generated on Thu Nov 14 2013 11:19:37 using doxygen 1.8.5