NCBI C++ ToolKit
test_client.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef GUI_WX_APP_DEMO___TEST_CLIENT__HPP
2 #define GUI_WX_APP_DEMO___TEST_CLIENT__HPP
3 
4 /* $Id: test_client.hpp 29661 2014-01-24 14:48:36Z falkrb $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Andrey Yazhuk
30  *
31  * File Description:
32  */
33 
34 
37 
39 
40 ////////////////////////////////////////////////////////////////////////////////
41 /// CPrimeNumbersJob
42 
43 class CPrimeNumbersJob : public CObject, public IAppJob
44 {
45 public:
46  class CResult : public CObject
47  {
48  public:
49  vector<int> m_Numbers;
50  };
51 
52  CPrimeNumbersJob(int max);
53 
54  /// @name IAppJob implementation
55  /// @{
56  virtual IAppJob::EJobState Run();
58  virtual CRef<CObject> GetResult();
60  virtual string GetDescr() const;
61  virtual void RequestCancel();
62  virtual bool IsCanceled() const { return m_StopRequested; }
63  /// @}
64 
65 protected:
68  bool m_Finished;
69 
73 };
74 
75 
76 ////////////////////////////////////////////////////////////////////////////////
77 /// CPrimeNumberClient
79 {
80 public:
82 
83  void StartJobs(int n);
84  void CancelJobs();
85 
86  void CheckStatus();
87  void CheckProgress();
88 
89 protected:
91 
92  /// Job Dispatcher notification handler
94 
95 protected:
99 };
100 
102 
103 #endif // GUI_WX_APP_DEMO___TEST_CLIENT__HPP
CAppJobDispatcher.
CEventHandler.
CEvent - generic event implementation TODO TODO - Attachments.
Definition: event.hpp:86
CObject –.
Definition: ncbiobj.hpp:180
CPrimeNumberClient.
Definition: test_client.hpp:79
void OnAppJobNotification(CEvent *evt)
Job Dispatcher notification handler.
void StartJobs(int n)
CPrimeNumberClient(CAppJobDispatcher &disp)
CPrimeNumberClient.
set< int > m_JobIDs
Definition: test_client.hpp:98
CAppJobDispatcher & m_Disp
Definition: test_client.hpp:96
CPrimeNumbersJob.
Definition: test_client.hpp:44
virtual CConstIRef< IAppJobError > GetError()
Returns IAppJobError object describing internal error that caused the Job to fail.
CPrimeNumbersJob(int max)
CPrimeNumbersJob.
Definition: test_client.cpp:44
virtual CConstIRef< IAppJobProgress > GetProgress()
return progress object, the function shall be synchronized internally.
virtual void RequestCancel()
RequestCancel() is called to notify the Job that it shall exit Run() function ASAP.
Definition: test_client.cpp:98
virtual string GetDescr() const
Returns a human readable description of the Job (optional)
CRef< CResult > m_Result
Definition: test_client.hpp:71
virtual IAppJob::EJobState Run()
Function that does all the useful work, called by the Engine.
Definition: test_client.cpp:52
virtual bool IsCanceled() const
Definition: test_client.hpp:62
CConstIRef< IAppJobProgress > m_Progress
Definition: test_client.hpp:70
CConstIRef< IAppJobError > m_Error
Definition: test_client.hpp:72
virtual CRef< CObject > GetResult()
Returns the Job Result.
IAppJob.
Definition: app_job.hpp:82
EJobState
Job states (describe FSM)
Definition: app_job.hpp:86
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
yy_size_t n
T max(T x_, T y_)
Modified on Mon Jun 17 05:10:46 2024 by modify_doxy.py rev. 669887