NCBI C++ ToolKit
PluginCommand_.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 PluginCommand_.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_PLUGINCOMMAND_BASE_HPP
42 #define GUI_OBJECTS_PLUGINCOMMAND_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 CPluginArgSet;
64 
65 
66 // generated classes
67 
68 
69 /** @addtogroup dataspec_NCBI_Plugin
70  *
71  * @{
72  */
73 
74 /////////////////////////////////////////////////////////////////////////////
75 ///-
76 ///- PluginCommand is the list of arguments that a plugin takes
77 ///-
78 ///
79 /// CPluginCommand_Base --
80 ///
81 
83 {
85 public:
86  // constructor
87  CPluginCommand_Base(void);
88  // destructor
89  virtual ~CPluginCommand_Base(void);
90 
91  // type info
93 
94  enum ECommand {
95  eCommand_no_command = 0, ///< general-purpose commands
96  eCommand_init = 1,
97  eCommand_get_status = 2,
98  eCommand_finish = 3,
99  eCommand_abort = 4,
100  eCommand_create_interface = 5,
101  eCommand_load = 6, ///< data commands
102  eCommand_save = 7,
103  eCommand_import = 8,
104  eCommand_load_project = 9,
105  eCommand_save_project = 10,
106  eCommand_search = 11, ///< data source commands
107  eCommand_manage = 12,
108  eCommand_run = 13, ///< algorithm commands
109  eCommand_suspend = 14,
110  eCommand_resume = 15,
111  eCommand_new_view = 16, ///< view commands
112  eCommand_new_composite_view = 17
113  };
114 
115  /// Access to ECommand's attributes (values, names) as defined in spec
116  static const NCBI_NS_NCBI::CEnumeratedTypeValues* ENUM_METHOD_NAME(ECommand)(void);
117 
118  // types
120  typedef string TContext;
122 
123  // member index
124  enum class E_memberIndex {
125  e__allMandatory = 0,
126  e_command,
127  e_context,
128  e_args
129  };
131 
132  // getters
133  // setters
134 
135  /// Check if a value has been assigned to Command data member.
136  ///
137  /// Data member Command is mandatory;
138  /// its type is defined as 'typedef ECommand TCommand'
139  /// @return
140  /// - true, if a value has been assigned.
141  /// - false, otherwise.
142  bool IsSetCommand(void) const;
143 
144  /// Check if it is safe to call GetCommand method.
145  ///
146  /// @return
147  /// - true, if the data member is getatable.
148  /// - false, otherwise.
149  bool CanGetCommand(void) const;
150 
151  /// Reset Command data member.
152  void ResetCommand(void);
153 
154  /// Get the Command member data.
155  ///
156  /// @return
157  /// Copy of the member data.
158  TCommand GetCommand(void) const;
159 
160  /// Assign a value to Command data member.
161  ///
162  /// @param value
163  /// Value to assign
164  void SetCommand(TCommand value);
165 
166  /// Assign a value to Command data member.
167  ///
168  /// @return
169  /// Reference to the data value.
170  TCommand& SetCommand(void);
171 
172  /// optional named context
173  /// Check if a value has been assigned to Context data member.
174  ///
175  /// Data member Context is optional;
176  /// its type is defined as 'typedef string TContext'
177  /// @return
178  /// - true, if a value has been assigned.
179  /// - false, otherwise.
180  bool IsSetContext(void) const;
181 
182  /// Check if it is safe to call GetContext method.
183  ///
184  /// @return
185  /// - true, if the data member is getatable.
186  /// - false, otherwise.
187  bool CanGetContext(void) const;
188 
189  /// Reset Context data member.
190  void ResetContext(void);
191 
192  /// Get the Context member data.
193  ///
194  /// @return
195  /// Reference to the member data.
196  const TContext& GetContext(void) const;
197 
198  /// Assign a value to Context data member.
199  ///
200  /// @param value
201  /// Value to assign
202  void SetContext(const TContext& value);
203  void SetContext(TContext&& value);
204 
205  /// Assign a value to Context data member.
206  ///
207  /// @return
208  /// Reference to the data value.
209  TContext& SetContext(void);
210 
211  /// input arguments
212  /// Check if a value has been assigned to Args data member.
213  ///
214  /// Data member Args is optional;
215  /// its type is defined as 'typedef CPluginArgSet TArgs'
216  /// @return
217  /// - true, if a value has been assigned.
218  /// - false, otherwise.
219  bool IsSetArgs(void) const;
220 
221  /// Check if it is safe to call GetArgs method.
222  ///
223  /// @return
224  /// - true, if the data member is getatable.
225  /// - false, otherwise.
226  bool CanGetArgs(void) const;
227 
228  /// Reset Args data member.
229  void ResetArgs(void);
230 
231  /// Get the Args member data.
232  ///
233  /// @return
234  /// Reference to the member data.
235  const TArgs& GetArgs(void) const;
236 
237  /// Assign a value to Args data member.
238  ///
239  /// @param value
240  /// Reference to value.
241  void SetArgs(TArgs& value);
242 
243  /// Assign a value to Args data member.
244  ///
245  /// @return
246  /// Reference to the data value.
247  TArgs& SetArgs(void);
248 
249  /// Reset the whole object
250  virtual void Reset(void);
251 
252 
253 private:
254  // Prohibit copy constructor and assignment operator
257 
258  // data
259  Uint4 m_set_State[1];
261  string m_Context;
263 };
264 
265 /* @} */
266 
267 
268 
269 
270 
271 ///////////////////////////////////////////////////////////
272 ///////////////////// inline methods //////////////////////
273 ///////////////////////////////////////////////////////////
274 inline
276 {
277  return ((m_set_State[0] & 0x3) != 0);
278 }
279 
280 inline
282 {
283  return IsSetCommand();
284 }
285 
286 inline
288 {
289  m_Command = (ECommand)(0);
290  m_set_State[0] &= ~0x3;
291 }
292 
293 inline
295 {
296  if (!CanGetCommand()) {
297  ThrowUnassigned(0);
298  }
299  return m_Command;
300 }
301 
302 inline
304 {
305  m_Command = value;
306  m_set_State[0] |= 0x3;
307 }
308 
309 inline
311 {
312 #ifdef _DEBUG
313  if (!IsSetCommand()) {
314  memset(&m_Command,UnassignedByte(),sizeof(m_Command));
315  }
316 #endif
317  m_set_State[0] |= 0x1;
318  return m_Command;
319 }
320 
321 inline
323 {
324  return ((m_set_State[0] & 0xc) != 0);
325 }
326 
327 inline
329 {
330  return IsSetContext();
331 }
332 
333 inline
335 {
336  if (!CanGetContext()) {
337  ThrowUnassigned(1);
338  }
339  return m_Context;
340 }
341 
342 inline
344 {
345  m_Context = value;
346  m_set_State[0] |= 0xc;
347 }
348 
349 inline
351 {
352  m_Context = std::forward<CPluginCommand_Base::TContext>(value);
353  m_set_State[0] |= 0xc;
354 }
355 
356 inline
358 {
359 #ifdef _DEBUG
360  if (!IsSetContext()) {
362  }
363 #endif
364  m_set_State[0] |= 0x4;
365  return m_Context;
366 }
367 
368 inline
370 {
371  return m_Args.NotEmpty();
372 }
373 
374 inline
376 {
377  return IsSetArgs();
378 }
379 
380 inline
382 {
383  if (!CanGetArgs()) {
384  ThrowUnassigned(2);
385  }
386  return (*m_Args);
387 }
388 
389 ///////////////////////////////////////////////////////////
390 ////////////////// end of inline methods //////////////////
391 ///////////////////////////////////////////////////////////
392 
393 
394 
395 
396 
397 END_objects_SCOPE // namespace ncbi::objects::
398 
400 
401 
402 #endif // GUI_OBJECTS_PLUGINCOMMAND_BASE_HPP
namespace ncbi::objects::
CRef –.
Definition: ncbiobj.hpp:618
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
bool IsSetContext(void) const
optional named context Check if a value has been assigned to Context data member.
const TContext & GetContext(void) const
Get the Context member data.
CSerialObject Tparent
Tparent::CMemberIndex< E_memberIndex, 4 > TmemberIndex
TCommand & SetCommand(void)
Assign a value to Command data member.
bool IsSetCommand(void) const
Check if a value has been assigned to Command data member.
bool CanGetCommand(void) const
Check if it is safe to call GetCommand method.
void ResetCommand(void)
Reset Command data member.
bool CanGetContext(void) const
Check if it is safe to call GetContext method.
bool IsSetArgs(void) const
input arguments Check if a value has been assigned to Args data member.
CPluginCommand_Base & operator=(const CPluginCommand_Base &)
TContext & SetContext(void)
Assign a value to Context data member.
bool CanGetArgs(void) const
Check if it is safe to call GetArgs method.
CPluginCommand_Base(const CPluginCommand_Base &)
TCommand GetCommand(void) const
Get the Command member data.
const TArgs & GetArgs(void) const
Get the Args member data.
Defines to provide correct exporting from DLLs in Windows.
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
#define GetArgs
Avoid preprocessor name clash with the NCBI C Toolkit.
Definition: ncbiapp_api.hpp:54
static wxString GetContext(const wxString &str, int pos)
Modified on Thu May 30 12:28:06 2024 by modify_doxy.py rev. 669887