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

Go to the SVN repository for this file.

1 #ifndef GUI_OBJUTILS___APP_JOB_ENGINE_OM__HPP
2 #define GUI_OBJUTILS___APP_JOB_ENGINE_OM__HPP
3 
4 /* $Id: object_manager_engine.hpp 24876 2011-12-16 16:03:41Z kuznets $
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, Eugene Vasilchenko
30  *
31  * File Description:
32  * Implementation of Application Job Engine using object manager prefetcher.
33  *
34  */
35 
36 
38 
39 #include <corelib/ncbiobj.hpp>
41 
42 
44 
45 ///////////////////////////////////////////////////////////////////////////////
46 /// CAppJobDispatcher
48  public CObject,
49  public objects::IPrefetchListener,
50  public IAppJobEngine
51 {
52 public:
53  CObjectManagerEngine(unsigned max_threads = 3);
55 
56  virtual bool IsActive();
57 
58  virtual void SetListener(IAppJobEngineListener* listener);
59 
60  virtual void StartJob(IAppJob& job, IEngineParams* params = NULL);
61 
62  virtual void CancelJob(IAppJob& job);
63  virtual void SuspendJob(IAppJob& job);
64  virtual void ResumeJob(IAppJob& job);
65 
66  virtual TJobState GetJobState(IAppJob& job) const;
67 
68  virtual void ShutDown();
69  virtual void RequestCancel();
70 
71 protected:
72  void PrefetchNotify(CRef<objects::CPrefetchRequest> token, EEvent event);
73 
74  mutable CMutex m_Mutex;
75  objects::CPrefetchManager m_PrefetchManager;
79 
80 private:
83 };
84 
85 
87 
88 #endif // GUI_OBJUTILS___APP_JOB_ENGINE_OM__HPP
CMutex –.
Definition: ncbimtx.hpp:749
map< IAppJob *, CRef< objects::CPrefetchRequest > > TJobHandles
CObjectManagerEngine(const CObjectManagerEngine &)
IAppJobEngineListener * m_Listener
void operator=(const CObjectManagerEngine &)
objects::CPrefetchManager m_PrefetchManager
CObject –.
Definition: ncbiobj.hpp:180
IAppJobEngineListener - receives notifications about changes in job state.
IAppJobEngine.
IAppJob.
Definition: app_job.hpp:82
Definition: map.hpp:338
#define NULL
Definition: ncbistd.hpp:225
virtual void StartJob(IAppJob &job, IEngineParams *params=NULL)=0
If Engine cannot start the Job and exception shall be thrown.
virtual void ResumeJob(IAppJob &job)=0
virtual void SuspendJob(IAppJob &job)=0
virtual void SetListener(IAppJobEngineListener *listener)=0
For "active" mode set a Listener that will be notified when the state of a Job changes.
virtual void RequestCancel()=0
asyncronous request all jobs to Cancel
virtual void CancelJob(IAppJob &job)=0
Cancel job in the engine If job is not running yet - just remove from the pending queue otherwise use...
EJobState
Job states (describe FSM)
Definition: app_job.hpp:86
virtual bool IsActive()=0
Returns true if Engine supports "active" model i.e.
virtual TJobState GetJobState(IAppJob &job) const =0
virtual void ShutDown()=0
stop any background threads and free resources associated with the Engine
#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_GUIUTILS_EXPORT
Definition: gui_export.h:518
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Modified on Sat May 25 14:17:58 2024 by modify_doxy.py rev. 669887