~ubuntu-branches/ubuntu/wily/openms/wily

« back to all changes in this revision

Viewing changes to include/OpenMS/CHEMISTRY/MASSDECOMPOSITION/IMS/MassDecomposer.h

  • Committer: Package Import Robot
  • Author(s): Filippo Rusconi
  • Date: 2012-11-12 15:58:12 UTC
  • Revision ID: package-import@ubuntu.com-20121112155812-vr15wtg9b50cuesg
Tags: upstream-1.9.0
ImportĀ upstreamĀ versionĀ 1.9.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- mode: C++; tab-width: 2; -*-
 
2
// vi: set ts=2:
 
3
//
 
4
// --------------------------------------------------------------------------
 
5
//                   OpenMS Mass Spectrometry Framework
 
6
// --------------------------------------------------------------------------
 
7
//  Copyright (C) 2003-2011 -- Oliver Kohlbacher, Knut Reinert
 
8
//
 
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.
 
13
//
 
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.
 
18
//
 
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
 
22
//
 
23
// --------------------------------------------------------------------------
 
24
// $Maintainer: Stephan Aiche $
 
25
// $Authors: Anton Pervukhin <Anton.Pervukhin@CeBiTec.Uni-Bielefeld.DE> $
 
26
// --------------------------------------------------------------------------
 
27
//
 
28
 
 
29
#ifndef OPENMS_CHEMISTRY_MASSDECOMPOSITION_IMS_MASSDECOMPOSER_H
 
30
#define OPENMS_CHEMISTRY_MASSDECOMPOSITION_IMS_MASSDECOMPOSER_H
 
31
 
 
32
#include <vector>
 
33
 
 
34
namespace OpenMS {
 
35
 
 
36
  namespace ims {
 
37
    /**
 
38
      @brief An inteface to handle decomposing of integer values/masses
 
39
      over a set of integer weights (alphabet).
 
40
 
 
41
      An interface that addresses the following "mass decomposition" problems:
 
42
 
 
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
 
47
       decompositions).
 
48
 
 
49
      Those problems are solved in integer arithmetics, i.e. only exact
 
50
      solutions are found with no error allowed.
 
51
 
 
52
      @param ValueType Type of values to be decomposed.
 
53
      @param DecompositionValueType Type of decomposition elements.
 
54
 
 
55
      @author Anton Pervukhin <Anton.Pervukhin@CeBiTec.Uni-Bielefeld.DE>
 
56
    */
 
57
    template <typename ValueType,
 
58
              typename DecompositionValueType>
 
59
    class MassDecomposer {
 
60
    public:
 
61
      /**
 
62
        Type of value to be decomposed.
 
63
      */
 
64
      typedef ValueType value_type;
 
65
 
 
66
      /**
 
67
        Type of decomposition value.
 
68
      */
 
69
      typedef DecompositionValueType decomposition_value_type;
 
70
 
 
71
      /**
 
72
        Type of decomposition container.
 
73
      */
 
74
      typedef std::vector<decomposition_value_type> decomposition_type;
 
75
 
 
76
      /**
 
77
        Type of container for many decompositions.
 
78
      */
 
79
      typedef std::vector<decomposition_type> decompositions_type;
 
80
 
 
81
      /**
 
82
        A virtual destructor.
 
83
      */
 
84
      virtual ~MassDecomposer(){}
 
85
 
 
86
      /**
 
87
        Returns true if the decomposition for the given @c mass exists, otherwise - false.
 
88
 
 
89
        @param mass Mass to be checked on decomposing.
 
90
        @return true, if the decomposition for @c mass exist, otherwise - false.
 
91
      */
 
92
      virtual bool exist(value_type mass) = 0;
 
93
 
 
94
      /**
 
95
        Returns one possible decomposition of the given @c mass.
 
96
 
 
97
        @param mass Mass to be decomposed.
 
98
        @return The decomposition of the @c mass, if one exists, otherwise - an empty container.
 
99
      */
 
100
      virtual decomposition_type getDecomposition(value_type mass) = 0;
 
101
 
 
102
      /**
 
103
        Returns all possible decompositions for the given @c mass.
 
104
 
 
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.
 
108
      */
 
109
      virtual decompositions_type getAllDecompositions(value_type mass) = 0;
 
110
 
 
111
      /**
 
112
        Returns the number of possible decompositions for the given @c mass.
 
113
        *
 
114
        @param mass Mass to be decomposed.
 
115
        @return The number of possible decompositions for the @c mass.
 
116
      */
 
117
      virtual decomposition_value_type getNumberOfDecompositions(value_type mass) = 0;
 
118
 
 
119
    };
 
120
 
 
121
  } // namespace ims
 
122
} // namespace OpenMS
 
123
 
 
124
#endif //OPENMS_CHEMISTRY_MASSDECOMPOSITION_IMS_MASSDECOMPOSER_H