NCBI C++ ToolKit
PluginValue_.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 PluginValue_.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_PLUGINVALUE_BASE_HPP
42 #define GUI_OBJECTS_PLUGINVALUE_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 <string>
52 
54 
55 #ifndef BEGIN_objects_SCOPE
56 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
57 # define END_objects_SCOPE END_SCOPE(objects)
58 #endif
59 BEGIN_objects_SCOPE // namespace ncbi::objects::
60 
61 
62 // forward declarations
63 class CPluginObject;
64 
65 
66 // generated classes
67 
68 
69 /** @addtogroup dataspec_NCBI_Plugin
70  *
71  * @{
72  */
73 
74 /////////////////////////////////////////////////////////////////////////////
75 ///-
76 ///- PluginValue variant
77 ///-
78 ///
79 /// CPluginValue_Base --
80 ///
81 
83 {
85 public:
86  // constructor
87  CPluginValue_Base(void);
88  // destructor
89  virtual ~CPluginValue_Base(void);
90 
91  // type info
93 
94 
95  /// Choice variants.
96  enum E_Choice {
97  e_not_set = 0, ///< No variant selected
107  e_Object
108  };
109  /// Maximum+1 value of the choice variant enumerator.
111  e_MaxChoice = 11 ///< == e_Object+1
112  };
113 
114  /// Reset the whole object
115  virtual void Reset(void);
116 
117  /// Reset the selection (set it to e_not_set).
118  virtual void ResetSelection(void);
119 
120  /// Which variant is currently selected.
121  ///
122  /// @return
123  /// Choice state enumerator.
124  E_Choice Which(void) const;
125 
126  /// Verify selection, throw exception if it differs from the expected.
127  ///
128  /// @param index
129  /// Expected selection.
130  void CheckSelected(E_Choice index) const;
131 
132  /// Throw 'InvalidSelection' exception.
133  ///
134  /// @param index
135  /// Expected selection.
136  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
137 
138  /// Retrieve selection name (for diagnostic purposes).
139  ///
140  /// @param index
141  /// One of possible selection states.
142  /// @return
143  /// Name string.
144  static string SelectionName(E_Choice index);
145 
146  /// Select the requested variant if needed.
147  ///
148  /// @param index
149  /// New selection state.
150  /// @param reset
151  /// Flag that defines the resetting of the variant data. The data will
152  /// be reset if either the current selection differs from the new one,
153  /// or the flag is set to eDoResetVariant.
155  /// Select the requested variant if needed,
156  /// allocating CObject variants from memory pool.
157  void Select(E_Choice index,
158  EResetVariant reset,
159  CObjectMemoryPool* pool);
160 
161  // types
162  typedef string TInteger;
163  typedef string TDouble;
164  typedef string TString;
165  typedef string TSecret_string;
166  typedef string TInput_file;
167  typedef string TOutput_file;
168  typedef string TBoolean;
172 
173  // getters
174  // setters
175 
176 
177  /// Check if variant Integer is selected.
178  ///
179  /// Integer type is defined as 'typedef string TInteger'.
180  /// @return
181  /// - true, if the variant is selected.
182  /// - false, otherwise.
183  bool IsInteger(void) const;
184 
185  /// Get the variant data.
186  ///
187  /// @return
188  /// Reference to the data.
189  const TInteger& GetInteger(void) const;
190 
191  /// Select the variant.
192  ///
193  /// @return
194  /// Reference to the variant data.
195  TInteger& SetInteger(void);
196 
197  /// Select the variant and set its data.
198  ///
199  /// @param value
200  /// Variant data.
201  void SetInteger(const TInteger& value);
202 
203 
204  /// Check if variant Double is selected.
205  ///
206  /// Double type is defined as 'typedef string TDouble'.
207  /// @return
208  /// - true, if the variant is selected.
209  /// - false, otherwise.
210  bool IsDouble(void) const;
211 
212  /// Get the variant data.
213  ///
214  /// @return
215  /// Reference to the data.
216  const TDouble& GetDouble(void) const;
217 
218  /// Select the variant.
219  ///
220  /// @return
221  /// Reference to the variant data.
222  TDouble& SetDouble(void);
223 
224  /// Select the variant and set its data.
225  ///
226  /// @param value
227  /// Variant data.
228  void SetDouble(const TDouble& value);
229 
230 
231  /// Check if variant String is selected.
232  ///
233  /// String type is defined as 'typedef string TString'.
234  /// @return
235  /// - true, if the variant is selected.
236  /// - false, otherwise.
237  bool IsString(void) const;
238 
239  /// Get the variant data.
240  ///
241  /// @return
242  /// Reference to the data.
243  const TString& GetString(void) const;
244 
245  /// Select the variant.
246  ///
247  /// @return
248  /// Reference to the variant data.
249  TString& SetString(void);
250 
251  /// Select the variant and set its data.
252  ///
253  /// @param value
254  /// Variant data.
255  void SetString(const TString& value);
256 
257 
258  /// Check if variant Secret_string is selected.
259  ///
260  /// Secret_string type is defined as 'typedef string TSecret_string'.
261  /// @return
262  /// - true, if the variant is selected.
263  /// - false, otherwise.
264  bool IsSecret_string(void) const;
265 
266  /// Get the variant data.
267  ///
268  /// @return
269  /// Reference to the data.
270  const TSecret_string& GetSecret_string(void) const;
271 
272  /// Select the variant.
273  ///
274  /// @return
275  /// Reference to the variant data.
276  TSecret_string& SetSecret_string(void);
277 
278  /// Select the variant and set its data.
279  ///
280  /// @param value
281  /// Variant data.
282  void SetSecret_string(const TSecret_string& value);
283 
284 
285  /// Check if variant Input_file is selected.
286  ///
287  /// Input_file type is defined as 'typedef string TInput_file'.
288  /// @return
289  /// - true, if the variant is selected.
290  /// - false, otherwise.
291  bool IsInput_file(void) const;
292 
293  /// Get the variant data.
294  ///
295  /// @return
296  /// Reference to the data.
297  const TInput_file& GetInput_file(void) const;
298 
299  /// Select the variant.
300  ///
301  /// @return
302  /// Reference to the variant data.
303  TInput_file& SetInput_file(void);
304 
305  /// Select the variant and set its data.
306  ///
307  /// @param value
308  /// Variant data.
309  void SetInput_file(const TInput_file& value);
310 
311 
312  /// Check if variant Output_file is selected.
313  ///
314  /// Output_file type is defined as 'typedef string TOutput_file'.
315  /// @return
316  /// - true, if the variant is selected.
317  /// - false, otherwise.
318  bool IsOutput_file(void) const;
319 
320  /// Get the variant data.
321  ///
322  /// @return
323  /// Reference to the data.
324  const TOutput_file& GetOutput_file(void) const;
325 
326  /// Select the variant.
327  ///
328  /// @return
329  /// Reference to the variant data.
330  TOutput_file& SetOutput_file(void);
331 
332  /// Select the variant and set its data.
333  ///
334  /// @param value
335  /// Variant data.
336  void SetOutput_file(const TOutput_file& value);
337 
338 
339  /// Check if variant Boolean is selected.
340  ///
341  /// Boolean type is defined as 'typedef string TBoolean'.
342  /// @return
343  /// - true, if the variant is selected.
344  /// - false, otherwise.
345  bool IsBoolean(void) const;
346 
347  /// Get the variant data.
348  ///
349  /// @return
350  /// Reference to the data.
351  const TBoolean& GetBoolean(void) const;
352 
353  /// Select the variant.
354  ///
355  /// @return
356  /// Reference to the variant data.
357  TBoolean& SetBoolean(void);
358 
359  /// Select the variant and set its data.
360  ///
361  /// @param value
362  /// Variant data.
363  void SetBoolean(const TBoolean& value);
364 
365 
366  /// Check if variant Project is selected.
367  ///
368  /// Project type is defined as 'typedef CPluginObject TProject'.
369  /// @return
370  /// - true, if the variant is selected.
371  /// - false, otherwise.
372  bool IsProject(void) const;
373 
374  /// Get the variant data.
375  ///
376  /// @return
377  /// Reference to the data.
378  const TProject& GetProject(void) const;
379 
380  /// Select the variant.
381  ///
382  /// @return
383  /// Reference to the variant data.
384  TProject& SetProject(void);
385  /// Select the variant and set its data.
386  ///
387  /// @param value
388  /// Reference to the data.
389  void SetProject(TProject& value);
390 
391 
392  /// Check if variant DataHandle is selected.
393  ///
394  /// DataHandle type is defined as 'typedef CPluginObject TDataHandle'.
395  /// @return
396  /// - true, if the variant is selected.
397  /// - false, otherwise.
398  bool IsDataHandle(void) const;
399 
400  /// Get the variant data.
401  ///
402  /// @return
403  /// Reference to the data.
404  const TDataHandle& GetDataHandle(void) const;
405 
406  /// Select the variant.
407  ///
408  /// @return
409  /// Reference to the variant data.
410  TDataHandle& SetDataHandle(void);
411  /// Select the variant and set its data.
412  ///
413  /// @param value
414  /// Reference to the data.
415  void SetDataHandle(TDataHandle& value);
416 
417 
418  /// Check if variant Object is selected.
419  ///
420  /// Object type is defined as 'typedef CPluginObject TObject'.
421  /// @return
422  /// - true, if the variant is selected.
423  /// - false, otherwise.
424  bool IsObject(void) const;
425 
426  /// Get the variant data.
427  ///
428  /// @return
429  /// Reference to the data.
430  const TObject& GetObject(void) const;
431 
432  /// Select the variant.
433  ///
434  /// @return
435  /// Reference to the variant data.
436  TObject& SetObject(void);
437  /// Select the variant and set its data.
438  ///
439  /// @param value
440  /// Reference to the data.
441  void SetObject(TObject& value);
442 
443 
444 private:
445  // copy constructor and assignment operator
448  // choice state
450  // helper methods
451  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
452 
453  static const char* const sm_SelectionNames[];
454  // data
455  union {
456  NCBI_NS_NCBI::CUnionBuffer<NCBI_NS_STD::string> m_string;
457  NCBI_NS_NCBI::CSerialObject *m_object;
458  };
459 };
460 
461 /* @} */
462 
463 
464 
465 
466 
467 ///////////////////////////////////////////////////////////
468 ///////////////////// inline methods //////////////////////
469 ///////////////////////////////////////////////////////////
470 inline
472 {
473  return m_choice;
474 }
475 
476 inline
478 {
479  if ( m_choice != index )
480  ThrowInvalidSelection(index);
481 }
482 
483 inline
484 void CPluginValue_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
485 {
486  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
487  if ( m_choice != e_not_set )
488  ResetSelection();
489  DoSelect(index, pool);
490  }
491 }
492 
493 inline
494 void CPluginValue_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset)
495 {
496  Select(index, reset, 0);
497 }
498 
499 inline
501 {
502  return m_choice == e_Integer;
503 }
504 
505 inline
507 {
509  return *m_string;
510 }
511 
512 inline
514 {
516  return *m_string;
517 }
518 
519 inline
521 {
522  return m_choice == e_Double;
523 }
524 
525 inline
527 {
529  return *m_string;
530 }
531 
532 inline
534 {
536  return *m_string;
537 }
538 
539 inline
541 {
542  return m_choice == e_String;
543 }
544 
545 inline
547 {
549  return *m_string;
550 }
551 
552 inline
554 {
556  return *m_string;
557 }
558 
559 inline
561 {
562  return m_choice == e_Secret_string;
563 }
564 
565 inline
567 {
569  return *m_string;
570 }
571 
572 inline
574 {
576  return *m_string;
577 }
578 
579 inline
581 {
582  return m_choice == e_Input_file;
583 }
584 
585 inline
587 {
589  return *m_string;
590 }
591 
592 inline
594 {
596  return *m_string;
597 }
598 
599 inline
601 {
602  return m_choice == e_Output_file;
603 }
604 
605 inline
607 {
609  return *m_string;
610 }
611 
612 inline
614 {
616  return *m_string;
617 }
618 
619 inline
621 {
622  return m_choice == e_Boolean;
623 }
624 
625 inline
627 {
629  return *m_string;
630 }
631 
632 inline
634 {
636  return *m_string;
637 }
638 
639 inline
641 {
642  return m_choice == e_Project;
643 }
644 
645 inline
647 {
648  return m_choice == e_DataHandle;
649 }
650 
651 inline
653 {
654  return m_choice == e_Object;
655 }
656 
657 ///////////////////////////////////////////////////////////
658 ////////////////// end of inline methods //////////////////
659 ///////////////////////////////////////////////////////////
660 
661 
662 
663 
664 
665 END_objects_SCOPE // namespace ncbi::objects::
666 
668 
669 
670 #endif // GUI_OBJECTS_PLUGINVALUE_BASE_HPP
namespace ncbi::objects::
Base class for all serializable objects.
Definition: serialbase.hpp:150
EResetVariant
Definition: serialbase.hpp:76
@ eDoResetVariant
Definition: serialbase.hpp:77
@ eDoNotResetVariant
Definition: serialbase.hpp:78
#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
bool IsBoolean(void) const
Check if variant Boolean is selected.
bool IsDouble(void) const
Check if variant Double is selected.
TOutput_file & SetOutput_file(void)
Select the variant.
NCBI_NS_NCBI::CSerialObject * m_object
CPluginObject TObject
const TInteger & GetInteger(void) const
Get the variant data.
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
bool IsSecret_string(void) const
Check if variant Secret_string is selected.
bool IsInput_file(void) const
Check if variant Input_file is selected.
const TDouble & GetDouble(void) const
Get the variant data.
bool IsObject(void) const
Check if variant Object is selected.
E_Choice Which(void) const
Which variant is currently selected.
const TString & GetString(void) const
Get the variant data.
const TSecret_string & GetSecret_string(void) const
Get the variant data.
CSerialObject Tparent
TSecret_string & SetSecret_string(void)
Select the variant.
bool IsProject(void) const
Check if variant Project is selected.
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
NCBI_NS_NCBI::CUnionBuffer< NCBI_NS_STD::string > m_string
bool IsString(void) const
Check if variant String is selected.
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
TBoolean & SetBoolean(void)
Select the variant.
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
CPluginValue_Base(const CPluginValue_Base &)
TString & SetString(void)
Select the variant.
const TInput_file & GetInput_file(void) const
Get the variant data.
void Select(E_Choice index, EResetVariant reset, CObjectMemoryPool *pool)
Select the requested variant if needed, allocating CObject variants from memory pool.
CPluginObject TProject
NCBI_NS_NCBI::CUnionBuffer< NCBI_NS_STD::string > m_string
CPluginValue_Base & operator=(const CPluginValue_Base &)
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
TInput_file & SetInput_file(void)
Select the variant.
TDouble & SetDouble(void)
Select the variant.
E_Choice
Choice variants.
const TBoolean & GetBoolean(void) const
Get the variant data.
const TOutput_file & GetOutput_file(void) const
Get the variant data.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
bool IsOutput_file(void) const
Check if variant Output_file is selected.
TInteger & SetInteger(void)
Select the variant.
bool IsDataHandle(void) const
Check if variant DataHandle is selected.
bool IsInteger(void) const
Check if variant Integer is selected.
CPluginObject TDataHandle
@ e_not_set
No variant selected.
Defines to provide correct exporting from DLLs in Windows.
@ e_not_set
CProject * GetProject(wxTreeCtrl &treeCtrl, const CItem &item)
Definition: pt_utils.cpp:77
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
static bool SetInteger(wxSpinCtrl *spinctrl, int value)
static bool GetInteger(wxSpinCtrl *spinctrl, int *value)
Modified on Wed Apr 17 13:10:07 2024 by modify_doxy.py rev. 669887