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

ElementPair.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 
00028 #ifndef OPENMS_ANALYSIS_MAPMATCHING_ELEMENTPAIR_H
00029 #define OPENMS_ANALYSIS_MAPMATCHING_ELEMENTPAIR_H
00030 
00031 #include<OpenMS/KERNEL/Feature.h>
00032 // #include <OpenMS/CONCEPT/Types.h>
00033 
00034 #include <utility> // std::pair
00035 
00036 namespace OpenMS
00037 {
00038 
00047 template < typename ElementType = Feature >
00048 class ElementPair : public std::pair<ElementType,ElementType>
00049 {
00050 public:
00051     typedef std::pair<ElementType,ElementType> Base;
00052     typedef DoubleReal QualityType;
00053 
00057 
00058     ElementPair() : Base(), quality_(0)
00059     {}
00060 
00062     ElementPair(const ElementPair& fp)
00063             : Base(fp), quality_(fp.quality_)
00064     {}
00065 
00066     ElementPair(ElementType const & first, ElementType const & second, QualityType const & quality = QualityType(0))
00067             : Base(first,second), quality_(quality)
00068     {}
00069 
00071     virtual ~ElementPair()
00072     {}
00074 
00076     ElementPair& operator = (const ElementPair& rhs)
00077     {
00078         if (&rhs==this)
00079             return *this;
00080 
00081         Base::operator = (rhs);
00082         quality_       = rhs.quality_;
00083 
00084         return *this;
00085     }
00086 
00087     bool operator == (const ElementPair& rhs) const
00088     {
00089         return ( this->getFirst()   == rhs.getFirst() &&
00090                  this->getSecond()  == rhs.getSecond() &&
00091                  this->getQuality() == rhs.getQuality() );
00092     }
00093 
00094     bool operator != (const ElementPair& rhs) const
00095     {
00096         return  !(*this == rhs);
00097     }
00098 
00102 
00103     const ElementType& getFirst() const
00104     {
00105         return this->first;
00106     }
00108     ElementType& getFirst()
00109     {
00110         return this->first;
00111     }
00113     void setFirst(const ElementType& frt)
00114     {
00115         this->first = frt;
00116     }
00117 
00119     const ElementType& getSecond() const
00120     {
00121         return this->second;
00122     }
00124     ElementType& getSecond()
00125     {
00126         return this->second;
00127     }
00129     void setSecond(const ElementType& sec)
00130     {
00131         this->second = sec;
00132     }
00133 
00135     QualityType getQuality() const
00136     {
00137         return quality_;
00138     }
00140     QualityType& getQuality()
00141     {
00142         return quality_;
00143     }
00145     void setQuality(QualityType ql)
00146     {
00147         quality_ = ql;
00148     }
00150 
00151 protected:
00152 
00154     QualityType quality_;
00155 
00156 }
00157 ; // end of class ElementPair
00158 
00159 } // end of namespace OpenMS
00160 
00161 #endif  // OPENMS_ANALYSIS_MAPMATCHER_ELEMENTPAIR_H

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