NCBI C++ ToolKit
Mim_text_.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 Mim_text_.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/mim/mim.asn">mim.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/objects/mim/mim.def">mim.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_MIM_MIM_TEXT_BASE_HPP
42 #define OBJECTS_MIM_MIM_TEXT_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 CMim_link;
61 
62 
63 // generated classes
64 
65 
66 /** @addtogroup dataspec_NCBI_Mim
67  *
68  * @{
69  */
70 
71 /////////////////////////////////////////////////////////////////////////////
72 ///
73 /// CMim_text_Base --
74 ///
75 
77 {
79 public:
80  // constructor
81  CMim_text_Base(void);
82  // destructor
83  virtual ~CMim_text_Base(void);
84 
85  // type info
87 
88  // types
89  typedef string TLabel;
90  typedef string TText;
92 
93  // member index
94  enum class E_memberIndex {
95  e__allMandatory = 0,
96  e_label,
97  e_text,
98  e_neighbors
99  };
101 
102  // getters
103  // setters
104 
105  /// Check if a value has been assigned to Label data member.
106  ///
107  /// Data member Label is mandatory;
108  /// its type is defined as 'typedef string TLabel'
109  /// @return
110  /// - true, if a value has been assigned.
111  /// - false, otherwise.
112  bool IsSetLabel(void) const;
113 
114  /// Check if it is safe to call GetLabel method.
115  ///
116  /// @return
117  /// - true, if the data member is getatable.
118  /// - false, otherwise.
119  bool CanGetLabel(void) const;
120 
121  /// Reset Label data member.
122  void ResetLabel(void);
123 
124  /// Get the Label member data.
125  ///
126  /// @return
127  /// Reference to the member data.
128  const TLabel& GetLabel(void) const;
129 
130  /// Assign a value to Label data member.
131  ///
132  /// @param value
133  /// Value to assign
134  void SetLabel(const TLabel& value);
135  void SetLabel(TLabel&& value);
136 
137  /// Assign a value to Label data member.
138  ///
139  /// @return
140  /// Reference to the data value.
141  TLabel& SetLabel(void);
142 
143  /// Check if a value has been assigned to Text data member.
144  ///
145  /// Data member Text is mandatory;
146  /// its type is defined as 'typedef string TText'
147  /// @return
148  /// - true, if a value has been assigned.
149  /// - false, otherwise.
150  bool IsSetText(void) const;
151 
152  /// Check if it is safe to call GetText method.
153  ///
154  /// @return
155  /// - true, if the data member is getatable.
156  /// - false, otherwise.
157  bool CanGetText(void) const;
158 
159  /// Reset Text data member.
160  void ResetText(void);
161 
162  /// Get the Text member data.
163  ///
164  /// @return
165  /// Reference to the member data.
166  const TText& GetText(void) const;
167 
168  /// Assign a value to Text data member.
169  ///
170  /// @param value
171  /// Value to assign
172  void SetText(const TText& value);
173  void SetText(TText&& value);
174 
175  /// Assign a value to Text data member.
176  ///
177  /// @return
178  /// Reference to the data value.
179  TText& SetText(void);
180 
181  /// Check if a value has been assigned to Neighbors data member.
182  ///
183  /// Data member Neighbors is optional;
184  /// its type is defined as 'typedef CMim_link TNeighbors'
185  /// @return
186  /// - true, if a value has been assigned.
187  /// - false, otherwise.
188  bool IsSetNeighbors(void) const;
189 
190  /// Check if it is safe to call GetNeighbors method.
191  ///
192  /// @return
193  /// - true, if the data member is getatable.
194  /// - false, otherwise.
195  bool CanGetNeighbors(void) const;
196 
197  /// Reset Neighbors data member.
198  void ResetNeighbors(void);
199 
200  /// Get the Neighbors member data.
201  ///
202  /// @return
203  /// Reference to the member data.
204  const TNeighbors& GetNeighbors(void) const;
205 
206  /// Assign a value to Neighbors data member.
207  ///
208  /// @param value
209  /// Reference to value.
210  void SetNeighbors(TNeighbors& value);
211 
212  /// Assign a value to Neighbors data member.
213  ///
214  /// @return
215  /// Reference to the data value.
216  TNeighbors& SetNeighbors(void);
217 
218  /// Reset the whole object
219  virtual void Reset(void);
220 
221 
222 private:
223  // Prohibit copy constructor and assignment operator
226 
227  // data
228  Uint4 m_set_State[1];
229  string m_Label;
230  string m_Text;
232 };
233 
234 /* @} */
235 
236 
237 
238 
239 
240 ///////////////////////////////////////////////////////////
241 ///////////////////// inline methods //////////////////////
242 ///////////////////////////////////////////////////////////
243 inline
245 {
246  return ((m_set_State[0] & 0x3) != 0);
247 }
248 
249 inline
251 {
252  return IsSetLabel();
253 }
254 
255 inline
257 {
258  if (!CanGetLabel()) {
259  ThrowUnassigned(0);
260  }
261  return m_Label;
262 }
263 
264 inline
266 {
267  m_Label = value;
268  m_set_State[0] |= 0x3;
269 }
270 
271 inline
273 {
274  m_Label = std::forward<CMim_text_Base::TLabel>(value);
275  m_set_State[0] |= 0x3;
276 }
277 
278 inline
280 {
281 #ifdef _DEBUG
282  if (!IsSetLabel()) {
284  }
285 #endif
286  m_set_State[0] |= 0x1;
287  return m_Label;
288 }
289 
290 inline
292 {
293  return ((m_set_State[0] & 0xc) != 0);
294 }
295 
296 inline
298 {
299  return IsSetText();
300 }
301 
302 inline
304 {
305  if (!CanGetText()) {
306  ThrowUnassigned(1);
307  }
308  return m_Text;
309 }
310 
311 inline
313 {
314  m_Text = value;
315  m_set_State[0] |= 0xc;
316 }
317 
318 inline
320 {
321  m_Text = std::forward<CMim_text_Base::TText>(value);
322  m_set_State[0] |= 0xc;
323 }
324 
325 inline
327 {
328 #ifdef _DEBUG
329  if (!IsSetText()) {
331  }
332 #endif
333  m_set_State[0] |= 0x4;
334  return m_Text;
335 }
336 
337 inline
339 {
340  return m_Neighbors.NotEmpty();
341 }
342 
343 inline
345 {
346  return IsSetNeighbors();
347 }
348 
349 inline
351 {
352  if (!CanGetNeighbors()) {
353  ThrowUnassigned(2);
354  }
355  return (*m_Neighbors);
356 }
357 
358 ///////////////////////////////////////////////////////////
359 ////////////////// end of inline methods //////////////////
360 ///////////////////////////////////////////////////////////
361 
362 
363 
364 
365 
366 END_objects_SCOPE // namespace ncbi::objects::
367 
369 
370 
371 #endif // OBJECTS_MIM_MIM_TEXT_BASE_HPP
CMim_text_Base –.
Definition: Mim_text_.hpp:77
CRef –.
Definition: ncbiobj.hpp:618
Base class for all serializable objects.
Definition: serialbase.hpp:150
void ThrowUnassigned(TMemberIndex index) const
static string UnassignedString(void)
Definition: serialbase.hpp:175
string GetLabel(const CSeq_id &id)
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_MIM_EXPORT
Definition: ncbi_export.h:608
CMim_link TNeighbors
Definition: Mim_text_.hpp:91
Uint4 m_set_State[1]
Definition: Mim_text_.hpp:228
bool CanGetText(void) const
Check if it is safe to call GetText method.
Definition: Mim_text_.hpp:297
CMim_text_Base(const CMim_text_Base &)
bool CanGetNeighbors(void) const
Check if it is safe to call GetNeighbors method.
Definition: Mim_text_.hpp:344
TLabel & SetLabel(void)
Assign a value to Label data member.
Definition: Mim_text_.hpp:279
DECLARE_INTERNAL_TYPE_INFO()
bool IsSetNeighbors(void) const
Check if a value has been assigned to Neighbors data member.
Definition: Mim_text_.hpp:338
const TNeighbors & GetNeighbors(void) const
Get the Neighbors member data.
Definition: Mim_text_.hpp:350
Tparent::CMemberIndex< E_memberIndex, 4 > TmemberIndex
Definition: Mim_text_.hpp:100
bool CanGetLabel(void) const
Check if it is safe to call GetLabel method.
Definition: Mim_text_.hpp:250
const TText & GetText(void) const
Get the Text member data.
Definition: Mim_text_.hpp:303
bool IsSetText(void) const
Check if a value has been assigned to Text data member.
Definition: Mim_text_.hpp:291
CSerialObject Tparent
Definition: Mim_text_.hpp:78
TText & SetText(void)
Assign a value to Text data member.
Definition: Mim_text_.hpp:326
CMim_text_Base & operator=(const CMim_text_Base &)
bool IsSetLabel(void) const
Check if a value has been assigned to Label data member.
Definition: Mim_text_.hpp:244
const TLabel & GetLabel(void) const
Get the Label member data.
Definition: Mim_text_.hpp:256
CRef< TNeighbors > m_Neighbors
Definition: Mim_text_.hpp:231
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Sat May 25 14:15:39 2024 by modify_doxy.py rev. 669887