NCBI C++ ToolKit
|
Search Toolkit Book for CObjectManagerEngine
#include <gui/objutils/object_manager_engine.hpp>
Public Member Functions | |
CObjectManagerEngine (unsigned max_threads=3) | |
CObjectManagerEngine. More... | |
~CObjectManagerEngine () | |
virtual bool | IsActive () |
Returns true if Engine supports "active" model i.e. More... | |
virtual void | SetListener (IAppJobEngineListener *listener) |
For "active" mode set a Listener that will be notified when the state of a Job changes. More... | |
virtual void | StartJob (IAppJob &job, IEngineParams *params=NULL) |
If Engine cannot start the Job and exception shall be thrown. More... | |
virtual void | CancelJob (IAppJob &job) |
Cancel job in the engine If job is not running yet - just remove from the pending queue otherwise uses IInterruptible to notify the job about cancel request. More... | |
virtual void | SuspendJob (IAppJob &job) |
virtual void | ResumeJob (IAppJob &job) |
virtual TJobState | GetJobState (IAppJob &job) const |
virtual void | ShutDown () |
stop any background threads and free resources associated with the Engine More... | |
virtual void | RequestCancel () |
asyncronous request all jobs to Cancel More... | |
![]() | |
CObject (void) | |
Constructor. More... | |
CObject (const CObject &src) | |
Copy constructor. More... | |
virtual | ~CObject (void) |
Destructor. More... | |
CObject & | operator= (const CObject &src) THROWS_NONE |
Assignment operator. More... | |
bool | CanBeDeleted (void) const THROWS_NONE |
Check if object can be deleted. More... | |
bool | IsAllocatedInPool (void) const THROWS_NONE |
Check if object is allocated in memory pool (not system heap) More... | |
bool | Referenced (void) const THROWS_NONE |
Check if object is referenced. More... | |
bool | ReferencedOnlyOnce (void) const THROWS_NONE |
Check if object is referenced only once. More... | |
void | AddReference (void) const |
Add reference to object. More... | |
void | RemoveReference (void) const |
Remove reference to object. More... | |
void | ReleaseReference (void) const |
Remove reference without deleting object. More... | |
virtual void | DoNotDeleteThisObject (void) |
Mark this object as not allocated in heap – do not delete this object. More... | |
virtual void | DoDeleteThisObject (void) |
Mark this object as allocated in heap – object can be deleted. More... | |
void * | operator new (size_t size) |
Define new operator for memory allocation. More... | |
void * | operator new[] (size_t size) |
Define new[] operator for 'array' memory allocation. More... | |
void | operator delete (void *ptr) |
Define delete operator for memory deallocation. More... | |
void | operator delete[] (void *ptr) |
Define delete[] operator for memory deallocation. More... | |
void * | operator new (size_t size, void *place) |
Define new operator. More... | |
void | operator delete (void *ptr, void *place) |
Define delete operator. More... | |
void * | operator new (size_t size, CObjectMemoryPool *place) |
Define new operator using memory pool. More... | |
void | operator delete (void *ptr, CObjectMemoryPool *place) |
Define delete operator. More... | |
virtual void | DebugDump (CDebugDumpContext ddc, unsigned int depth) const |
Define method for dumping debug information. More... | |
![]() | |
CDebugDumpable (void) | |
virtual | ~CDebugDumpable (void) |
void | DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const |
void | DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const |
void | DumpToConsole (void) const |
![]() | |
virtual | ~IAppJobEngine () |
Protected Types | |
typedef map< IAppJob *, CRef< objects::CPrefetchRequest > > | TJobHandles |
Protected Member Functions | |
void | PrefetchNotify (CRef< objects::CPrefetchRequest > token, EEvent event) |
![]() | |
virtual void | DeleteThis (void) |
Virtual method "deleting" this object. More... | |
Protected Attributes | |
CMutex | m_Mutex |
objects::CPrefetchManager | m_PrefetchManager |
IAppJobEngineListener * | m_Listener |
TJobHandles | m_Jobs |
Private Member Functions | |
CObjectManagerEngine (const CObjectManagerEngine &) | |
void | operator= (const CObjectManagerEngine &) |
Additional Inherited Members | |
![]() | |
enum | EAllocFillMode { eAllocFillNone = 1 , eAllocFillZero , eAllocFillPattern } |
Control filling of newly allocated memory. More... | |
typedef CObjectCounterLocker | TLockerType |
Default locker type for CRef. More... | |
typedef atomic< Uint8 > | TCounter |
Counter type is CAtomiCounter. More... | |
typedef Uint8 | TCount |
Alias for value type of counter. More... | |
![]() | |
typedef CAppJobDispatcher | TDisp |
typedef IAppJob::EJobState | TJobState |
![]() | |
static NCBI_XNCBI_EXPORT void | ThrowNullPointerException (void) |
Define method to throw null pointer exception. More... | |
static NCBI_XNCBI_EXPORT void | ThrowNullPointerException (const type_info &type) |
static EAllocFillMode | GetAllocFillMode (void) |
static void | SetAllocFillMode (EAllocFillMode mode) |
static void | SetAllocFillMode (const string &value) |
Set mode from configuration parameter value. More... | |
![]() | |
static void | EnableDebugDump (bool on) |
![]() | |
static const TCount | eCounterBitsCanBeDeleted = 1 << 0 |
Define possible object states. More... | |
static const TCount | eCounterBitsInPlainHeap = 1 << 1 |
Heap signature was found. More... | |
static const TCount | eCounterBitsPlaceMask |
Mask for 'in heap' state flags. More... | |
static const int | eCounterStep = 1 << 2 |
Skip over the "in heap" bits. More... | |
static const TCount | eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2) |
Minimal value for valid objects (reference counter is zero) Must be a single bit value. More... | |
static const TCount | eCounterStateMask |
Valid object, and object in heap. More... | |
Definition at line 47 of file object_manager_engine.hpp.
|
protected |
Definition at line 77 of file object_manager_engine.hpp.
CObjectManagerEngine::CObjectManagerEngine | ( | unsigned | max_threads = 3 | ) |
Definition at line 74 of file object_manager_engine.cpp.
CObjectManagerEngine::~CObjectManagerEngine | ( | ) |
Definition at line 80 of file object_manager_engine.cpp.
|
private |
|
virtual |
Cancel job in the engine If job is not running yet - just remove from the pending queue otherwise uses IInterruptible to notify the job about cancel request.
Implements IAppJobEngine.
Definition at line 116 of file object_manager_engine.cpp.
References map_checker< Container >::end(), map_checker< Container >::find(), m_Jobs, m_Mutex, NCBI_THROW, and IAppJob::RequestCancel().
|
virtual |
Implements IAppJobEngine.
Definition at line 141 of file object_manager_engine.cpp.
References IAppJob::eCanceled, CThreadPool_Task::eCanceled, IAppJob::eCompleted, CThreadPool_Task::eCompleted, CThreadPool_Task::eExecuting, IAppJob::eFailed, CThreadPool_Task::eFailed, CThreadPool_Task::eIdle, IAppJob::eInvalid, map_checker< Container >::end(), CThreadPool_Task::eQueued, IAppJob::eRunning, IAppJob::eSuspended, map_checker< Container >::find(), m_Jobs, and m_Mutex.
|
virtual |
Returns true if Engine supports "active" model i.e.
will send notifications to Dispatcher when a Job running on this Engine changes its state.
Implements IAppJobEngine.
Definition at line 96 of file object_manager_engine.cpp.
|
private |
|
protected |
Definition at line 167 of file object_manager_engine.cpp.
References IAppJob::eCanceled, eCanceled, IAppJob::eCompleted, CAppJobException::eEngineBusy, IAppJob::eFailed, map_checker< Container >::erase(), IAppJob::eRunning, CObjectManagerEngineAction::GetIAppJob(), LOG_POST, m_Jobs, m_Listener, m_Mutex, IAppJobEngineListener::OnEngineJobStateChanged(), remove(), SleepMilliSec(), and Warning().
|
virtual |
asyncronous request all jobs to Cancel
Implements IAppJobEngine.
Definition at line 91 of file object_manager_engine.cpp.
References m_PrefetchManager.
|
virtual |
Implements IAppJobEngine.
Definition at line 134 of file object_manager_engine.cpp.
References eUnknown, and NCBI_THROW.
|
virtual |
For "active" mode set a Listener that will be notified when the state of a Job changes.
Implements IAppJobEngine.
Definition at line 102 of file object_manager_engine.cpp.
References m_Listener, and m_Mutex.
Referenced by ShutDown().
|
virtual |
stop any background threads and free resources associated with the Engine
Implements IAppJobEngine.
Definition at line 84 of file object_manager_engine.cpp.
References m_PrefetchManager, NULL, and SetListener().
If Engine cannot start the Job and exception shall be thrown.
Implements IAppJobEngine.
Definition at line 109 of file object_manager_engine.cpp.
References m_Jobs, m_Mutex, and m_PrefetchManager.
|
virtual |
Implements IAppJobEngine.
Definition at line 128 of file object_manager_engine.cpp.
References eUnknown, and NCBI_THROW.
|
protected |
Definition at line 78 of file object_manager_engine.hpp.
Referenced by CancelJob(), GetJobState(), PrefetchNotify(), and StartJob().
|
protected |
Definition at line 76 of file object_manager_engine.hpp.
Referenced by PrefetchNotify(), and SetListener().
|
mutableprotected |
Definition at line 74 of file object_manager_engine.hpp.
Referenced by CancelJob(), GetJobState(), PrefetchNotify(), SetListener(), and StartJob().
|
protected |
Definition at line 75 of file object_manager_engine.hpp.
Referenced by RequestCancel(), ShutDown(), and StartJob().