GCC Code Coverage Report


source/XpertMassCore/src/
File: source/XpertMassCore/src/OligomerPair.cpp
Date: 2025-11-19 15:26:11
Lines:
0/62
0.0%
Functions:
0/17
0.0%
Branches:
0/36
0.0%

Line Branch Exec Source
1 /* BEGIN software license
2 *
3 * msXpertSuite - mass spectrometry software suite
4 * -----------------------------------------------
5 * Copyright(C) 2009,...,2018 Filippo Rusconi
6 *
7 * http://www.msxpertsuite.org
8 *
9 * This file is part of the msXpertSuite project.
10 *
11 * The msXpertSuite project is the successor of the massXpert project. This
12 * project now includes various independent modules:
13 *
14 * - massXpert, model polymer chemistries and simulate mass spectrometric data;
15 * - mineXpert, a powerful TIC chromatogram/mass spectrum viewer/miner;
16 *
17 * This program is free software: you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation, either version 3 of the License, or
20 * (at your option) any later version.
21 *
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program. If not, see <http://www.gnu.org/licenses/>.
29 *
30 * END software license
31 */
32
33
34 /////////////////////// Local includes
35 #include "MsXpS/libXpertMassCore/globals.hpp"
36 #include "MsXpS/libXpertMassCore/OligomerPair.hpp"
37
38
39 namespace MsXpS
40 {
41 namespace libXpertMassCore
42 {
43
44
45 /*!
46 \class MsXpS::libXpertMassCore::OligomerPair
47 \inmodule libXpertMassCore
48 \ingroup XpertMassCoreMassCalculations
49 \inheaderfile OligomerPair.hpp
50
51 \brief The OligomerPair class provides abstractions to work with
52 a pair of Oligomer instances.
53 */
54
55 /*!
56 \variable MsXpS::libXpertMassCore::OligomerPair::m_name
57
58 \brief The name of the OligomerPair.
59 */
60
61 /*!
62 \variable MsXpS::libXpertMassCore::OligomerPair::msp_first
63
64 \brief The first Oligomer of the pair.
65 */
66
67 /*!
68 \variable MsXpS::libXpertMassCore::OligomerPair::msp_second
69
70 \brief The second Oligomer of the pair.
71 */
72
73 /*!
74 \variable MsXpS::libXpertMassCore::OligomerPair::m_massType
75
76 \brief The mass type that is to be handled.
77 */
78
79 /*!
80 \variable MsXpS::libXpertMassCore::OligomerPair::m_error
81
82 \brief The error on the mass values.
83 */
84
85 /*!
86 \variable MsXpS::libXpertMassCore::OligomerPair::m_isMatching
87
88 \brief Tells if the OligomerPair is matching.
89
90 The concept of matching depends on the use case for this class.
91 */
92
93 /*!
94 \typedef MsXpS::libXpertMassCore::OligomerPairSPtr
95 \relates OligomerPair
96
97 Synonym for std::shared_ptr<OligomerPair>.
98 */
99
100 /*!
101 \typedef MsXpS::libXpertMassCore::OligomerPairCstSPtr
102 \relates OligomerPair
103
104 Synonym for std::shared_ptr<const OligomerPair>.
105 */
106
107 /*!
108 \brief Constructs an OligomerPair.
109
110 The OligomerPair instance is constructed with these arguments:
111
112 \list
113
114 \li \a name The name of this OligomerPair
115
116 \li \a first_csp The first Oligomer
117
118 \li \a first_csp The second Oligomer
119
120 \li \a mass_type Type of mass that is being dealt with
121
122 \li \a error The error
123
124 \li \a isMatching If there is a match
125
126 \endlist
127
128 \a first_csp and \a second_csp cannot be nullptr.
129 */
130 ✗ OligomerPair::OligomerPair(const QString &name,
131 const OligomerSPtr first_csp,
132 const OligomerSPtr second_csp,
133 Enums::MassType mass_type,
134 double error,
135 ✗ bool isMatching)
136 ✗ : m_name(name),
137 ✗ msp_first(first_csp),
138 ✗ msp_second(second_csp),
139 ✗ m_massType(mass_type),
140 ✗ m_error(error),
141 ✗ m_isMatching(isMatching)
142 {
143 ✗ if(msp_first == nullptr || msp_second == nullptr)
144 ✗ qFatalStream() << "Programming error. Pointer(s) cannot be nullptr.";
145 ✗ }
146
147
148 /*!
149 \brief Constructs the OligomerPair as a copy of \a other.
150 */
151 ✗ OligomerPair::OligomerPair(const OligomerPair &other)
152 : PropListHolder(other),
153 ✗ m_name(other.m_name),
154 ✗ msp_first(other.msp_first),
155 ✗ msp_second(other.msp_second),
156 ✗ m_massType(other.m_massType),
157 ✗ m_error(other.m_error),
158 ✗ m_isMatching(other.m_isMatching)
159 {
160 ✗ if(msp_first == nullptr || msp_second == nullptr)
161 ✗ qFatalStream() << "Programming error. Pointer(s) cannot be nullptr.";
162 ✗ }
163
164
165 /*!
166 \brief Desstructs the OligomerPair.
167 */
168 ✗ OligomerPair::~OligomerPair()
169 {
170 ✗ }
171
172
173 /*!
174 \brief Returns the name.
175 */
176 QString
177 ✗ OligomerPair::getName()
178 {
179 ✗ return m_name;
180 }
181
182
183 /*!
184 \brief Returns the first Oligomer.
185 */
186 const OligomerSPtr
187 ✗ OligomerPair::getFirst() const
188 {
189 ✗ return msp_first;
190 }
191
192
193 /*!
194 \brief Returns the second Oligomer.
195 */
196 const OligomerSPtr
197 ✗ OligomerPair::getSecond() const
198 {
199 ✗ return msp_second;
200 }
201
202 /*!
203 \brief Sets the \a mass_type.
204 */
205 void
206 ✗ OligomerPair::setMassType(Enums::MassType mass_type)
207 {
208 ✗ m_massType = mass_type;
209 ✗ }
210
211 /*!
212 \brief Returns the mass type.
213 */
214 Enums::MassType
215 ✗ OligomerPair::getMassType() const
216 {
217 ✗ return m_massType;
218 }
219
220 /*!
221 \brief Sets the \a error.
222 */
223 void
224 ✗ OligomerPair::setError(double error)
225 {
226 ✗ m_error = error;
227 ✗ }
228
229 /*!
230 \brief Returns the error.
231 */
232 double
233 ✗ OligomerPair::getError() const
234 {
235 ✗ return m_error;
236 }
237
238 /*!
239 \brief Sets the matching to \a is_matching.
240 */
241 void
242 ✗ OligomerPair::setMatching(bool is_matching)
243 {
244 ✗ m_isMatching = is_matching;
245 ✗ }
246
247 /*!
248 \brief Returns the matching.
249 */
250 bool
251 ✗ OligomerPair::isMatching() const
252 {
253 ✗ return m_isMatching;
254 }
255
256 /*!
257 \brief Returns the mass of the first Oligomer of the type set in the member
258 Enums::MassType.
259 */
260 double
261 ✗ OligomerPair::getFirstMass()
262 {
263 ✗ return msp_first->getMass(m_massType);
264 }
265
266 /*!
267 \brief Returns the mass of the second Oligomer of the type set in the member
268 Enums::MassType.
269 */
270 double
271 ✗ OligomerPair::getSecondMass()
272 {
273 ✗ return msp_second->getMass(m_massType);
274 }
275
276 /*!
277 \brief Returns the charge of the first Oligomer as calculated in the Oligomer's
278 Ionizer member.
279
280 \sa Ionizer
281 */
282 int
283 ✗ OligomerPair::firstCharge()
284 {
285 ✗ return msp_first->getIonizerCstRef().charge();
286 }
287
288
289 /*!
290 \brief Returns the charge of the second Oligomer as calculated in the Oligomer's
291 Ionizer member.
292
293 \sa Ionizer
294 */
295 int
296 ✗ OligomerPair::secondCharge()
297 {
298 ✗ return msp_second->getIonizerCstRef().charge();
299 }
300
301
302 //////////////// OPERATORS /////////////////////
303 /*!
304 \brief Assigns \a other to this Oligomer instance.
305 */
306 OligomerPair &
307 ✗ OligomerPair::operator=(const OligomerPair &other)
308 {
309 ✗ if(this == &other)
310 return *this;
311
312 ✗ PropListHolder::operator=(other);
313
314 ✗ m_name = other.m_name;
315 ✗ msp_first = other.msp_first;
316 ✗ msp_second = other.msp_second;
317 ✗ m_massType = other.m_massType;
318 ✗ m_error = other.m_error;
319 ✗ m_isMatching = other.m_isMatching;
320
321 ✗ return *this;
322 }
323
324 } // namespace libXpertMassCore
325 } // namespace MsXpS
326