libpappsomspp
Library for mass spectrometry
massspectrumid.cpp
Go to the documentation of this file.
1/*******************************************************************************
2 * Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
3 *
4 * This file is part of the PAPPSOms++ library.
5 *
6 * PAPPSOms++ is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * PAPPSOms++ is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * Contributors:
20 * Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
21 *implementation
22 ******************************************************************************/
23
24
25#include <limits>
26
27
28#include "massspectrumid.h"
29
30namespace pappso
31{
32
33
35{
36}
37
38
40 : mcsp_msRunId(msRunId)
41{
42}
43
44
46 std::size_t spectrum_index)
47 : mcsp_msRunId(msRunId), m_nativeId(""), m_spectrumIndex(spectrum_index)
48{
49}
50
51
53 : mcsp_msRunId(other.mcsp_msRunId),
54 m_nativeId(other.m_nativeId),
55 m_spectrumIndex(other.m_spectrumIndex)
56{
57}
58
59
61{
62}
63
64
67{
70 m_nativeId = other.m_nativeId;
71
72 return *this;
73}
74
75
76void
78{
79
80 mcsp_msRunId = other;
81};
82
83
84const MsRunIdCstSPtr &
86{
87 return mcsp_msRunId;
88};
89
90
91void
92MassSpectrumId::setNativeId(const QString &native_id)
93{
94 m_nativeId = native_id;
95}
96
97
98const QString &
100{
101 return m_nativeId;
102}
103
104
105void
107{
108 m_spectrumIndex = index;
109}
110
111
112std::size_t
114{
115 return m_spectrumIndex;
116}
117
118
119bool
121{
122 return (mcsp_msRunId == other.mcsp_msRunId &&
124}
125
126bool
128{
129 return mcsp_msRunId->isValid() &&
130 m_spectrumIndex != std::numeric_limits<std::size_t>::max();
131}
132
133
134QString
136{
137 return QString(
138 "ms run id: %1 \n"
139 "native id: %2 \n"
140 "m_spectrumIndex: %3\n")
141 .arg(mcsp_msRunId != nullptr ? mcsp_msRunId->toString() : "nullptr")
142 .arg(m_nativeId)
143 .arg(m_spectrumIndex);
144}
145
146} // namespace pappso
void setNativeId(const QString &native_id)
void setMsRunId(MsRunIdCstSPtr other)
MassSpectrumId & operator=(const MassSpectrumId &other)
QString toString() const
std::size_t getSpectrumIndex() const
void setSpectrumIndex(std::size_t index)
const QString & getNativeId() const
std::size_t m_spectrumIndex
bool operator==(const MassSpectrumId &other) const
MsRunIdCstSPtr mcsp_msRunId
const MsRunIdCstSPtr & getMsRunIdCstSPtr() const
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
std::shared_ptr< const MsRunId > MsRunIdCstSPtr
Definition: msrunid.h:46