NCBI C++ ToolKit
PluginReplyAction_.cpp
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  * File Description:
27  * This code was generated by application DATATOOL
28  * using the following specifications:
29  * 'gui_objects.asn'.
30  *
31  * ATTENTION:
32  * Don't edit or commit this file into CVS as this file will
33  * be overridden (by DATATOOL) without warning!
34  * ===========================================================================
35  */
36 
37 // standard includes
38 #include <ncbi_pch.hpp>
39 #include <serial/serialimpl.hpp>
40 
41 // generated includes
46 
47 BEGIN_objects_SCOPE // namespace ncbi::objects::
48 
49 
50 // generated classes
51 
53 {
54  if ( m_choice != e_not_set )
56 }
57 
59 {
60  switch ( m_choice ) {
61  case e_New_view:
63  case e_Store:
64  case e_Create_project:
66  case e_Error:
67  case e_Plugin_cmd_run:
68  case e_Warning:
69  case e_Info:
70  m_string.Destruct();
71  break;
72  case e_Attach_project:
73  case e_Refresh_project:
74  case e_Add_to_MRU:
75  m_object->RemoveReference();
76  break;
77  default:
78  break;
79  }
81 }
82 
83 void CPluginReplyAction_Base::DoSelect(E_Choice index, NCBI_NS_NCBI::CObjectMemoryPool* pool)
84 {
85  switch ( index ) {
86  case e_Attach_project:
87  (m_object = new(pool) ncbi::objects::CGBProjectHandle())->AddReference();
88  break;
89  case e_Refresh_project:
90  (m_object = new(pool) ncbi::objects::CGBProjectHandle())->AddReference();
91  break;
92  case e_Add_to_MRU:
93  (m_object = new(pool) ncbi::objects::CPluginMRUEntry())->AddReference();
94  break;
95  case e_New_view:
97  case e_Store:
98  case e_Create_project:
100  case e_Error:
101  case e_Plugin_cmd_run:
102  case e_Warning:
103  case e_Info:
104  m_string.Construct();
105  break;
106  default:
107  break;
108  }
109  m_choice = index;
110 }
111 
112 const char* const CPluginReplyAction_Base::sm_SelectionNames[] = {
113  "not set",
114  "add-to-project",
115  "new-view",
116  "new-composite-view",
117  "store",
118  "create-project",
119  "create-single-project",
120  "attach-project",
121  "refresh-project",
122  "add-to-MRU",
123  "error",
124  "plugin-cmd-run",
125  "register-interface",
126  "warning",
127  "info"
128 };
129 
131 {
132  return NCBI_NS_NCBI::CInvalidChoiceSelection::GetName(index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
133 }
134 
136 {
137  throw NCBI_NS_NCBI::CInvalidChoiceSelection(DIAG_COMPILE_INFO, this, m_choice, index, sm_SelectionNames, sizeof(sm_SelectionNames)/sizeof(sm_SelectionNames[0]));
138 }
139 
141 {
143  *m_string = value;
144 }
145 
147 {
149  *m_string = value;
150 }
151 
153 {
155  *m_string = value;
156 }
157 
159 {
161  *m_string = value;
162 }
163 
165 {
167  *m_string = value;
168 }
169 
171 {
173  return *static_cast<const TAttach_project*>(m_object);
174 }
175 
177 {
179  return *static_cast<TAttach_project*>(m_object);
180 }
181 
183 {
184  TAttach_project* ptr = &value;
185  if ( m_choice != e_Attach_project || m_object != ptr ) {
186  ResetSelection();
187  (m_object = ptr)->AddReference();
189  }
190 }
191 
193 {
195  return *static_cast<const TRefresh_project*>(m_object);
196 }
197 
199 {
201  return *static_cast<TRefresh_project*>(m_object);
202 }
203 
205 {
206  TRefresh_project* ptr = &value;
207  if ( m_choice != e_Refresh_project || m_object != ptr ) {
208  ResetSelection();
209  (m_object = ptr)->AddReference();
211  }
212 }
213 
215 {
217  return *static_cast<const TAdd_to_MRU*>(m_object);
218 }
219 
221 {
223  return *static_cast<TAdd_to_MRU*>(m_object);
224 }
225 
227 {
228  TAdd_to_MRU* ptr = &value;
229  if ( m_choice != e_Add_to_MRU || m_object != ptr ) {
230  ResetSelection();
231  (m_object = ptr)->AddReference();
233  }
234 }
235 
237 {
239  *m_string = value;
240 }
241 
243 {
245  *m_string = value;
246 }
247 
249 {
251  *m_string = value;
252 }
253 
255 {
257  *m_string = value;
258 }
259 
260 // helper methods
261 
262 // type info
264 {
265  SET_CHOICE_MODULE("NCBI-Plugin");
266  ADD_NAMED_NULL_CHOICE_VARIANT("add-to-project", null, ());
267  ADD_NAMED_BUF_CHOICE_VARIANT("new-view", m_string, STD, (string));
268  ADD_NAMED_BUF_CHOICE_VARIANT("new-composite-view", m_string, STD, (string));
269  ADD_NAMED_BUF_CHOICE_VARIANT("store", m_string, STD, (string));
270  ADD_NAMED_BUF_CHOICE_VARIANT("create-project", m_string, STD, (string));
271  ADD_NAMED_BUF_CHOICE_VARIANT("create-single-project", m_string, STD, (string));
272  ADD_NAMED_REF_CHOICE_VARIANT("attach-project", m_object, CGBProjectHandle);
273  ADD_NAMED_REF_CHOICE_VARIANT("refresh-project", m_object, CGBProjectHandle);
274  ADD_NAMED_REF_CHOICE_VARIANT("add-to-MRU", m_object, CPluginMRUEntry);
275  ADD_NAMED_BUF_CHOICE_VARIANT("error", m_string, STD, (string));
276  ADD_NAMED_BUF_CHOICE_VARIANT("plugin-cmd-run", m_string, STD, (string));
277  ADD_NAMED_NULL_CHOICE_VARIANT("register-interface", null, ());
278  ADD_NAMED_BUF_CHOICE_VARIANT("warning", m_string, STD, (string));
279  ADD_NAMED_BUF_CHOICE_VARIANT("info", m_string, STD, (string));
280  info->CodeVersion(22400);
281  info->DataSpec(ncbi::EDataSpec::eASN);
282 }
284 
285 // constructor
287  : m_choice(e_not_set)
288 {
289 }
290 
291 // destructor
293 {
294  Reset();
295 }
296 
297 
298 
299 END_objects_SCOPE // namespace ncbi::objects::
300 
302 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
BEGIN_NAMED_BASE_CHOICE_INFO("PluginReplyAction", CPluginReplyAction)
string
Definition: cgiapp.hpp:690
#define DIAG_COMPILE_INFO
Make compile time diagnostic information object to use in CNcbiDiag and CException.
Definition: ncbidiag.hpp:170
#define ADD_NAMED_REF_CHOICE_VARIANT(MemberAlias, MemberName, ClassName)
Definition: serialimpl.hpp:400
#define END_CHOICE_INFO
Definition: serialimpl.hpp:506
#define SET_CHOICE_MODULE(ModuleName)
Definition: serialimpl.hpp:500
#define ADD_NAMED_NULL_CHOICE_VARIANT(MemberAlias, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:379
#define ADD_NAMED_BUF_CHOICE_VARIANT(MemberAlias, MemberName, TypeMacro, TypeMacroArgs)
Definition: serialimpl.hpp:385
@ eDoNotResetVariant
Definition: serialbase.hpp:78
void AddReference(void) const
Add reference to object.
Definition: ncbiobj.hpp:489
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
TCreate_project & SetCreate_project(void)
Select the variant.
TStore & SetStore(void)
Select the variant.
TInfo & SetInfo(void)
Select the variant.
TWarning & SetWarning(void)
Select the variant.
void Select(E_Choice index, EResetVariant reset=eDoResetVariant)
Select the requested variant if needed.
TAdd_to_MRU & SetAdd_to_MRU(void)
Select the variant.
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.
NCBI_NS_NCBI::CSerialObject * m_object
TCreate_single_project & SetCreate_single_project(void)
Select the variant.
const TAttach_project & GetAttach_project(void) const
Get the variant data.
NCBI_NS_NCBI::CUnionBuffer< NCBI_NS_STD::string > m_string
const TRefresh_project & GetRefresh_project(void) const
Get the variant data.
TNew_composite_view & SetNew_composite_view(void)
Select the variant.
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
void ThrowInvalidSelection(E_Choice index) const
Throw 'InvalidSelection' exception.
virtual ~CPluginReplyAction_Base(void)
virtual void ResetSelection(void)
Reset the selection (set it to e_not_set).
void DoSelect(E_Choice index, CObjectMemoryPool *pool=0)
TAttach_project & SetAttach_project(void)
Select the variant.
TPlugin_cmd_run & SetPlugin_cmd_run(void)
Select the variant.
const TAdd_to_MRU & GetAdd_to_MRU(void) const
Get the variant data.
virtual void Reset(void)
Reset the whole object.
TRefresh_project & SetRefresh_project(void)
Select the variant.
static const char *const sm_SelectionNames[]
@ 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_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_not_set
static MDB_envinfo info
Definition: mdb_load.c:37
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
#define STD
Modified on Fri Sep 20 14:57:33 2024 by modify_doxy.py rev. 669887