1
// -*- mode: C++; tab-width: 2; -*-
4
// --------------------------------------------------------------------------
5
// OpenMS Mass Spectrometry Framework
6
// --------------------------------------------------------------------------
7
// Copyright (C) 2003-2011 -- Oliver Kohlbacher, Knut Reinert
9
// This library is free software; you can redistribute it and/or
10
// modify it under the terms of the GNU Lesser General Public
11
// License as published by the Free Software Foundation; either
12
// version 2.1 of the License, or (at your option) any later version.
14
// This library is distributed in the hope that it will be useful,
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
// Lesser General Public License for more details.
19
// You should have received a copy of the GNU Lesser General Public
20
// License along with this library; if not, write to the Free Software
21
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
// --------------------------------------------------------------------------
24
// $Maintainer: Stephan Aiche $
25
// $Authors: Anton Pervukhin <Anton.Pervukhin@CeBiTec.Uni-Bielefeld.DE> $
26
// --------------------------------------------------------------------------
29
#ifndef OPENMS_CHEMISTRY_MASSDECOMPOSITION_IMS_MASSDECOMPOSER_H
30
#define OPENMS_CHEMISTRY_MASSDECOMPOSITION_IMS_MASSDECOMPOSER_H
38
@brief An inteface to handle decomposing of integer values/masses
39
over a set of integer weights (alphabet).
41
An interface that addresses the following "mass decomposition" problems:
43
- Existence Problem (whether the decomposition of the given mass exists),
44
- One Decomposition Problem (returns one possible decomposition),
45
- All Decompositions Problem (returns all possible decompositions),
46
- Number of Decompositions Problem (returns the number of possible
49
Those problems are solved in integer arithmetics, i.e. only exact
50
solutions are found with no error allowed.
52
@param ValueType Type of values to be decomposed.
53
@param DecompositionValueType Type of decomposition elements.
55
@author Anton Pervukhin <Anton.Pervukhin@CeBiTec.Uni-Bielefeld.DE>
57
template <typename ValueType,
58
typename DecompositionValueType>
59
class MassDecomposer {
62
Type of value to be decomposed.
64
typedef ValueType value_type;
67
Type of decomposition value.
69
typedef DecompositionValueType decomposition_value_type;
72
Type of decomposition container.
74
typedef std::vector<decomposition_value_type> decomposition_type;
77
Type of container for many decompositions.
79
typedef std::vector<decomposition_type> decompositions_type;
84
virtual ~MassDecomposer(){}
87
Returns true if the decomposition for the given @c mass exists, otherwise - false.
89
@param mass Mass to be checked on decomposing.
90
@return true, if the decomposition for @c mass exist, otherwise - false.
92
virtual bool exist(value_type mass) = 0;
95
Returns one possible decomposition of the given @c mass.
97
@param mass Mass to be decomposed.
98
@return The decomposition of the @c mass, if one exists, otherwise - an empty container.
100
virtual decomposition_type getDecomposition(value_type mass) = 0;
103
Returns all possible decompositions for the given @c mass.
105
@param mass Mass to be decomposed.
106
@return All possible decompositions of the @c mass, if there are any exist,
107
otherwise - an empty container.
109
virtual decompositions_type getAllDecompositions(value_type mass) = 0;
112
Returns the number of possible decompositions for the given @c mass.
114
@param mass Mass to be decomposed.
115
@return The number of possible decompositions for the @c mass.
117
virtual decomposition_value_type getNumberOfDecompositions(value_type mass) = 0;
122
} // namespace OpenMS
124
#endif //OPENMS_CHEMISTRY_MASSDECOMPOSITION_IMS_MASSDECOMPOSER_H