NCBI C++ ToolKit
PC_Substance_.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 PC_Substance_.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/pcsubstance/pcsubstance.asn">pcsubstance.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/pcsubstance/pcsubstance.def">pcsubstance.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_PCSUBSTANCE_PC_SUBSTANCE_BASE_HPP
42 #define OBJECTS_PCSUBSTANCE_PC_SUBSTANCE_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
48 #include <list>
49 #include <string>
50 
52 
53 #ifndef BEGIN_objects_SCOPE
54 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
55 # define END_objects_SCOPE END_SCOPE(objects)
56 #endif
57 BEGIN_objects_SCOPE // namespace ncbi::objects::
58 
59 
60 // forward declarations
61 class CPC_Compounds;
62 class CPC_ID;
63 class CPC_Source;
64 class CPC_XRefData;
65 class CPub;
66 
67 
68 // generated classes
69 
70 
71 /** @addtogroup dataspec_NCBI_PCSubstance
72  *
73  * @{
74  */
75 
76 /////////////////////////////////////////////////////////////////////////////
77 /// Root Record for Chemical Substance Definition
78 ///
79 /// CPC_Substance_Base --
80 ///
81 
83 {
85 public:
86  // constructor
87  CPC_Substance_Base(void);
88  // destructor
89  virtual ~CPC_Substance_Base(void);
90 
91  // type info
93 
94  // types
95  typedef CPC_ID TSid;
97  typedef list< CRef< CPub > > TPub;
98  typedef list< string > TSynonyms;
99  typedef list< string > TComment;
100  typedef list< CRef< CPC_XRefData > > TXref;
102 
103  // member index
104  enum class E_memberIndex {
105  e__allMandatory = 0,
106  e_sid,
107  e_source,
108  e_pub,
109  e_synonyms,
110  e_comment,
111  e_xref,
112  e_compound
113  };
115 
116  // getters
117  // setters
118 
119  /// Internal Tracking Information
120  /// Substance ID/Version [Either valid ID or a "0" dummy
121  /// value, if "source" is to be used]
122  /// Note: Version is for internal use (only?)
123  /// Note: A valid ID is greater than "0"
124  /// Check if a value has been assigned to Sid data member.
125  ///
126  /// Data member Sid is mandatory;
127  /// its type is defined as 'typedef CPC_ID TSid'
128  /// @return
129  /// - true, if a value has been assigned.
130  /// - false, otherwise.
131  bool IsSetSid(void) const;
132 
133  /// Check if it is safe to call GetSid method.
134  ///
135  /// @return
136  /// - true, if the data member is getatable.
137  /// - false, otherwise.
138  bool CanGetSid(void) const;
139 
140  /// Reset Sid data member.
141  void ResetSid(void);
142 
143  /// Get the Sid member data.
144  ///
145  /// @return
146  /// Reference to the member data.
147  const TSid& GetSid(void) const;
148 
149  /// Assign a value to Sid data member.
150  ///
151  /// @param value
152  /// Reference to value.
153  void SetSid(TSid& value);
154 
155  /// Assign a value to Sid data member.
156  ///
157  /// @return
158  /// Reference to the data value.
159  TSid& SetSid(void);
160 
161  /// Data Source for this Submission
162  /// Check if a value has been assigned to Source data member.
163  ///
164  /// Data member Source is mandatory;
165  /// its type is defined as 'typedef CPC_Source TSource'
166  /// @return
167  /// - true, if a value has been assigned.
168  /// - false, otherwise.
169  bool IsSetSource(void) const;
170 
171  /// Check if it is safe to call GetSource method.
172  ///
173  /// @return
174  /// - true, if the data member is getatable.
175  /// - false, otherwise.
176  bool CanGetSource(void) const;
177 
178  /// Reset Source data member.
179  void ResetSource(void);
180 
181  /// Get the Source member data.
182  ///
183  /// @return
184  /// Reference to the member data.
185  const TSource& GetSource(void) const;
186 
187  /// Assign a value to Source data member.
188  ///
189  /// @param value
190  /// Reference to value.
191  void SetSource(TSource& value);
192 
193  /// Assign a value to Source data member.
194  ///
195  /// @return
196  /// Reference to the data value.
197  TSource& SetSource(void);
198 
199  /// Substance Description Information
200  /// Articles Describing this Substance
201  /// Check if a value has been assigned to Pub data member.
202  ///
203  /// Data member Pub is optional;
204  /// its type is defined as 'typedef list< CRef< CPub > > TPub'
205  /// @return
206  /// - true, if a value has been assigned.
207  /// - false, otherwise.
208  bool IsSetPub(void) const;
209 
210  /// Check if it is safe to call GetPub method.
211  ///
212  /// @return
213  /// - true, if the data member is getatable.
214  /// - false, otherwise.
215  bool CanGetPub(void) const;
216 
217  /// Reset Pub data member.
218  void ResetPub(void);
219 
220  /// Get the Pub member data.
221  ///
222  /// @return
223  /// Reference to the member data.
224  const TPub& GetPub(void) const;
225 
226  /// Assign a value to Pub data member.
227  ///
228  /// @return
229  /// Reference to the data value.
230  TPub& SetPub(void);
231 
232  /// Substance Names provided by Depositor
233  /// Check if a value has been assigned to Synonyms data member.
234  ///
235  /// Data member Synonyms is optional;
236  /// its type is defined as 'typedef list< string > TSynonyms'
237  /// @return
238  /// - true, if a value has been assigned.
239  /// - false, otherwise.
240  bool IsSetSynonyms(void) const;
241 
242  /// Check if it is safe to call GetSynonyms method.
243  ///
244  /// @return
245  /// - true, if the data member is getatable.
246  /// - false, otherwise.
247  bool CanGetSynonyms(void) const;
248 
249  /// Reset Synonyms data member.
250  void ResetSynonyms(void);
251 
252  /// Get the Synonyms member data.
253  ///
254  /// @return
255  /// Reference to the member data.
256  const TSynonyms& GetSynonyms(void) const;
257 
258  /// Assign a value to Synonyms data member.
259  ///
260  /// @return
261  /// Reference to the data value.
262  TSynonyms& SetSynonyms(void);
263 
264  /// Comments and Description provided by Depositor
265  /// Check if a value has been assigned to Comment data member.
266  ///
267  /// Data member Comment is optional;
268  /// its type is defined as 'typedef list< string > TComment'
269  /// @return
270  /// - true, if a value has been assigned.
271  /// - false, otherwise.
272  bool IsSetComment(void) const;
273 
274  /// Check if it is safe to call GetComment method.
275  ///
276  /// @return
277  /// - true, if the data member is getatable.
278  /// - false, otherwise.
279  bool CanGetComment(void) const;
280 
281  /// Reset Comment data member.
282  void ResetComment(void);
283 
284  /// Get the Comment member data.
285  ///
286  /// @return
287  /// Reference to the member data.
288  const TComment& GetComment(void) const;
289 
290  /// Assign a value to Comment data member.
291  ///
292  /// @return
293  /// Reference to the data value.
294  TComment& SetComment(void);
295 
296  /// X-Ref/LinkOut Data provided by Depositor
297  /// Check if a value has been assigned to Xref data member.
298  ///
299  /// Data member Xref is optional;
300  /// its type is defined as 'typedef list< CRef< CPC_XRefData > > TXref'
301  /// @return
302  /// - true, if a value has been assigned.
303  /// - false, otherwise.
304  bool IsSetXref(void) const;
305 
306  /// Check if it is safe to call GetXref method.
307  ///
308  /// @return
309  /// - true, if the data member is getatable.
310  /// - false, otherwise.
311  bool CanGetXref(void) const;
312 
313  /// Reset Xref data member.
314  void ResetXref(void);
315 
316  /// Get the Xref member data.
317  ///
318  /// @return
319  /// Reference to the member data.
320  const TXref& GetXref(void) const;
321 
322  /// Assign a value to Xref data member.
323  ///
324  /// @return
325  /// Reference to the data value.
326  TXref& SetXref(void);
327 
328  /// Structure Description
329  /// Original Deposited Structure Information
330  /// Check if a value has been assigned to Compound data member.
331  ///
332  /// Data member Compound is optional;
333  /// its type is defined as 'typedef CPC_Compounds TCompound'
334  /// @return
335  /// - true, if a value has been assigned.
336  /// - false, otherwise.
337  bool IsSetCompound(void) const;
338 
339  /// Check if it is safe to call GetCompound method.
340  ///
341  /// @return
342  /// - true, if the data member is getatable.
343  /// - false, otherwise.
344  bool CanGetCompound(void) const;
345 
346  /// Reset Compound data member.
347  void ResetCompound(void);
348 
349  /// Get the Compound member data.
350  ///
351  /// @return
352  /// Reference to the member data.
353  const TCompound& GetCompound(void) const;
354 
355  /// Assign a value to Compound data member.
356  ///
357  /// @param value
358  /// Reference to value.
359  void SetCompound(TCompound& value);
360 
361  /// Assign a value to Compound data member.
362  ///
363  /// @return
364  /// Reference to the data value.
365  TCompound& SetCompound(void);
366 
367  /// Reset the whole object
368  virtual void Reset(void);
369 
370 
371 private:
372  // Prohibit copy constructor and assignment operator
375 
376  // data
377  Uint4 m_set_State[1];
380  list< CRef< CPub > > m_Pub;
381  list< string > m_Synonyms;
382  list< string > m_Comment;
383  list< CRef< CPC_XRefData > > m_Xref;
385 };
386 
387 /* @} */
388 
389 
390 
391 
392 
393 ///////////////////////////////////////////////////////////
394 ///////////////////// inline methods //////////////////////
395 ///////////////////////////////////////////////////////////
396 inline
398 {
399  return m_Sid.NotEmpty();
400 }
401 
402 inline
404 {
405  return true;
406 }
407 
408 inline
410 {
411  if ( !m_Sid ) {
412  const_cast<CPC_Substance_Base*>(this)->ResetSid();
413  }
414  return (*m_Sid);
415 }
416 
417 inline
419 {
420  if ( !m_Sid ) {
421  ResetSid();
422  }
423  return (*m_Sid);
424 }
425 
426 inline
428 {
429  return m_Source.NotEmpty();
430 }
431 
432 inline
434 {
435  return true;
436 }
437 
438 inline
440 {
441  if ( !m_Source ) {
442  const_cast<CPC_Substance_Base*>(this)->ResetSource();
443  }
444  return (*m_Source);
445 }
446 
447 inline
449 {
450  if ( !m_Source ) {
451  ResetSource();
452  }
453  return (*m_Source);
454 }
455 
456 inline
458 {
459  return ((m_set_State[0] & 0x30) != 0);
460 }
461 
462 inline
464 {
465  return true;
466 }
467 
468 inline
470 {
471  return m_Pub;
472 }
473 
474 inline
476 {
477  m_set_State[0] |= 0x10;
478  return m_Pub;
479 }
480 
481 inline
483 {
484  return ((m_set_State[0] & 0xc0) != 0);
485 }
486 
487 inline
489 {
490  return true;
491 }
492 
493 inline
495 {
496  return m_Synonyms;
497 }
498 
499 inline
501 {
502  m_set_State[0] |= 0x40;
503  return m_Synonyms;
504 }
505 
506 inline
508 {
509  return ((m_set_State[0] & 0x300) != 0);
510 }
511 
512 inline
514 {
515  return true;
516 }
517 
518 inline
520 {
521  return m_Comment;
522 }
523 
524 inline
526 {
527  m_set_State[0] |= 0x100;
528  return m_Comment;
529 }
530 
531 inline
533 {
534  return ((m_set_State[0] & 0xc00) != 0);
535 }
536 
537 inline
539 {
540  return true;
541 }
542 
543 inline
545 {
546  return m_Xref;
547 }
548 
549 inline
551 {
552  m_set_State[0] |= 0x400;
553  return m_Xref;
554 }
555 
556 inline
558 {
559  return m_Compound.NotEmpty();
560 }
561 
562 inline
564 {
565  return IsSetCompound();
566 }
567 
568 inline
570 {
571  if (!CanGetCompound()) {
572  ThrowUnassigned(6);
573  }
574  return (*m_Compound);
575 }
576 
577 ///////////////////////////////////////////////////////////
578 ////////////////// end of inline methods //////////////////
579 ///////////////////////////////////////////////////////////
580 
581 
582 
583 
584 
585 END_objects_SCOPE // namespace ncbi::objects::
586 
588 
589 
590 #endif // OBJECTS_PCSUBSTANCE_PC_SUBSTANCE_BASE_HPP
CPC_Compounds –.
CPC_ID –.
Definition: PC_ID.hpp:66
CPC_Source –.
Definition: PC_Source.hpp:66
Root Record for Chemical Substance Definition.
CPC_XRefData –.
Definition: PC_XRefData.hpp:66
Definition: Pub.hpp:56
CRef –.
Definition: ncbiobj.hpp:618
Base class for all serializable objects.
Definition: serialbase.hpp:150
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_PCSUBSTANCE_EXPORT
Definition: ncbi_export.h:688
const TPub & GetPub(void) const
Get the Pub member data.
const TSource & GetSource(void) const
Get the Source member data.
void ResetSource(void)
Reset Source data member.
const TComment & GetComment(void) const
Get the Comment member data.
bool CanGetSource(void) const
Check if it is safe to call GetSource method.
const TCompound & GetCompound(void) const
Get the Compound member data.
bool IsSetCompound(void) const
Structure Description Original Deposited Structure Information Check if a value has been assigned to ...
bool IsSetXref(void) const
X-Ref/LinkOut Data provided by Depositor Check if a value has been assigned to Xref data member.
list< string > TSynonyms
void ResetSid(void)
Reset Sid data member.
bool IsSetComment(void) const
Comments and Description provided by Depositor Check if a value has been assigned to Comment data mem...
bool IsSetPub(void) const
Substance Description Information Articles Describing this Substance Check if a value has been assign...
CSerialObject Tparent
CPC_Substance_Base & operator=(const CPC_Substance_Base &)
const TSid & GetSid(void) const
Get the Sid member data.
bool CanGetCompound(void) const
Check if it is safe to call GetCompound method.
list< CRef< CPC_XRefData > > m_Xref
list< string > m_Synonyms
TSynonyms & SetSynonyms(void)
Assign a value to Synonyms data member.
bool CanGetXref(void) const
Check if it is safe to call GetXref method.
bool IsSetSource(void) const
Data Source for this Submission Check if a value has been assigned to Source data member.
list< CRef< CPC_XRefData > > TXref
CRef< TSource > m_Source
TXref & SetXref(void)
Assign a value to Xref data member.
TSid & SetSid(void)
Assign a value to Sid data member.
const TXref & GetXref(void) const
Get the Xref member data.
Tparent::CMemberIndex< E_memberIndex, 8 > TmemberIndex
TSource & SetSource(void)
Assign a value to Source data member.
CRef< TCompound > m_Compound
bool CanGetComment(void) const
Check if it is safe to call GetComment method.
bool IsSetSid(void) const
Internal Tracking Information Substance ID/Version [Either valid ID or a "0" dummy value,...
TPub & SetPub(void)
Assign a value to Pub data member.
list< string > m_Comment
list< CRef< CPub > > m_Pub
list< CRef< CPub > > TPub
CPC_Substance_Base(const CPC_Substance_Base &)
bool CanGetSynonyms(void) const
Check if it is safe to call GetSynonyms method.
bool CanGetSid(void) const
Check if it is safe to call GetSid method.
TComment & SetComment(void)
Assign a value to Comment data member.
bool CanGetPub(void) const
Check if it is safe to call GetPub method.
CPC_Compounds TCompound
bool IsSetSynonyms(void) const
Substance Names provided by Depositor Check if a value has been assigned to Synonyms data member.
list< string > TComment
const TSynonyms & GetSynonyms(void) const
Get the Synonyms member data.
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Sun Apr 21 03:44:30 2024 by modify_doxy.py rev. 669887