NCBI C++ ToolKit
PluginReplyAction_.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 PluginReplyAction_.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_PLUGINREPLYACTION_BASE_HPP
42 #define GUI_OBJECTS_PLUGINREPLYACTION_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 CGBProjectHandle;
64 class CPluginMRUEntry;
65 
66 
67 // generated classes
68 
69 
70 /** @addtogroup dataspec_NCBI_Plugin
71  *
72  * @{
73  */
74 
75 /////////////////////////////////////////////////////////////////////////////
76 ///-
77 ///- PluginReplyAction lists possible modes of action for the items returned
78 ///- from a plugin
79 ///-
80 ///
81 /// CPluginReplyAction_Base --
82 ///
83 
85 {
87 public:
88  // constructor
90  // destructor
91  virtual ~CPluginReplyAction_Base(void);
92 
93  // type info
95 
96 
97  /// Choice variants.
98  enum E_Choice {
99  e_not_set = 0, ///< No variant selected
100  e_Add_to_project, ///< add this item to the associated project
101  e_New_view, ///< launch a view named by the supplied argument
102  e_New_composite_view, ///< launch a view named by the supplied argument
103  e_Store, ///< store this object for future use The string parameter is used as a caller-defined key for retrieval
104  e_Create_project, ///< create an empty project(s) for Raw item(s), takes plugin param as argument
105  e_Create_single_project, ///< create single project for any number of Raw items
106  e_Attach_project, ///< attach loaded project to Project Manager
107  e_Refresh_project, ///< refresh loaded project to Project Manager
108  e_Add_to_MRU, ///<a dd an entry to the MRU list
109  e_Error, ///< show an error message
110  e_Plugin_cmd_run, ///< execute 'run' on a named plugin with our results
111  e_Register_interface, ///< register object created by the plugin
112  e_Warning, ///< report a warning to the user
113  e_Info ///< report an info-level message to the user
114  };
115  /// Maximum+1 value of the choice variant enumerator.
117  e_MaxChoice = 15 ///< == e_Info+1
118  };
119 
120  /// Reset the whole object
121  virtual void Reset(void);
122 
123  /// Reset the selection (set it to e_not_set).
124  virtual void ResetSelection(void);
125 
126  /// Which variant is currently selected.
127  ///
128  /// @return
129  /// Choice state enumerator.
130  E_Choice Which(void) const;
131 
132  /// Verify selection, throw exception if it differs from the expected.
133  ///
134  /// @param index
135  /// Expected selection.
136  void CheckSelected(E_Choice index) const;
137 
138  /// Throw 'InvalidSelection' exception.
139  ///
140  /// @param index
141  /// Expected selection.
142  NCBI_NORETURN void ThrowInvalidSelection(E_Choice index) const;
143 
144  /// Retrieve selection name (for diagnostic purposes).
145  ///
146  /// @param index
147  /// One of possible selection states.
148  /// @return
149  /// Name string.
150  static string SelectionName(E_Choice index);
151 
152  /// Select the requested variant if needed.
153  ///
154  /// @param index
155  /// New selection state.
156  /// @param reset
157  /// Flag that defines the resetting of the variant data. The data will
158  /// be reset if either the current selection differs from the new one,
159  /// or the flag is set to eDoResetVariant.
161  /// Select the requested variant if needed,
162  /// allocating CObject variants from memory pool.
163  void Select(E_Choice index,
164  EResetVariant reset,
165  CObjectMemoryPool* pool);
166 
167  // types
168  typedef string TNew_view;
169  typedef string TNew_composite_view;
170  typedef string TStore;
171  typedef string TCreate_project;
172  typedef string TCreate_single_project;
176  typedef string TError;
177  typedef string TPlugin_cmd_run;
178  typedef string TWarning;
179  typedef string TInfo;
180 
181  // getters
182  // setters
183 
184 
185  /// Check if variant Add_to_project is selected.
186  ///
187  /// @return
188  /// - true, if the variant is selected.
189  /// - false, otherwise.
190  bool IsAdd_to_project(void) const;
191 
192  /// Select the variant.
193  void SetAdd_to_project(void);
194 
195 
196  /// Check if variant New_view is selected.
197  ///
198  /// New_view type is defined as 'typedef string TNew_view'.
199  /// @return
200  /// - true, if the variant is selected.
201  /// - false, otherwise.
202  bool IsNew_view(void) const;
203 
204  /// Get the variant data.
205  ///
206  /// @return
207  /// Reference to the data.
208  const TNew_view& GetNew_view(void) const;
209 
210  /// Select the variant.
211  ///
212  /// @return
213  /// Reference to the variant data.
214  TNew_view& SetNew_view(void);
215 
216  /// Select the variant and set its data.
217  ///
218  /// @param value
219  /// Variant data.
220  void SetNew_view(const TNew_view& value);
221 
222 
223  /// Check if variant New_composite_view is selected.
224  ///
225  /// New_composite_view type is defined as 'typedef string TNew_composite_view'.
226  /// @return
227  /// - true, if the variant is selected.
228  /// - false, otherwise.
229  bool IsNew_composite_view(void) const;
230 
231  /// Get the variant data.
232  ///
233  /// @return
234  /// Reference to the data.
235  const TNew_composite_view& GetNew_composite_view(void) const;
236 
237  /// Select the variant.
238  ///
239  /// @return
240  /// Reference to the variant data.
241  TNew_composite_view& SetNew_composite_view(void);
242 
243  /// Select the variant and set its data.
244  ///
245  /// @param value
246  /// Variant data.
247  void SetNew_composite_view(const TNew_composite_view& value);
248 
249 
250  /// Check if variant Store is selected.
251  ///
252  /// Store type is defined as 'typedef string TStore'.
253  /// @return
254  /// - true, if the variant is selected.
255  /// - false, otherwise.
256  bool IsStore(void) const;
257 
258  /// Get the variant data.
259  ///
260  /// @return
261  /// Reference to the data.
262  const TStore& GetStore(void) const;
263 
264  /// Select the variant.
265  ///
266  /// @return
267  /// Reference to the variant data.
268  TStore& SetStore(void);
269 
270  /// Select the variant and set its data.
271  ///
272  /// @param value
273  /// Variant data.
274  void SetStore(const TStore& value);
275 
276 
277  /// Check if variant Create_project is selected.
278  ///
279  /// Create_project type is defined as 'typedef string TCreate_project'.
280  /// @return
281  /// - true, if the variant is selected.
282  /// - false, otherwise.
283  bool IsCreate_project(void) const;
284 
285  /// Get the variant data.
286  ///
287  /// @return
288  /// Reference to the data.
289  const TCreate_project& GetCreate_project(void) const;
290 
291  /// Select the variant.
292  ///
293  /// @return
294  /// Reference to the variant data.
295  TCreate_project& SetCreate_project(void);
296 
297  /// Select the variant and set its data.
298  ///
299  /// @param value
300  /// Variant data.
301  void SetCreate_project(const TCreate_project& value);
302 
303 
304  /// Check if variant Create_single_project is selected.
305  ///
306  /// Create_single_project type is defined as 'typedef string TCreate_single_project'.
307  /// @return
308  /// - true, if the variant is selected.
309  /// - false, otherwise.
310  bool IsCreate_single_project(void) const;
311 
312  /// Get the variant data.
313  ///
314  /// @return
315  /// Reference to the data.
316  const TCreate_single_project& GetCreate_single_project(void) const;
317 
318  /// Select the variant.
319  ///
320  /// @return
321  /// Reference to the variant data.
322  TCreate_single_project& SetCreate_single_project(void);
323 
324  /// Select the variant and set its data.
325  ///
326  /// @param value
327  /// Variant data.
328  void SetCreate_single_project(const TCreate_single_project& value);
329 
330 
331  /// Check if variant Attach_project is selected.
332  ///
333  /// Attach_project type is defined as 'typedef CGBProjectHandle TAttach_project'.
334  /// @return
335  /// - true, if the variant is selected.
336  /// - false, otherwise.
337  bool IsAttach_project(void) const;
338 
339  /// Get the variant data.
340  ///
341  /// @return
342  /// Reference to the data.
343  const TAttach_project& GetAttach_project(void) const;
344 
345  /// Select the variant.
346  ///
347  /// @return
348  /// Reference to the variant data.
349  TAttach_project& SetAttach_project(void);
350  /// Select the variant and set its data.
351  ///
352  /// @param value
353  /// Reference to the data.
354  void SetAttach_project(TAttach_project& value);
355 
356 
357  /// Check if variant Refresh_project is selected.
358  ///
359  /// Refresh_project type is defined as 'typedef CGBProjectHandle TRefresh_project'.
360  /// @return
361  /// - true, if the variant is selected.
362  /// - false, otherwise.
363  bool IsRefresh_project(void) const;
364 
365  /// Get the variant data.
366  ///
367  /// @return
368  /// Reference to the data.
369  const TRefresh_project& GetRefresh_project(void) const;
370 
371  /// Select the variant.
372  ///
373  /// @return
374  /// Reference to the variant data.
375  TRefresh_project& SetRefresh_project(void);
376  /// Select the variant and set its data.
377  ///
378  /// @param value
379  /// Reference to the data.
380  void SetRefresh_project(TRefresh_project& value);
381 
382 
383  /// Check if variant Add_to_MRU is selected.
384  ///
385  /// Add_to_MRU type is defined as 'typedef CPluginMRUEntry TAdd_to_MRU'.
386  /// @return
387  /// - true, if the variant is selected.
388  /// - false, otherwise.
389  bool IsAdd_to_MRU(void) const;
390 
391  /// Get the variant data.
392  ///
393  /// @return
394  /// Reference to the data.
395  const TAdd_to_MRU& GetAdd_to_MRU(void) const;
396 
397  /// Select the variant.
398  ///
399  /// @return
400  /// Reference to the variant data.
401  TAdd_to_MRU& SetAdd_to_MRU(void);
402  /// Select the variant and set its data.
403  ///
404  /// @param value
405  /// Reference to the data.
406  void SetAdd_to_MRU(TAdd_to_MRU& value);
407 
408 
409  /// Check if variant Error is selected.
410  ///
411  /// Error type is defined as 'typedef string TError'.
412  /// @return
413  /// - true, if the variant is selected.
414  /// - false, otherwise.
415  bool IsError(void) const;
416 
417  /// Get the variant data.
418  ///
419  /// @return
420  /// Reference to the data.
421  const TError& GetError(void) const;
422 
423  /// Select the variant.
424  ///
425  /// @return
426  /// Reference to the variant data.
427  TError& SetError(void);
428 
429  /// Select the variant and set its data.
430  ///
431  /// @param value
432  /// Variant data.
433  void SetError(const TError& value);
434 
435 
436  /// Check if variant Plugin_cmd_run is selected.
437  ///
438  /// Plugin_cmd_run type is defined as 'typedef string TPlugin_cmd_run'.
439  /// @return
440  /// - true, if the variant is selected.
441  /// - false, otherwise.
442  bool IsPlugin_cmd_run(void) const;
443 
444  /// Get the variant data.
445  ///
446  /// @return
447  /// Reference to the data.
448  const TPlugin_cmd_run& GetPlugin_cmd_run(void) const;
449 
450  /// Select the variant.
451  ///
452  /// @return
453  /// Reference to the variant data.
454  TPlugin_cmd_run& SetPlugin_cmd_run(void);
455 
456  /// Select the variant and set its data.
457  ///
458  /// @param value
459  /// Variant data.
460  void SetPlugin_cmd_run(const TPlugin_cmd_run& value);
461 
462 
463  /// Check if variant Register_interface is selected.
464  ///
465  /// @return
466  /// - true, if the variant is selected.
467  /// - false, otherwise.
468  bool IsRegister_interface(void) const;
469 
470  /// Select the variant.
471  void SetRegister_interface(void);
472 
473 
474  /// Check if variant Warning is selected.
475  ///
476  /// Warning type is defined as 'typedef string TWarning'.
477  /// @return
478  /// - true, if the variant is selected.
479  /// - false, otherwise.
480  bool IsWarning(void) const;
481 
482  /// Get the variant data.
483  ///
484  /// @return
485  /// Reference to the data.
486  const TWarning& GetWarning(void) const;
487 
488  /// Select the variant.
489  ///
490  /// @return
491  /// Reference to the variant data.
492  TWarning& SetWarning(void);
493 
494  /// Select the variant and set its data.
495  ///
496  /// @param value
497  /// Variant data.
498  void SetWarning(const TWarning& value);
499 
500 
501  /// Check if variant Info is selected.
502  ///
503  /// Info type is defined as 'typedef string TInfo'.
504  /// @return
505  /// - true, if the variant is selected.
506  /// - false, otherwise.
507  bool IsInfo(void) const;
508 
509  /// Get the variant data.
510  ///
511  /// @return
512  /// Reference to the data.
513  const TInfo& GetInfo(void) const;
514 
515  /// Select the variant.
516  ///
517  /// @return
518  /// Reference to the variant data.
519  TInfo& SetInfo(void);
520 
521  /// Select the variant and set its data.
522  ///
523  /// @param value
524  /// Variant data.
525  void SetInfo(const TInfo& value);
526 
527 
528 private:
529  // copy constructor and assignment operator
532  // choice state
534  // helper methods
535  void DoSelect(E_Choice index, CObjectMemoryPool* pool = 0);
536 
537  static const char* const sm_SelectionNames[];
538  // data
539  union {
540  NCBI_NS_NCBI::CUnionBuffer<NCBI_NS_STD::string> m_string;
541  NCBI_NS_NCBI::CSerialObject *m_object;
542  };
543 };
544 
545 /* @} */
546 
547 
548 
549 
550 
551 ///////////////////////////////////////////////////////////
552 ///////////////////// inline methods //////////////////////
553 ///////////////////////////////////////////////////////////
554 inline
556 {
557  return m_choice;
558 }
559 
560 inline
562 {
563  if ( m_choice != index )
564  ThrowInvalidSelection(index);
565 }
566 
567 inline
568 void CPluginReplyAction_Base::Select(E_Choice index, NCBI_NS_NCBI::EResetVariant reset, NCBI_NS_NCBI::CObjectMemoryPool* pool)
569 {
570  if ( reset == NCBI_NS_NCBI::eDoResetVariant || m_choice != index ) {
571  if ( m_choice != e_not_set )
572  ResetSelection();
573  DoSelect(index, pool);
574  }
575 }
576 
577 inline
579 {
580  Select(index, reset, 0);
581 }
582 
583 inline
585 {
586  return m_choice == e_Add_to_project;
587 }
588 
589 inline
591 {
593 }
594 
595 inline
597 {
598  return m_choice == e_New_view;
599 }
600 
601 inline
603 {
605  return *m_string;
606 }
607 
608 inline
610 {
612  return *m_string;
613 }
614 
615 inline
617 {
618  return m_choice == e_New_composite_view;
619 }
620 
621 inline
623 {
625  return *m_string;
626 }
627 
628 inline
630 {
632  return *m_string;
633 }
634 
635 inline
637 {
638  return m_choice == e_Store;
639 }
640 
641 inline
643 {
645  return *m_string;
646 }
647 
648 inline
650 {
652  return *m_string;
653 }
654 
655 inline
657 {
658  return m_choice == e_Create_project;
659 }
660 
661 inline
663 {
665  return *m_string;
666 }
667 
668 inline
670 {
672  return *m_string;
673 }
674 
675 inline
677 {
679 }
680 
681 inline
683 {
685  return *m_string;
686 }
687 
688 inline
690 {
692  return *m_string;
693 }
694 
695 inline
697 {
698  return m_choice == e_Attach_project;
699 }
700 
701 inline
703 {
704  return m_choice == e_Refresh_project;
705 }
706 
707 inline
709 {
710  return m_choice == e_Add_to_MRU;
711 }
712 
713 inline
715 {
716  return m_choice == e_Error;
717 }
718 
719 inline
721 {
723  return *m_string;
724 }
725 
726 inline
728 {
730  return *m_string;
731 }
732 
733 inline
735 {
736  return m_choice == e_Plugin_cmd_run;
737 }
738 
739 inline
741 {
743  return *m_string;
744 }
745 
746 inline
748 {
750  return *m_string;
751 }
752 
753 inline
755 {
756  return m_choice == e_Register_interface;
757 }
758 
759 inline
761 {
763 }
764 
765 inline
767 {
768  return m_choice == e_Warning;
769 }
770 
771 inline
773 {
775  return *m_string;
776 }
777 
778 inline
780 {
782  return *m_string;
783 }
784 
785 inline
787 {
788  return m_choice == e_Info;
789 }
790 
791 inline
793 {
795  return *m_string;
796 }
797 
798 inline
800 {
802  return *m_string;
803 }
804 
805 ///////////////////////////////////////////////////////////
806 ////////////////// end of inline methods //////////////////
807 ///////////////////////////////////////////////////////////
808 
809 
810 
811 
812 
813 END_objects_SCOPE // namespace ncbi::objects::
814 
816 
817 
818 #endif // GUI_OBJECTS_PLUGINREPLYACTION_BASE_HPP
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
TCreate_project & SetCreate_project(void)
Select the variant.
TStore & SetStore(void)
Select the variant.
bool IsCreate_project(void) const
Check if variant Create_project is selected.
CGBProjectHandle TRefresh_project
const TCreate_project & GetCreate_project(void) const
Get the variant data.
TInfo & SetInfo(void)
Select the variant.
bool IsNew_view(void) const
Check if variant New_view is selected.
const TStore & GetStore(void) const
Get the variant data.
TWarning & SetWarning(void)
Select the variant.
const TNew_composite_view & GetNew_composite_view(void) const
Get the variant data.
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
bool IsWarning(void) const
Check if variant Warning is selected.
TNew_view & SetNew_view(void)
Select the variant.
void CheckSelected(E_Choice index) const
Verify selection, throw exception if it differs from the expected.
TError & SetError(void)
Select the variant.
CPluginReplyAction_Base & operator=(const CPluginReplyAction_Base &)
bool IsRefresh_project(void) const
Check if variant Refresh_project is selected.
const TError & GetError(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.
E_ChoiceStopper
Maximum+1 value of the choice variant enumerator.
bool IsStore(void) const
Check if variant Store is selected.
TCreate_single_project & SetCreate_single_project(void)
Select the variant.
E_Choice Which(void) const
Which variant is currently selected.
CGBProjectHandle TAttach_project
bool IsAdd_to_project(void) const
Check if variant Add_to_project is selected.
bool IsCreate_single_project(void) const
Check if variant Create_single_project is selected.
bool IsAdd_to_MRU(void) const
Check if variant Add_to_MRU is selected.
NCBI_NS_NCBI::CUnionBuffer< NCBI_NS_STD::string > m_string
const TCreate_single_project & GetCreate_single_project(void) const
Get the variant data.
bool IsAttach_project(void) const
Check if variant Attach_project is selected.
void SetRegister_interface(void)
Select the variant.
bool IsRegister_interface(void) const
Check if variant Register_interface is selected.
void SetAdd_to_project(void)
Select the variant.
bool IsInfo(void) const
Check if variant Info is selected.
TNew_composite_view & SetNew_composite_view(void)
Select the variant.
const TInfo & GetInfo(void) const
Get the variant data.
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
const TPlugin_cmd_run & GetPlugin_cmd_run(void) const
Get the variant data.
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
bool IsError(void) const
Check if variant Error is selected.
NCBI_NS_NCBI::CSerialObject * m_object
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
CPluginReplyAction_Base(const CPluginReplyAction_Base &)
bool IsPlugin_cmd_run(void) const
Check if variant Plugin_cmd_run is selected.
TPlugin_cmd_run & SetPlugin_cmd_run(void)
Select the variant.
const TNew_view & GetNew_view(void) const
Get the variant data.
const TWarning & GetWarning(void) const
Get the variant data.
bool IsNew_composite_view(void) const
Check if variant New_composite_view is selected.
NCBI_NS_NCBI::CUnionBuffer< NCBI_NS_STD::string > m_string
@ e_Info
report an info-level message to the user
@ e_Attach_project
attach loaded project to Project Manager
@ e_Refresh_project
refresh loaded project to Project Manager
@ e_New_composite_view
launch a view named by the supplied argument
@ e_not_set
No variant selected.
@ e_Error
show an error message
@ e_Add_to_MRU
a dd an entry to the MRU list
@ e_Create_single_project
create single project for any number of Raw items
@ e_Plugin_cmd_run
execute 'run' on a named plugin with our results
@ e_Warning
report a warning to the user
@ e_Create_project
create an empty project(s) for Raw item(s), takes plugin param as argument
@ e_Add_to_project
add this item to the associated project
@ e_Store
store this object for future use The string parameter is used as a caller-defined key for retrieval
@ e_New_view
launch a view named by the supplied argument
@ e_Register_interface
register object created by the plugin
Defines to provide correct exporting from DLLs in Windows.
@ e_not_set
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Wed May 22 11:31:15 2024 by modify_doxy.py rev. 669887