NCBI C++ ToolKit
PluginMessage_.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 PluginMessage_.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_PLUGINMESSAGE_BASE_HPP
42 #define GUI_OBJECTS_PLUGINMESSAGE_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 CPluginMessage;
64 class CPluginReply;
65 class CPluginRequest;
66 
67 
68 // generated classes
69 
70 
71 /** @addtogroup dataspec_NCBI_Plugin
72  *
73  * @{
74  */
75 
76 /////////////////////////////////////////////////////////////////////////////
77 ///-
78 ///- PluginMessage holds information regarding a single request to a plugin
79 ///-
80 ///
81 /// CPluginMessage_Base --
82 ///
83 
85 {
87 public:
88  // constructor
89  CPluginMessage_Base(void);
90  // destructor
91  virtual ~CPluginMessage_Base(void);
92 
93  // type info
95 
96  // types
97  typedef string TSource;
98  typedef string TDestination;
99  typedef string TContext;
103 
104  // member index
105  enum class E_memberIndex {
106  e__allMandatory = 0,
107  e_source,
108  e_destination,
109  e_context,
110  e_in_reply_to,
111  e_request,
112  e_reply
113  };
115 
116  // getters
117  // setters
118 
119  /// routing information
120  /// source plugin
121  /// Check if a value has been assigned to Source data member.
122  ///
123  /// Data member Source is optional;
124  /// its type is defined as 'typedef string TSource'
125  /// @return
126  /// - true, if a value has been assigned.
127  /// - false, otherwise.
128  bool IsSetSource(void) const;
129 
130  /// Check if it is safe to call GetSource method.
131  ///
132  /// @return
133  /// - true, if the data member is getatable.
134  /// - false, otherwise.
135  bool CanGetSource(void) const;
136 
137  /// Reset Source data member.
138  void ResetSource(void);
139 
140  /// Get the Source member data.
141  ///
142  /// @return
143  /// Reference to the member data.
144  const TSource& GetSource(void) const;
145 
146  /// Assign a value to Source data member.
147  ///
148  /// @param value
149  /// Value to assign
150  void SetSource(const TSource& value);
151  void SetSource(TSource&& value);
152 
153  /// Assign a value to Source data member.
154  ///
155  /// @return
156  /// Reference to the data value.
157  TSource& SetSource(void);
158 
159  /// destination plugin
160  /// Check if a value has been assigned to Destination data member.
161  ///
162  /// Data member Destination is mandatory;
163  /// its type is defined as 'typedef string TDestination'
164  /// @return
165  /// - true, if a value has been assigned.
166  /// - false, otherwise.
167  bool IsSetDestination(void) const;
168 
169  /// Check if it is safe to call GetDestination method.
170  ///
171  /// @return
172  /// - true, if the data member is getatable.
173  /// - false, otherwise.
174  bool CanGetDestination(void) const;
175 
176  /// Reset Destination data member.
177  void ResetDestination(void);
178 
179  /// Get the Destination member data.
180  ///
181  /// @return
182  /// Reference to the member data.
183  const TDestination& GetDestination(void) const;
184 
185  /// Assign a value to Destination data member.
186  ///
187  /// @param value
188  /// Value to assign
189  void SetDestination(const TDestination& value);
190  void SetDestination(TDestination&& value);
191 
192  /// Assign a value to Destination data member.
193  ///
194  /// @return
195  /// Reference to the data value.
196  TDestination& SetDestination(void);
197 
198  ///- context in which we operate
199  /// Check if a value has been assigned to Context data member.
200  ///
201  /// Data member Context is optional;
202  /// its type is defined as 'typedef string TContext'
203  /// @return
204  /// - true, if a value has been assigned.
205  /// - false, otherwise.
206  bool IsSetContext(void) const;
207 
208  /// Check if it is safe to call GetContext method.
209  ///
210  /// @return
211  /// - true, if the data member is getatable.
212  /// - false, otherwise.
213  bool CanGetContext(void) const;
214 
215  /// Reset Context data member.
216  void ResetContext(void);
217 
218  /// Get the Context member data.
219  ///
220  /// @return
221  /// Reference to the member data.
222  const TContext& GetContext(void) const;
223 
224  /// Assign a value to Context data member.
225  ///
226  /// @param value
227  /// Value to assign
228  void SetContext(const TContext& value);
229  void SetContext(TContext&& value);
230 
231  /// Assign a value to Context data member.
232  ///
233  /// @return
234  /// Reference to the data value.
235  TContext& SetContext(void);
236 
237  ///- PluginMessage we are responding to
238  /// Check if a value has been assigned to In_reply_to data member.
239  ///
240  /// Data member In_reply_to is optional;
241  /// its type is defined as 'typedef CPluginMessage TIn_reply_to'
242  /// @return
243  /// - true, if a value has been assigned.
244  /// - false, otherwise.
245  bool IsSetIn_reply_to(void) const;
246 
247  /// Check if it is safe to call GetIn_reply_to method.
248  ///
249  /// @return
250  /// - true, if the data member is getatable.
251  /// - false, otherwise.
252  bool CanGetIn_reply_to(void) const;
253 
254  /// Reset In_reply_to data member.
255  void ResetIn_reply_to(void);
256 
257  /// Get the In_reply_to member data.
258  ///
259  /// @return
260  /// Reference to the member data.
261  const TIn_reply_to& GetIn_reply_to(void) const;
262 
263  /// Assign a value to In_reply_to data member.
264  ///
265  /// @param value
266  /// Reference to value.
267  void SetIn_reply_to(TIn_reply_to& value);
268 
269  /// Assign a value to In_reply_to data member.
270  ///
271  /// @return
272  /// Reference to the data value.
273  TIn_reply_to& SetIn_reply_to(void);
274 
275  /// command to be passed to the plugin
276  /// Check if a value has been assigned to Request data member.
277  ///
278  /// Data member Request is mandatory;
279  /// its type is defined as 'typedef CPluginRequest TRequest'
280  /// @return
281  /// - true, if a value has been assigned.
282  /// - false, otherwise.
283  bool IsSetRequest(void) const;
284 
285  /// Check if it is safe to call GetRequest method.
286  ///
287  /// @return
288  /// - true, if the data member is getatable.
289  /// - false, otherwise.
290  bool CanGetRequest(void) const;
291 
292  /// Reset Request data member.
293  void ResetRequest(void);
294 
295  /// Get the Request member data.
296  ///
297  /// @return
298  /// Reference to the member data.
299  const TRequest& GetRequest(void) const;
300 
301  /// Assign a value to Request data member.
302  ///
303  /// @param value
304  /// Reference to value.
305  void SetRequest(TRequest& value);
306 
307  /// Assign a value to Request data member.
308  ///
309  /// @return
310  /// Reference to the data value.
311  TRequest& SetRequest(void);
312 
313  /// reply received from a plugin
314  /// Check if a value has been assigned to Reply data member.
315  ///
316  /// Data member Reply is mandatory;
317  /// its type is defined as 'typedef CPluginReply TReply'
318  /// @return
319  /// - true, if a value has been assigned.
320  /// - false, otherwise.
321  bool IsSetReply(void) const;
322 
323  /// Check if it is safe to call GetReply method.
324  ///
325  /// @return
326  /// - true, if the data member is getatable.
327  /// - false, otherwise.
328  bool CanGetReply(void) const;
329 
330  /// Reset Reply data member.
331  void ResetReply(void);
332 
333  /// Get the Reply member data.
334  ///
335  /// @return
336  /// Reference to the member data.
337  const TReply& GetReply(void) const;
338 
339  /// Assign a value to Reply data member.
340  ///
341  /// @param value
342  /// Reference to value.
343  void SetReply(TReply& value);
344 
345  /// Assign a value to Reply data member.
346  ///
347  /// @return
348  /// Reference to the data value.
349  TReply& SetReply(void);
350 
351  /// Reset the whole object
352  virtual void Reset(void);
353 
354 
355 private:
356  // Prohibit copy constructor and assignment operator
359 
360  // data
361  Uint4 m_set_State[1];
362  string m_Source;
364  string m_Context;
368 };
369 
370 /* @} */
371 
372 
373 
374 
375 
376 ///////////////////////////////////////////////////////////
377 ///////////////////// inline methods //////////////////////
378 ///////////////////////////////////////////////////////////
379 inline
381 {
382  return ((m_set_State[0] & 0x3) != 0);
383 }
384 
385 inline
387 {
388  return IsSetSource();
389 }
390 
391 inline
393 {
394  if (!CanGetSource()) {
395  ThrowUnassigned(0);
396  }
397  return m_Source;
398 }
399 
400 inline
402 {
403  m_Source = value;
404  m_set_State[0] |= 0x3;
405 }
406 
407 inline
409 {
410  m_Source = std::forward<CPluginMessage_Base::TSource>(value);
411  m_set_State[0] |= 0x3;
412 }
413 
414 inline
416 {
417 #ifdef _DEBUG
418  if (!IsSetSource()) {
420  }
421 #endif
422  m_set_State[0] |= 0x1;
423  return m_Source;
424 }
425 
426 inline
428 {
429  return ((m_set_State[0] & 0xc) != 0);
430 }
431 
432 inline
434 {
435  return IsSetDestination();
436 }
437 
438 inline
440 {
441  if (!CanGetDestination()) {
442  ThrowUnassigned(1);
443  }
444  return m_Destination;
445 }
446 
447 inline
449 {
451  m_set_State[0] |= 0xc;
452 }
453 
454 inline
456 {
457  m_Destination = std::forward<CPluginMessage_Base::TDestination>(value);
458  m_set_State[0] |= 0xc;
459 }
460 
461 inline
463 {
464 #ifdef _DEBUG
465  if (!IsSetDestination()) {
467  }
468 #endif
469  m_set_State[0] |= 0x4;
470  return m_Destination;
471 }
472 
473 inline
475 {
476  return ((m_set_State[0] & 0x30) != 0);
477 }
478 
479 inline
481 {
482  return IsSetContext();
483 }
484 
485 inline
487 {
488  if (!CanGetContext()) {
489  ThrowUnassigned(2);
490  }
491  return m_Context;
492 }
493 
494 inline
496 {
497  m_Context = value;
498  m_set_State[0] |= 0x30;
499 }
500 
501 inline
503 {
504  m_Context = std::forward<CPluginMessage_Base::TContext>(value);
505  m_set_State[0] |= 0x30;
506 }
507 
508 inline
510 {
511 #ifdef _DEBUG
512  if (!IsSetContext()) {
514  }
515 #endif
516  m_set_State[0] |= 0x10;
517  return m_Context;
518 }
519 
520 inline
522 {
523  return m_In_reply_to.NotEmpty();
524 }
525 
526 inline
528 {
529  return IsSetIn_reply_to();
530 }
531 
532 inline
534 {
535  if (!CanGetIn_reply_to()) {
536  ThrowUnassigned(3);
537  }
538  return (*m_In_reply_to);
539 }
540 
541 inline
543 {
544  return m_Request.NotEmpty();
545 }
546 
547 inline
549 {
550  return true;
551 }
552 
553 inline
555 {
556  if ( !m_Request ) {
557  const_cast<CPluginMessage_Base*>(this)->ResetRequest();
558  }
559  return (*m_Request);
560 }
561 
562 inline
564 {
565  if ( !m_Request ) {
566  ResetRequest();
567  }
568  return (*m_Request);
569 }
570 
571 inline
573 {
574  return m_Reply.NotEmpty();
575 }
576 
577 inline
579 {
580  return true;
581 }
582 
583 inline
585 {
586  if ( !m_Reply ) {
587  const_cast<CPluginMessage_Base*>(this)->ResetReply();
588  }
589  return (*m_Reply);
590 }
591 
592 inline
594 {
595  if ( !m_Reply ) {
596  ResetReply();
597  }
598  return (*m_Reply);
599 }
600 
601 ///////////////////////////////////////////////////////////
602 ////////////////// end of inline methods //////////////////
603 ///////////////////////////////////////////////////////////
604 
605 
606 
607 
608 
609 END_objects_SCOPE // namespace ncbi::objects::
610 
612 
613 
614 #endif // GUI_OBJECTS_PLUGINMESSAGE_BASE_HPP
CRef –.
Definition: ncbiobj.hpp:618
Base class for all serializable objects.
Definition: serialbase.hpp:150
void ThrowUnassigned(TMemberIndex index) const
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
bool CanGetReply(void) const
Check if it is safe to call GetReply method.
CRef< TRequest > m_Request
bool IsSetRequest(void) const
command to be passed to the plugin Check if a value has been assigned to Request data member.
bool IsSetIn_reply_to(void) const
bool IsSetReply(void) const
reply received from a plugin Check if a value has been assigned to Reply data member.
CRef< TReply > m_Reply
const TContext & GetContext(void) const
Get the Context member data.
bool CanGetDestination(void) const
Check if it is safe to call GetDestination method.
const TIn_reply_to & GetIn_reply_to(void) const
Get the In_reply_to member data.
CPluginMessage TIn_reply_to
bool CanGetRequest(void) const
Check if it is safe to call GetRequest method.
TContext & SetContext(void)
Assign a value to Context data member.
bool CanGetContext(void) const
Check if it is safe to call GetContext method.
bool CanGetIn_reply_to(void) const
Check if it is safe to call GetIn_reply_to method.
void ResetReply(void)
Reset Reply data member.
const TDestination & GetDestination(void) const
Get the Destination member data.
const TReply & GetReply(void) const
Get the Reply member data.
TRequest & SetRequest(void)
Assign a value to Request data member.
bool IsSetSource(void) const
routing information source plugin Check if a value has been assigned to Source data member.
TReply & SetReply(void)
Assign a value to Reply data member.
bool IsSetDestination(void) const
destination plugin Check if a value has been assigned to Destination data member.
TDestination & SetDestination(void)
Assign a value to Destination data member.
CPluginRequest TRequest
Tparent::CMemberIndex< E_memberIndex, 7 > TmemberIndex
const TSource & GetSource(void) const
Get the Source member data.
CPluginMessage_Base(const CPluginMessage_Base &)
bool CanGetSource(void) const
Check if it is safe to call GetSource method.
CPluginMessage_Base & operator=(const CPluginMessage_Base &)
CRef< TIn_reply_to > m_In_reply_to
const TRequest & GetRequest(void) const
Get the Request member data.
void ResetRequest(void)
Reset Request data member.
CSerialObject Tparent
TSource & SetSource(void)
Assign a value to Source data member.
Defines to provide correct exporting from DLLs in Windows.
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
static wxString GetContext(const wxString &str, int pos)
Modified on Sat Jul 13 13:40:47 2024 by modify_doxy.py rev. 669887