NCBI C++ ToolKit
MSSpectrum_.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id$
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  */
27 
28 /// @file MSSpectrum_.hpp
29 /// Data storage class.
30 ///
31 /// This file was generated by application DATATOOL
32 /// using the following specifications:
33 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/omssa/omssa.asn">omssa.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/omssa/omssa.def">omssa.def</a>
36 ///
37 /// ATTENTION:
38 /// Don't edit or commit this file into CVS as this file will
39 /// be overridden (by DATATOOL) without warning!
40 
41 #ifndef OBJECTS_OMSSA_MSSPECTRUM_BASE_HPP
42 #define OBJECTS_OMSSA_MSSPECTRUM_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
48 #include <list>
49 #include <string>
50 #include <vector>
51 
53 
54 #ifndef BEGIN_objects_SCOPE
55 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
56 # define END_objects_SCOPE END_SCOPE(objects)
57 #endif
58 BEGIN_objects_SCOPE // namespace ncbi::objects::
59 
60 
61 // forward declarations
62 class CNameValue;
63 
64 
65 // generated classes
66 
67 
68 /** @addtogroup dataspec_OMSSA
69  *
70  * @{
71  */
72 
73 /////////////////////////////////////////////////////////////////////////////
74 /// Holds a single spectrum
75 ///
76 /// CMSSpectrum_Base --
77 ///
78 
80 {
82 public:
83  // constructor
84  CMSSpectrum_Base(void);
85  // destructor
86  virtual ~CMSSpectrum_Base(void);
87 
88  // type info
90 
91  // types
92  typedef int TNumber;
93  typedef list< int > TCharge;
94  typedef int TPrecursormz;
95  typedef vector< int > TMz;
96  typedef vector< int > TAbundance;
97  typedef double TIscale;
98  typedef list< string > TIds;
99  typedef list< CRef< CNameValue > > TNamevalue;
100 
101  // member index
102  enum class E_memberIndex {
103  e__allMandatory = 0,
104  e_number,
105  e_charge,
106  e_precursormz,
107  e_mz,
108  e_abundance,
109  e_iscale,
110  e_ids,
111  e_namevalue
112  };
114 
115  // getters
116  // setters
117 
118  /// unique number of spectrum
119  /// Check if a value has been assigned to Number data member.
120  ///
121  /// Data member Number is mandatory;
122  /// its type is defined as 'typedef int TNumber'
123  /// @return
124  /// - true, if a value has been assigned.
125  /// - false, otherwise.
126  bool IsSetNumber(void) const;
127 
128  /// Check if it is safe to call GetNumber method.
129  ///
130  /// @return
131  /// - true, if the data member is getatable.
132  /// - false, otherwise.
133  bool CanGetNumber(void) const;
134 
135  /// Reset Number data member.
136  void ResetNumber(void);
137 
138  /// Get the Number member data.
139  ///
140  /// @return
141  /// Copy of the member data.
142  TNumber GetNumber(void) const;
143 
144  /// Assign a value to Number data member.
145  ///
146  /// @param value
147  /// Value to assign
148  void SetNumber(TNumber value);
149 
150  /// Assign a value to Number data member.
151  ///
152  /// @return
153  /// Reference to the data value.
154  TNumber& SetNumber(void);
155 
156  /// may be more than one if unknown
157  /// Check if a value has been assigned to Charge data member.
158  ///
159  /// Data member Charge is mandatory;
160  /// its type is defined as 'typedef list< int > TCharge'
161  /// @return
162  /// - true, if a value has been assigned.
163  /// - false, otherwise.
164  bool IsSetCharge(void) const;
165 
166  /// Check if it is safe to call GetCharge method.
167  ///
168  /// @return
169  /// - true, if the data member is getatable.
170  /// - false, otherwise.
171  bool CanGetCharge(void) const;
172 
173  /// Reset Charge data member.
174  void ResetCharge(void);
175 
176  /// Get the Charge member data.
177  ///
178  /// @return
179  /// Reference to the member data.
180  const TCharge& GetCharge(void) const;
181 
182  /// Assign a value to Charge data member.
183  ///
184  /// @return
185  /// Reference to the data value.
186  TCharge& SetCharge(void);
187 
188  /// scaled precursor m/z, scale is in MSSearchSettings
189  /// Check if a value has been assigned to Precursormz data member.
190  ///
191  /// Data member Precursormz is mandatory;
192  /// its type is defined as 'typedef int TPrecursormz'
193  /// @return
194  /// - true, if a value has been assigned.
195  /// - false, otherwise.
196  bool IsSetPrecursormz(void) const;
197 
198  /// Check if it is safe to call GetPrecursormz method.
199  ///
200  /// @return
201  /// - true, if the data member is getatable.
202  /// - false, otherwise.
203  bool CanGetPrecursormz(void) const;
204 
205  /// Reset Precursormz data member.
206  void ResetPrecursormz(void);
207 
208  /// Get the Precursormz member data.
209  ///
210  /// @return
211  /// Copy of the member data.
212  TPrecursormz GetPrecursormz(void) const;
213 
214  /// Assign a value to Precursormz data member.
215  ///
216  /// @param value
217  /// Value to assign
218  void SetPrecursormz(TPrecursormz value);
219 
220  /// Assign a value to Precursormz data member.
221  ///
222  /// @return
223  /// Reference to the data value.
224  TPrecursormz& SetPrecursormz(void);
225 
226  /// scaled product m/z
227  /// Check if a value has been assigned to Mz data member.
228  ///
229  /// Data member Mz is mandatory;
230  /// its type is defined as 'typedef vector< int > TMz'
231  /// @return
232  /// - true, if a value has been assigned.
233  /// - false, otherwise.
234  bool IsSetMz(void) const;
235 
236  /// Check if it is safe to call GetMz method.
237  ///
238  /// @return
239  /// - true, if the data member is getatable.
240  /// - false, otherwise.
241  bool CanGetMz(void) const;
242 
243  /// Reset Mz data member.
244  void ResetMz(void);
245 
246  /// Get the Mz member data.
247  ///
248  /// @return
249  /// Reference to the member data.
250  const TMz& GetMz(void) const;
251 
252  /// Assign a value to Mz data member.
253  ///
254  /// @return
255  /// Reference to the data value.
256  TMz& SetMz(void);
257 
258  /// scaled product abundance
259  /// Check if a value has been assigned to Abundance data member.
260  ///
261  /// Data member Abundance is mandatory;
262  /// its type is defined as 'typedef vector< int > TAbundance'
263  /// @return
264  /// - true, if a value has been assigned.
265  /// - false, otherwise.
266  bool IsSetAbundance(void) const;
267 
268  /// Check if it is safe to call GetAbundance method.
269  ///
270  /// @return
271  /// - true, if the data member is getatable.
272  /// - false, otherwise.
273  bool CanGetAbundance(void) const;
274 
275  /// Reset Abundance data member.
276  void ResetAbundance(void);
277 
278  /// Get the Abundance member data.
279  ///
280  /// @return
281  /// Reference to the member data.
282  const TAbundance& GetAbundance(void) const;
283 
284  /// Assign a value to Abundance data member.
285  ///
286  /// @return
287  /// Reference to the data value.
288  TAbundance& SetAbundance(void);
289 
290  /// abundance scale, float to integer
291  /// Check if a value has been assigned to Iscale data member.
292  ///
293  /// Data member Iscale is mandatory;
294  /// its type is defined as 'typedef double TIscale'
295  /// @return
296  /// - true, if a value has been assigned.
297  /// - false, otherwise.
298  bool IsSetIscale(void) const;
299 
300  /// Check if it is safe to call GetIscale method.
301  ///
302  /// @return
303  /// - true, if the data member is getatable.
304  /// - false, otherwise.
305  bool CanGetIscale(void) const;
306 
307  /// Reset Iscale data member.
308  void ResetIscale(void);
309 
310  /// Get the Iscale member data.
311  ///
312  /// @return
313  /// Copy of the member data.
314  TIscale GetIscale(void) const;
315 
316  /// Assign a value to Iscale data member.
317  ///
318  /// @param value
319  /// Value to assign
320  void SetIscale(TIscale value);
321 
322  /// Assign a value to Iscale data member.
323  ///
324  /// @return
325  /// Reference to the data value.
326  TIscale& SetIscale(void);
327 
328  /// ids/filenames
329  /// Check if a value has been assigned to Ids data member.
330  ///
331  /// Data member Ids is optional;
332  /// its type is defined as 'typedef list< string > TIds'
333  /// @return
334  /// - true, if a value has been assigned.
335  /// - false, otherwise.
336  bool IsSetIds(void) const;
337 
338  /// Check if it is safe to call GetIds method.
339  ///
340  /// @return
341  /// - true, if the data member is getatable.
342  /// - false, otherwise.
343  bool CanGetIds(void) const;
344 
345  /// Reset Ids data member.
346  void ResetIds(void);
347 
348  /// Get the Ids member data.
349  ///
350  /// @return
351  /// Reference to the member data.
352  const TIds& GetIds(void) const;
353 
354  /// Assign a value to Ids data member.
355  ///
356  /// @return
357  /// Reference to the data value.
358  TIds& SetIds(void);
359 
360  /// extra info: retention times, etc.
361  /// Check if a value has been assigned to Namevalue data member.
362  ///
363  /// Data member Namevalue is optional;
364  /// its type is defined as 'typedef list< CRef< CNameValue > > TNamevalue'
365  /// @return
366  /// - true, if a value has been assigned.
367  /// - false, otherwise.
368  bool IsSetNamevalue(void) const;
369 
370  /// Check if it is safe to call GetNamevalue method.
371  ///
372  /// @return
373  /// - true, if the data member is getatable.
374  /// - false, otherwise.
375  bool CanGetNamevalue(void) const;
376 
377  /// Reset Namevalue data member.
378  void ResetNamevalue(void);
379 
380  /// Get the Namevalue member data.
381  ///
382  /// @return
383  /// Reference to the member data.
384  const TNamevalue& GetNamevalue(void) const;
385 
386  /// Assign a value to Namevalue data member.
387  ///
388  /// @return
389  /// Reference to the data value.
390  TNamevalue& SetNamevalue(void);
391 
392  /// Reset the whole object
393  virtual void Reset(void);
394 
395 
396 private:
397  // Prohibit copy constructor and assignment operator
400 
401  // data
402  Uint4 m_set_State[1];
403  int m_Number;
404  list< int > m_Charge;
406  vector< int > m_Mz;
407  vector< int > m_Abundance;
408  double m_Iscale;
409  list< string > m_Ids;
410  list< CRef< CNameValue > > m_Namevalue;
411 };
412 
413 /* @} */
414 
415 
416 
417 
418 
419 ///////////////////////////////////////////////////////////
420 ///////////////////// inline methods //////////////////////
421 ///////////////////////////////////////////////////////////
422 inline
424 {
425  return ((m_set_State[0] & 0x3) != 0);
426 }
427 
428 inline
430 {
431  return IsSetNumber();
432 }
433 
434 inline
436 {
437  m_Number = 0;
438  m_set_State[0] &= ~0x3;
439 }
440 
441 inline
443 {
444  if (!CanGetNumber()) {
445  ThrowUnassigned(0);
446  }
447  return m_Number;
448 }
449 
450 inline
452 {
453  m_Number = value;
454  m_set_State[0] |= 0x3;
455 }
456 
457 inline
459 {
460 #ifdef _DEBUG
461  if (!IsSetNumber()) {
462  memset(&m_Number,UnassignedByte(),sizeof(m_Number));
463  }
464 #endif
465  m_set_State[0] |= 0x1;
466  return m_Number;
467 }
468 
469 inline
471 {
472  return ((m_set_State[0] & 0xc) != 0);
473 }
474 
475 inline
477 {
478  return true;
479 }
480 
481 inline
483 {
484  return m_Charge;
485 }
486 
487 inline
489 {
490  m_set_State[0] |= 0x4;
491  return m_Charge;
492 }
493 
494 inline
496 {
497  return ((m_set_State[0] & 0x30) != 0);
498 }
499 
500 inline
502 {
503  return IsSetPrecursormz();
504 }
505 
506 inline
508 {
509  m_Precursormz = 0;
510  m_set_State[0] &= ~0x30;
511 }
512 
513 inline
515 {
516  if (!CanGetPrecursormz()) {
517  ThrowUnassigned(2);
518  }
519  return m_Precursormz;
520 }
521 
522 inline
524 {
526  m_set_State[0] |= 0x30;
527 }
528 
529 inline
531 {
532 #ifdef _DEBUG
533  if (!IsSetPrecursormz()) {
534  memset(&m_Precursormz,UnassignedByte(),sizeof(m_Precursormz));
535  }
536 #endif
537  m_set_State[0] |= 0x10;
538  return m_Precursormz;
539 }
540 
541 inline
543 {
544  return ((m_set_State[0] & 0xc0) != 0);
545 }
546 
547 inline
549 {
550  return true;
551 }
552 
553 inline
555 {
556  return m_Mz;
557 }
558 
559 inline
561 {
562  m_set_State[0] |= 0x40;
563  return m_Mz;
564 }
565 
566 inline
568 {
569  return ((m_set_State[0] & 0x300) != 0);
570 }
571 
572 inline
574 {
575  return true;
576 }
577 
578 inline
580 {
581  return m_Abundance;
582 }
583 
584 inline
586 {
587  m_set_State[0] |= 0x100;
588  return m_Abundance;
589 }
590 
591 inline
593 {
594  return ((m_set_State[0] & 0xc00) != 0);
595 }
596 
597 inline
599 {
600  return IsSetIscale();
601 }
602 
603 inline
605 {
606  m_Iscale = 0;
607  m_set_State[0] &= ~0xc00;
608 }
609 
610 inline
612 {
613  if (!CanGetIscale()) {
614  ThrowUnassigned(5);
615  }
616  return m_Iscale;
617 }
618 
619 inline
621 {
622  m_Iscale = value;
623  m_set_State[0] |= 0xc00;
624 }
625 
626 inline
628 {
629 #ifdef _DEBUG
630  if (!IsSetIscale()) {
631  memset(&m_Iscale,UnassignedByte(),sizeof(m_Iscale));
632  }
633 #endif
634  m_set_State[0] |= 0x400;
635  return m_Iscale;
636 }
637 
638 inline
640 {
641  return ((m_set_State[0] & 0x3000) != 0);
642 }
643 
644 inline
646 {
647  return true;
648 }
649 
650 inline
652 {
653  return m_Ids;
654 }
655 
656 inline
658 {
659  m_set_State[0] |= 0x1000;
660  return m_Ids;
661 }
662 
663 inline
665 {
666  return ((m_set_State[0] & 0xc000) != 0);
667 }
668 
669 inline
671 {
672  return true;
673 }
674 
675 inline
677 {
678  return m_Namevalue;
679 }
680 
681 inline
683 {
684  m_set_State[0] |= 0x4000;
685  return m_Namevalue;
686 }
687 
688 ///////////////////////////////////////////////////////////
689 ////////////////// end of inline methods //////////////////
690 ///////////////////////////////////////////////////////////
691 
692 
693 
694 
695 
696 END_objects_SCOPE // namespace ncbi::objects::
697 
699 
700 
701 #endif // OBJECTS_OMSSA_MSSPECTRUM_BASE_HPP
Holds a single spectrum.
Definition: MSSpectrum_.hpp:80
CNameValue –.
Definition: NameValue.hpp:66
Base class for all serializable objects.
Definition: serialbase.hpp:150
char value[7]
Definition: config.c:431
static char UnassignedByte(void)
Definition: serialbase.hpp:181
void ThrowUnassigned(TMemberIndex index) const
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_OMSSA_EXPORT
Definition: ncbi_export.h:672
list< CRef< CNameValue > > m_Namevalue
CSerialObject Tparent
Definition: MSSpectrum_.hpp:81
list< int > TCharge
Definition: MSSpectrum_.hpp:93
const TMz & GetMz(void) const
Get the Mz member data.
TPrecursormz & SetPrecursormz(void)
Assign a value to Precursormz data member.
TNumber & SetNumber(void)
Assign a value to Number data member.
bool CanGetCharge(void) const
Check if it is safe to call GetCharge method.
bool IsSetAbundance(void) const
scaled product abundance Check if a value has been assigned to Abundance data member.
TAbundance & SetAbundance(void)
Assign a value to Abundance data member.
bool IsSetCharge(void) const
may be more than one if unknown Check if a value has been assigned to Charge data member.
bool IsSetPrecursormz(void) const
scaled precursor m/z, scale is in MSSearchSettings Check if a value has been assigned to Precursormz ...
Tparent::CMemberIndex< E_memberIndex, 9 > TmemberIndex
list< string > m_Ids
const TAbundance & GetAbundance(void) const
Get the Abundance member data.
bool CanGetPrecursormz(void) const
Check if it is safe to call GetPrecursormz method.
TIds & SetIds(void)
Assign a value to Ids data member.
CMSSpectrum_Base(const CMSSpectrum_Base &)
vector< int > m_Mz
void ResetNumber(void)
Reset Number data member.
bool CanGetIds(void) const
Check if it is safe to call GetIds method.
bool CanGetNamevalue(void) const
Check if it is safe to call GetNamevalue method.
TNamevalue & SetNamevalue(void)
Assign a value to Namevalue data member.
list< int > m_Charge
bool CanGetIscale(void) const
Check if it is safe to call GetIscale method.
bool IsSetNumber(void) const
unique number of spectrum Check if a value has been assigned to Number data member.
const TNamevalue & GetNamevalue(void) const
Get the Namevalue member data.
Uint4 m_set_State[1]
void ResetPrecursormz(void)
Reset Precursormz data member.
void ResetIscale(void)
Reset Iscale data member.
bool CanGetMz(void) const
Check if it is safe to call GetMz method.
CMSSpectrum_Base & operator=(const CMSSpectrum_Base &)
bool CanGetNumber(void) const
Check if it is safe to call GetNumber method.
vector< int > m_Abundance
bool IsSetIscale(void) const
abundance scale, float to integer Check if a value has been assigned to Iscale data member.
const TCharge & GetCharge(void) const
Get the Charge member data.
TMz & SetMz(void)
Assign a value to Mz data member.
bool IsSetIds(void) const
ids/filenames Check if a value has been assigned to Ids data member.
list< string > TIds
Definition: MSSpectrum_.hpp:98
const TIds & GetIds(void) const
Get the Ids member data.
TNumber GetNumber(void) const
Get the Number member data.
TCharge & SetCharge(void)
Assign a value to Charge data member.
vector< int > TAbundance
Definition: MSSpectrum_.hpp:96
list< CRef< CNameValue > > TNamevalue
Definition: MSSpectrum_.hpp:99
TIscale GetIscale(void) const
Get the Iscale member data.
bool CanGetAbundance(void) const
Check if it is safe to call GetAbundance method.
TIscale & SetIscale(void)
Assign a value to Iscale data member.
bool IsSetMz(void) const
scaled product m/z Check if a value has been assigned to Mz data member.
bool IsSetNamevalue(void) const
extra info: retention times, etc.
TPrecursormz GetPrecursormz(void) const
Get the Precursormz member data.
vector< int > TMz
Definition: MSSpectrum_.hpp:95
static bool GetIds(const T &d, set< string > &labels, const string name="", bool detect=false, bool found=false)
int GetCharge(char code)
Modified on Sat Dec 09 04:47:36 2023 by modify_doxy.py rev. 669887