NCBI C++ ToolKit
Conditional_.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 Conditional_.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/gui/objects/gui_objects.asn">gui_objects.asn</a>
34 /// and additional tune-up parameters:
35 /// <a href="/IEB/ToolBox/CPP_DOC/lxr/source/src/gui/objects/gui_objects.def">gui_objects.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 GUI_OBJECTS_CONDITIONAL_BASE_HPP
42 #define GUI_OBJECTS_CONDITIONAL_BASE_HPP
43 
44 // extra headers
45 #include <gui/gui_export.h>
46 
47 // standard includes
48 #include <serial/serialbase.hpp>
49 
50 // generated includes
51 #include <list>
52 #include <string>
53 
55 
56 #ifndef BEGIN_objects_SCOPE
57 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
58 # define END_objects_SCOPE END_SCOPE(objects)
59 #endif
60 BEGIN_objects_SCOPE // namespace ncbi::objects::
61 
62 
63 // generated classes
64 
65 
66 /** @addtogroup dataspec_NCBI_SeqGraphical
67  *
68  * @{
69  */
70 
71 /////////////////////////////////////////////////////////////////////////////
72 ///
73 /// CConditional_Base --
74 ///
75 
77 {
79 public:
80  // constructor
81  CConditional_Base(void);
82  // destructor
83  virtual ~CConditional_Base(void);
84 
85  // type info
87 
88  enum EAction {
89  eAction_enable = 0,
90  eAction_disable = 1
91  };
92 
93  /// Access to EAction's attributes (values, names) as defined in spec
94  static const NCBI_NS_NCBI::CEnumeratedTypeValues* ENUM_METHOD_NAME(EAction)(void);
95 
96  // types
97  typedef string TName;
98  typedef list< string > TValue;
99  typedef EAction TAction;
100 
101  // member index
102  enum class E_memberIndex {
103  e__allMandatory = 0,
104  e_name,
105  e_value,
106  e_action
107  };
109 
110  // getters
111  // setters
112 
113  /// conditional control name
114  /// Check if a value has been assigned to Name data member.
115  ///
116  /// Data member Name is mandatory;
117  /// its type is defined as 'typedef string TName'
118  /// @return
119  /// - true, if a value has been assigned.
120  /// - false, otherwise.
121  bool IsSetName(void) const;
122 
123  /// Check if it is safe to call GetName method.
124  ///
125  /// @return
126  /// - true, if the data member is getatable.
127  /// - false, otherwise.
128  bool CanGetName(void) const;
129 
130  /// Reset Name data member.
131  void ResetName(void);
132 
133  /// Get the Name member data.
134  ///
135  /// @return
136  /// Reference to the member data.
137  const TName& GetName(void) const;
138 
139  /// Assign a value to Name data member.
140  ///
141  /// @param value
142  /// Value to assign
143  void SetName(const TName& value);
144  void SetName(TName&& value);
145 
146  /// Assign a value to Name data member.
147  ///
148  /// @return
149  /// Reference to the data value.
150  TName& SetName(void);
151 
152  /// conditional control value
153  /// Check if a value has been assigned to Value data member.
154  ///
155  /// Data member Value is mandatory;
156  /// its type is defined as 'typedef list< string > TValue'
157  /// @return
158  /// - true, if a value has been assigned.
159  /// - false, otherwise.
160  bool IsSetValue(void) const;
161 
162  /// Check if it is safe to call GetValue method.
163  ///
164  /// @return
165  /// - true, if the data member is getatable.
166  /// - false, otherwise.
167  bool CanGetValue(void) const;
168 
169  /// Reset Value data member.
170  void ResetValue(void);
171 
172  /// Get the Value member data.
173  ///
174  /// @return
175  /// Reference to the member data.
176  const TValue& GetValue(void) const;
177 
178  /// Assign a value to Value data member.
179  ///
180  /// @return
181  /// Reference to the data value.
182  TValue& SetValue(void);
183 
184  /// Check if a value has been assigned to Action data member.
185  ///
186  /// Data member Action is optional with default eAction_enable;
187  /// its type is defined as 'typedef EAction TAction'
188  /// @return
189  /// - true, if a value has been assigned.
190  /// - false, otherwise.
191  bool IsSetAction(void) const;
192 
193  /// Check if it is safe to call GetAction method.
194  ///
195  /// @return
196  /// - true, if the data member is getatable.
197  /// - false, otherwise.
198  bool CanGetAction(void) const;
199 
200  /// Reset Action data member.
201  void ResetAction(void);
202 
203  /// Assign default value to Action data member.
204  void SetDefaultAction(void);
205 
206  /// Get the Action member data.
207  ///
208  /// @return
209  /// Copy of the member data.
210  TAction GetAction(void) const;
211 
212  /// Assign a value to Action data member.
213  ///
214  /// @param value
215  /// Value to assign
216  void SetAction(TAction value);
217 
218  /// Assign a value to Action data member.
219  ///
220  /// @return
221  /// Reference to the data value.
222  TAction& SetAction(void);
223 
224  /// Reset the whole object
225  virtual void Reset(void);
226 
227 
228 private:
229  // Prohibit copy constructor and assignment operator
232 
233  // data
234  Uint4 m_set_State[1];
235  string m_Name;
236  list< string > m_Value;
238 };
239 
240 /* @} */
241 
242 
243 
244 
245 
246 ///////////////////////////////////////////////////////////
247 ///////////////////// inline methods //////////////////////
248 ///////////////////////////////////////////////////////////
249 inline
251 {
252  return ((m_set_State[0] & 0x3) != 0);
253 }
254 
255 inline
257 {
258  return IsSetName();
259 }
260 
261 inline
263 {
264  if (!CanGetName()) {
265  ThrowUnassigned(0);
266  }
267  return m_Name;
268 }
269 
270 inline
272 {
273  m_Name = value;
274  m_set_State[0] |= 0x3;
275 }
276 
277 inline
279 {
280  m_Name = std::forward<CConditional_Base::TName>(value);
281  m_set_State[0] |= 0x3;
282 }
283 
284 inline
286 {
287 #ifdef _DEBUG
288  if (!IsSetName()) {
290  }
291 #endif
292  m_set_State[0] |= 0x1;
293  return m_Name;
294 }
295 
296 inline
298 {
299  return ((m_set_State[0] & 0xc) != 0);
300 }
301 
302 inline
304 {
305  return true;
306 }
307 
308 inline
310 {
311  return m_Value;
312 }
313 
314 inline
316 {
317  m_set_State[0] |= 0x4;
318  return m_Value;
319 }
320 
321 inline
323 {
324  return ((m_set_State[0] & 0x30) != 0);
325 }
326 
327 inline
329 {
330  return true;
331 }
332 
333 inline
335 {
337  m_set_State[0] &= ~0x30;
338 }
339 
340 inline
342 {
343  ResetAction();
344 }
345 
346 inline
348 {
349  return m_Action;
350 }
351 
352 inline
354 {
355  m_Action = value;
356  m_set_State[0] |= 0x30;
357 }
358 
359 inline
361 {
362 #ifdef _DEBUG
363  if (!IsSetAction()) {
364  memset(&m_Action,UnassignedByte(),sizeof(m_Action));
365  }
366 #endif
367  m_set_State[0] |= 0x10;
368  return m_Action;
369 }
370 
371 ///////////////////////////////////////////////////////////
372 ////////////////// end of inline methods //////////////////
373 ///////////////////////////////////////////////////////////
374 
375 
376 
377 
378 
379 END_objects_SCOPE // namespace ncbi::objects::
380 
382 
383 
384 #endif // GUI_OBJECTS_CONDITIONAL_BASE_HPP
CConditional_Base –.
Base class for all serializable objects.
Definition: serialbase.hpp:150
static char UnassignedByte(void)
Definition: serialbase.hpp:181
void ThrowUnassigned(TMemberIndex index) const
#define ENUM_METHOD_NAME(EnumName)
Definition: serialbase.hpp:994
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_GUIOBJECTS_EXPORT
Definition: gui_export.h:511
TName & SetName(void)
Assign a value to Name data member.
bool IsSetName(void) const
conditional control name Check if a value has been assigned to Name data member.
bool CanGetAction(void) const
Check if it is safe to call GetAction method.
TAction & SetAction(void)
Assign a value to Action data member.
bool IsSetValue(void) const
conditional control value Check if a value has been assigned to Value data member.
CConditional_Base & operator=(const CConditional_Base &)
const TName & GetName(void) const
Get the Name member data.
TValue & SetValue(void)
Assign a value to Value data member.
CConditional_Base(const CConditional_Base &)
Tparent::CMemberIndex< E_memberIndex, 4 > TmemberIndex
CSerialObject Tparent
list< string > m_Value
void ResetAction(void)
Reset Action data member.
TAction GetAction(void) const
Get the Action member data.
bool CanGetValue(void) const
Check if it is safe to call GetValue method.
const TValue & GetValue(void) const
Get the Value member data.
bool CanGetName(void) const
Check if it is safe to call GetName method.
void SetDefaultAction(void)
Assign default value to Action data member.
list< string > TValue
bool IsSetAction(void) const
Check if a value has been assigned to Action data member.
Defines to provide correct exporting from DLLs in Windows.
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Wed Sep 04 15:05:07 2024 by modify_doxy.py rev. 669887