Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

FeaturePairsHandler.h (Maintainer: Eva Lange)

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // --------------------------------------------------------------------------
00005 //                   OpenMS Mass Spectrometry Framework
00006 // --------------------------------------------------------------------------
00007 //  Copyright (C) 2003-2008 -- Oliver Kohlbacher, Knut Reinert
00008 //
00009 //  This library is free software; you can redistribute it and/or
00010 //  modify it under the terms of the GNU Lesser General Public
00011 //  License as published by the Free Software Foundation; either
00012 //  version 2.1 of the License, or (at your option) any later version.
00013 //
00014 //  This library is distributed in the hope that it will be useful,
00015 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 //  Lesser General Public License for more details.
00018 //
00019 //  You should have received a copy of the GNU Lesser General Public
00020 //  License along with this library; if not, write to the Free Software
00021 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //
00023 // --------------------------------------------------------------------------
00024 // $Maintainer: Eva Lange $
00025 // --------------------------------------------------------------------------
00026 
00027 #ifndef OPENMS_FORMAT_HANDLERS_FEATUREPAIRSHANDLER_H
00028 #define OPENMS_FORMAT_HANDLERS_FEATUREPAIRSHANDLER_H
00029 
00030 #include <OpenMS/KERNEL/Feature.h>
00031 #include <OpenMS/DATASTRUCTURES/DPosition.h>
00032 #include <OpenMS/FORMAT/UniqueIdGenerator.h>
00033 #include <OpenMS/FORMAT/HANDLERS/XMLHandler.h>
00034 #include <OpenMS/DATASTRUCTURES/Param.h>
00035 #include <OpenMS/DATASTRUCTURES/String.h>
00036 #include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/ModelDescription.h>
00037 
00038 #include <OpenMS/ANALYSIS/MAPMATCHING/ElementPair.h>
00039 
00040 // STL includes
00041 #include <iostream>
00042 #include <valarray>
00043 #include <string>
00044 
00045 #include <xercesc/sax2/Attributes.hpp>
00046 
00047 namespace OpenMS
00048 {
00049   namespace Internal
00050   {
00051 
00054   class FeaturePairsHandler
00055     : public XMLHandler
00056   {
00057     public:
00060 
00061       FeaturePairsHandler(std::vector< ElementPair < Feature > > & map, const String& filename, const String& version)
00062       : XMLHandler(filename,version),
00063         pairs_(&map), 
00064         cpairs_(0),
00065         id_generator_(UniqueIdGenerator::instance())
00066       {
00067       }
00068 
00070       FeaturePairsHandler(const std::vector< ElementPair < Feature > > & map, const String& filename, const String& version)
00071       : XMLHandler(filename,version),
00072         pairs_(0), 
00073         cpairs_(&map),
00074         id_generator_(UniqueIdGenerator::instance())
00075       {
00076       }
00078       virtual ~FeaturePairsHandler()
00079       {
00080       }
00082 
00083       // Docu in base class
00084       virtual void endElement(const XMLCh* const /*uri*/, const XMLCh* const /*local_name*/, const XMLCh* const qname);
00085 
00086       // Docu in base class
00087       virtual void startElement(const XMLCh* const /*uri*/, const XMLCh* const /*local_name*/, const XMLCh* const qname, const xercesc::Attributes& attributes);
00088 
00089       // Docu in base class
00090       virtual void characters(const XMLCh* const chars, unsigned int length);
00091 
00093       void writeTo(std::ostream& os);
00094 
00095     protected:
00096 
00098       std::vector< ElementPair < Feature > > * pairs_;
00100       const std::vector< ElementPair < Feature > > * cpairs_;
00102       UniqueIdGenerator id_generator_;
00104       UInt dim_;
00105   
00106       // temporary datastructures to hold parsed data
00107       ElementPair < Feature > pair_;
00108       Feature feature_;
00109       ModelDescription<2>* model_desc_;
00110       Param param_;
00111       ConvexHull2D current_chull_;
00112       Feature::PositionType hull_position_;
00113   
00114       void writeFeature_(std::ostream& os, Feature dfeat);
00115 
00116   }; // end of class FeaturePairsHandler
00117 
00118   //--------------------------------------------------------------------------------
00119 
00120   } // namespace Internal
00121 } // namespace OpenMS
00122 
00123 #endif

Generated Tue Apr 1 15:36:34 2008 -- using doxygen 1.5.4 OpenMS / TOPP 1.1