libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
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
37
38
42
43
44MassSpectrumId::MassSpectrumId(const MsRunIdCstSPtr &msRunId, std::size_t spectrum_index)
45 : mcsp_msRunId(msRunId), m_nativeId(""), m_spectrumIndex(spectrum_index)
46{
47}
48
49
56
57
61
62
65{
66 if(&other == this)
67 return *this;
68
71 m_nativeId = other.m_nativeId;
72
73 return *this;
74}
75
76
77void
83
84
85const MsRunIdCstSPtr &
90
91
92void
93MassSpectrumId::setNativeId(const QString &native_id)
94{
95 m_nativeId = native_id;
96}
97
98
99const QString &
101{
102 return m_nativeId;
103}
104
105
106void
108{
109 m_spectrumIndex = index;
110}
111
112
113std::size_t
118
119
120bool
122{
123 return (mcsp_msRunId == other.mcsp_msRunId && m_spectrumIndex == other.m_spectrumIndex);
124}
125
126bool
128{
129 return mcsp_msRunId->isValid() && m_spectrumIndex != std::numeric_limits<std::size_t>::max();
130}
131
132
133QString
135{
136 return QString(
137 "ms run id: %1 \n"
138 "native id: %2 \n"
139 "m_spectrumIndex: %3\n")
140 .arg(mcsp_msRunId != nullptr ? mcsp_msRunId->toString() : "nullptr")
141 .arg(m_nativeId)
142 .arg(m_spectrumIndex);
143}
144
145} // namespace pappso
void setNativeId(const QString &native_id)
void setMsRunId(MsRunIdCstSPtr other)
MassSpectrumId & operator=(const MassSpectrumId &other)
std::size_t getSpectrumIndex() const
void setSpectrumIndex(std::size_t index)
const QString & getNativeId() const
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