NCBI C++ ToolKit
Dependent_field_rule_.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 Dependent_field_rule_.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/valid/valid.asn">valid.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/valid/valid.def">valid.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_VALID_DEPENDENT_FIELD_RULE_BASE_HPP
42 #define OBJECTS_VALID_DEPENDENT_FIELD_RULE_BASE_HPP
43 
44 // standard includes
45 #include <serial/serialbase.hpp>
46 
47 // generated includes
48 #include <string>
49 
51 
52 #ifndef BEGIN_objects_SCOPE
53 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
54 # define END_objects_SCOPE END_SCOPE(objects)
55 #endif
56 BEGIN_objects_SCOPE // namespace ncbi::objects::
57 
58 
59 // forward declarations
60 class CField_set;
61 
62 
63 // generated classes
64 
65 
66 /** @addtogroup dataspec_NCBI_Structured_comment_validation
67  *
68  * @{
69  */
70 
71 /////////////////////////////////////////////////////////////////////////////
72 ///
73 /// CDependent_field_rule_Base --
74 ///
75 
77 {
79 public:
80  // constructor
82  // destructor
83  virtual ~CDependent_field_rule_Base(void);
84 
85  // type info
87 
88  // types
89  typedef string TMatch_name;
90  typedef string TValue_constraint;
91  typedef bool TInvert_match;
94 
95  // member index
96  enum class E_memberIndex {
97  e__allMandatory = 0,
98  e_match_name,
99  e_value_constraint,
100  e_invert_match,
101  e_other_fields,
102  e_disallowed_fields
103  };
105 
106  // getters
107  // setters
108 
109  /// Check if a value has been assigned to Match_name data member.
110  ///
111  /// Data member Match_name is mandatory;
112  /// its type is defined as 'typedef string TMatch_name'
113  /// @return
114  /// - true, if a value has been assigned.
115  /// - false, otherwise.
116  bool IsSetMatch_name(void) const;
117 
118  /// Check if it is safe to call GetMatch_name method.
119  ///
120  /// @return
121  /// - true, if the data member is getatable.
122  /// - false, otherwise.
123  bool CanGetMatch_name(void) const;
124 
125  /// Reset Match_name data member.
126  void ResetMatch_name(void);
127 
128  /// Get the Match_name member data.
129  ///
130  /// @return
131  /// Reference to the member data.
132  const TMatch_name& GetMatch_name(void) const;
133 
134  /// Assign a value to Match_name data member.
135  ///
136  /// @param value
137  /// Value to assign
138  void SetMatch_name(const TMatch_name& value);
139  void SetMatch_name(TMatch_name&& value);
140 
141  /// Assign a value to Match_name data member.
142  ///
143  /// @return
144  /// Reference to the data value.
145  TMatch_name& SetMatch_name(void);
146 
147  /// Check if a value has been assigned to Value_constraint data member.
148  ///
149  /// Data member Value_constraint is optional;
150  /// its type is defined as 'typedef string TValue_constraint'
151  /// @return
152  /// - true, if a value has been assigned.
153  /// - false, otherwise.
154  bool IsSetValue_constraint(void) const;
155 
156  /// Check if it is safe to call GetValue_constraint method.
157  ///
158  /// @return
159  /// - true, if the data member is getatable.
160  /// - false, otherwise.
161  bool CanGetValue_constraint(void) const;
162 
163  /// Reset Value_constraint data member.
164  void ResetValue_constraint(void);
165 
166  /// Get the Value_constraint member data.
167  ///
168  /// @return
169  /// Reference to the member data.
170  const TValue_constraint& GetValue_constraint(void) const;
171 
172  /// Assign a value to Value_constraint data member.
173  ///
174  /// @param value
175  /// Value to assign
176  void SetValue_constraint(const TValue_constraint& value);
177  void SetValue_constraint(TValue_constraint&& value);
178 
179  /// Assign a value to Value_constraint data member.
180  ///
181  /// @return
182  /// Reference to the data value.
183  TValue_constraint& SetValue_constraint(void);
184 
185  /// Check if a value has been assigned to Invert_match data member.
186  ///
187  /// Data member Invert_match is optional with default false;
188  /// its type is defined as 'typedef bool TInvert_match'
189  /// @return
190  /// - true, if a value has been assigned.
191  /// - false, otherwise.
192  bool IsSetInvert_match(void) const;
193 
194  /// Check if it is safe to call GetInvert_match method.
195  ///
196  /// @return
197  /// - true, if the data member is getatable.
198  /// - false, otherwise.
199  bool CanGetInvert_match(void) const;
200 
201  /// Reset Invert_match data member.
202  void ResetInvert_match(void);
203 
204  /// Assign default value to Invert_match data member.
205  void SetDefaultInvert_match(void);
206 
207  /// Get the Invert_match member data.
208  ///
209  /// @return
210  /// Copy of the member data.
211  TInvert_match GetInvert_match(void) const;
212 
213  /// Assign a value to Invert_match data member.
214  ///
215  /// @param value
216  /// Value to assign
217  void SetInvert_match(TInvert_match value);
218 
219  /// Assign a value to Invert_match data member.
220  ///
221  /// @return
222  /// Reference to the data value.
223  TInvert_match& SetInvert_match(void);
224 
225  /// Check if a value has been assigned to Other_fields data member.
226  ///
227  /// Data member Other_fields is optional;
228  /// its type is defined as 'typedef CField_set TOther_fields'
229  /// @return
230  /// - true, if a value has been assigned.
231  /// - false, otherwise.
232  bool IsSetOther_fields(void) const;
233 
234  /// Check if it is safe to call GetOther_fields method.
235  ///
236  /// @return
237  /// - true, if the data member is getatable.
238  /// - false, otherwise.
239  bool CanGetOther_fields(void) const;
240 
241  /// Reset Other_fields data member.
242  void ResetOther_fields(void);
243 
244  /// Get the Other_fields member data.
245  ///
246  /// @return
247  /// Reference to the member data.
248  const TOther_fields& GetOther_fields(void) const;
249 
250  /// Assign a value to Other_fields data member.
251  ///
252  /// @param value
253  /// Reference to value.
254  void SetOther_fields(TOther_fields& value);
255 
256  /// Assign a value to Other_fields data member.
257  ///
258  /// @return
259  /// Reference to the data value.
260  TOther_fields& SetOther_fields(void);
261 
262  /// Check if a value has been assigned to Disallowed_fields data member.
263  ///
264  /// Data member Disallowed_fields is optional;
265  /// its type is defined as 'typedef CField_set TDisallowed_fields'
266  /// @return
267  /// - true, if a value has been assigned.
268  /// - false, otherwise.
269  bool IsSetDisallowed_fields(void) const;
270 
271  /// Check if it is safe to call GetDisallowed_fields method.
272  ///
273  /// @return
274  /// - true, if the data member is getatable.
275  /// - false, otherwise.
276  bool CanGetDisallowed_fields(void) const;
277 
278  /// Reset Disallowed_fields data member.
279  void ResetDisallowed_fields(void);
280 
281  /// Get the Disallowed_fields member data.
282  ///
283  /// @return
284  /// Reference to the member data.
285  const TDisallowed_fields& GetDisallowed_fields(void) const;
286 
287  /// Assign a value to Disallowed_fields data member.
288  ///
289  /// @param value
290  /// Reference to value.
291  void SetDisallowed_fields(TDisallowed_fields& value);
292 
293  /// Assign a value to Disallowed_fields data member.
294  ///
295  /// @return
296  /// Reference to the data value.
297  TDisallowed_fields& SetDisallowed_fields(void);
298 
299  /// Reset the whole object
300  virtual void Reset(void);
301 
302 
303 private:
304  // Prohibit copy constructor and assignment operator
307 
308  // data
309  Uint4 m_set_State[1];
310  string m_Match_name;
315 };
316 
317 /* @} */
318 
319 
320 
321 
322 
323 ///////////////////////////////////////////////////////////
324 ///////////////////// inline methods //////////////////////
325 ///////////////////////////////////////////////////////////
326 inline
328 {
329  return ((m_set_State[0] & 0x3) != 0);
330 }
331 
332 inline
334 {
335  return IsSetMatch_name();
336 }
337 
338 inline
340 {
341  if (!CanGetMatch_name()) {
342  ThrowUnassigned(0);
343  }
344  return m_Match_name;
345 }
346 
347 inline
349 {
351  m_set_State[0] |= 0x3;
352 }
353 
354 inline
356 {
357  m_Match_name = std::forward<CDependent_field_rule_Base::TMatch_name>(value);
358  m_set_State[0] |= 0x3;
359 }
360 
361 inline
363 {
364 #ifdef _DEBUG
365  if (!IsSetMatch_name()) {
367  }
368 #endif
369  m_set_State[0] |= 0x1;
370  return m_Match_name;
371 }
372 
373 inline
375 {
376  return ((m_set_State[0] & 0xc) != 0);
377 }
378 
379 inline
381 {
382  return IsSetValue_constraint();
383 }
384 
385 inline
387 {
388  if (!CanGetValue_constraint()) {
389  ThrowUnassigned(1);
390  }
391  return m_Value_constraint;
392 }
393 
394 inline
396 {
398  m_set_State[0] |= 0xc;
399 }
400 
401 inline
403 {
404  m_Value_constraint = std::forward<CDependent_field_rule_Base::TValue_constraint>(value);
405  m_set_State[0] |= 0xc;
406 }
407 
408 inline
410 {
411 #ifdef _DEBUG
412  if (!IsSetValue_constraint()) {
414  }
415 #endif
416  m_set_State[0] |= 0x4;
417  return m_Value_constraint;
418 }
419 
420 inline
422 {
423  return ((m_set_State[0] & 0x30) != 0);
424 }
425 
426 inline
428 {
429  return true;
430 }
431 
432 inline
434 {
435  m_Invert_match = false;
436  m_set_State[0] &= ~0x30;
437 }
438 
439 inline
441 {
443 }
444 
445 inline
447 {
448  return m_Invert_match;
449 }
450 
451 inline
453 {
455  m_set_State[0] |= 0x30;
456 }
457 
458 inline
460 {
461 #ifdef _DEBUG
462  if (!IsSetInvert_match()) {
463  memset(&m_Invert_match,UnassignedByte(),sizeof(m_Invert_match));
464  }
465 #endif
466  m_set_State[0] |= 0x10;
467  return m_Invert_match;
468 }
469 
470 inline
472 {
473  return m_Other_fields.NotEmpty();
474 }
475 
476 inline
478 {
479  return IsSetOther_fields();
480 }
481 
482 inline
484 {
485  if (!CanGetOther_fields()) {
486  ThrowUnassigned(3);
487  }
488  return (*m_Other_fields);
489 }
490 
491 inline
493 {
494  return m_Disallowed_fields.NotEmpty();
495 }
496 
497 inline
499 {
500  return IsSetDisallowed_fields();
501 }
502 
503 inline
505 {
506  if (!CanGetDisallowed_fields()) {
507  ThrowUnassigned(4);
508  }
509  return (*m_Disallowed_fields);
510 }
511 
512 ///////////////////////////////////////////////////////////
513 ////////////////// end of inline methods //////////////////
514 ///////////////////////////////////////////////////////////
515 
516 
517 
518 
519 
520 END_objects_SCOPE // namespace ncbi::objects::
521 
523 
524 
525 #endif // OBJECTS_VALID_DEPENDENT_FIELD_RULE_BASE_HPP
CDependent_field_rule_Base –.
CField_set –.
Definition: Field_set.hpp:66
CRef –.
Definition: ncbiobj.hpp:618
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
static string UnassignedString(void)
Definition: serialbase.hpp:175
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_VALID_EXPORT
Definition: ncbi_export.h:929
bool CanGetDisallowed_fields(void) const
Check if it is safe to call GetDisallowed_fields method.
TInvert_match & SetInvert_match(void)
Assign a value to Invert_match data member.
CDependent_field_rule_Base & operator=(const CDependent_field_rule_Base &)
const TMatch_name & GetMatch_name(void) const
Get the Match_name member data.
const TValue_constraint & GetValue_constraint(void) const
Get the Value_constraint member data.
const TDisallowed_fields & GetDisallowed_fields(void) const
Get the Disallowed_fields member data.
void SetDefaultInvert_match(void)
Assign default value to Invert_match data member.
bool IsSetMatch_name(void) const
Check if a value has been assigned to Match_name data member.
TMatch_name & SetMatch_name(void)
Assign a value to Match_name data member.
TValue_constraint & SetValue_constraint(void)
Assign a value to Value_constraint data member.
Tparent::CMemberIndex< E_memberIndex, 6 > TmemberIndex
bool IsSetValue_constraint(void) const
Check if a value has been assigned to Value_constraint data member.
bool CanGetMatch_name(void) const
Check if it is safe to call GetMatch_name method.
bool CanGetValue_constraint(void) const
Check if it is safe to call GetValue_constraint method.
bool CanGetInvert_match(void) const
Check if it is safe to call GetInvert_match method.
CRef< TDisallowed_fields > m_Disallowed_fields
bool IsSetInvert_match(void) const
Check if a value has been assigned to Invert_match data member.
const TOther_fields & GetOther_fields(void) const
Get the Other_fields member data.
void ResetInvert_match(void)
Reset Invert_match data member.
CRef< TOther_fields > m_Other_fields
bool CanGetOther_fields(void) const
Check if it is safe to call GetOther_fields method.
TInvert_match GetInvert_match(void) const
Get the Invert_match member data.
CDependent_field_rule_Base(const CDependent_field_rule_Base &)
bool IsSetOther_fields(void) const
Check if a value has been assigned to Other_fields data member.
bool IsSetDisallowed_fields(void) const
Check if a value has been assigned to Disallowed_fields data member.
Modified on Wed Mar 27 11:26:51 2024 by modify_doxy.py rev. 669887