NCBI C++ ToolKit
phylo_tree_force.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: phylo_tree_force.cpp 40280 2018-01-19 17:54:35Z katargir $
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  * Authors: Bob Falk
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 #include <corelib/ncbitime.hpp>
34 #include <corelib/ncbistl.hpp>
35 
40 #include <gui/opengl/glhelpers.hpp>
41 
43 
46 #include <gui/utils/view_event.hpp>
47 
48 
49 #include <math.h>
50 
52 
53 #define PHYLO_RENDER_TIMER_ID 63001
54 
57  &CPhyloForce::OnAppJobNotification)
59  &CPhyloForce::OnAppJobProgress)
61 
62 BEGIN_EVENT_TABLE(CPhyloForce, CPhyloRadial)
63  EVT_TIMER(PHYLO_RENDER_TIMER_ID, CPhyloForce::OnTimer)
65 
66 
68 : m_Timer(this, PHYLO_RENDER_TIMER_ID)
69 , m_MainThreadPS(NULL)
70 , m_UseMainThreadPhysics(true)
71 {
73 
74  // If rendering within gbench, use thread for force calculations,
75  // otherwise we are probably cgi and should use main thread.
76  if (CGuiRegistry::GetInstance().HasField("GBENCH")) {
77  m_UseMainThreadPhysics = false;
78  }
79 }
80 
81 CPhyloForce::CPhyloForce(double w, double h)
82 : CPhyloRadial(w, h)
83 , m_Timer(this, PHYLO_RENDER_TIMER_ID)
84 , m_MainThreadPS(NULL)
85 , m_UseMainThreadPhysics(true)
86 {
88  m_DistMode = false;
89 
90  // If rendering within gbench, use thread for force calculations,
91  // otherwise we are probably cgi and should use main thread.
92  if (CGuiRegistry::GetInstance().HasField("GBENCH")) {
93  m_UseMainThreadPhysics = false;
94  }
95 
96 #ifdef ATTRIB_MENU_SUPPORT
97  // CAttribMenu& m = CAttribMenuInstance::GetInstance();
98 
99  // CAttribMenu* sub_menu = m.AddSubMenuUnique("Force ext", this);
100 
101  // sub_menu->AddFloatReadOnly("Vis Left", &vis_left);
102  // sub_menu->AddFloatReadOnly("Vis Right", &vis_right);
103  // sub_menu->AddFloatReadOnly("Vis Bottom", &vis_bottom);
104  // sub_menu->AddFloatReadOnly("Vis Top", &vis_top);
105 
106  // sub_menu->AddFloatReadOnly("Ext Left", &ext_left);
107  // sub_menu->AddFloatReadOnly("Ext Right", &ext_right);
108  // sub_menu->AddFloatReadOnly("Ext Bottom", &ext_bottom);
109  // sub_menu->AddFloatReadOnly("Ext top", &ext_top);
110 #endif
111 
112 }
113 
114 
116 {
119  disp.DeleteJob(m_JobID);
120  }
121 
122  m_Timer.Stop();
123 }
124 
126 {
127  m_DistMode = false;
128 
129  // It is more efficient not to re-run the radial layout each time
130  // if, for example, the user simply collapsed some nodes. Unfortuately
131  // some user operations wind up setting all node position values to 0,
132  // so be be sure we have to compute the radial tree first each time.
133  //if (m_SwitchedLayout)
135 
136  Int4 leafs = ds.GetSize();
137  Int4 width = ds.GetWidth();
138 
139  m_xStep = m_DimX / (double)width;
140  // ystep is used to compute distance between nodes. Since nodes are forced apart,
141  // about 4 times size gives a better approximation of average distance between nodes.
142  m_yStep = 4.0*m_DimY / (double)((leafs>1)?(leafs-1):2);
143 
144  if (ds.GetNormDistance() > 0){
146  }
147 
148  m_Timer.Stop();
149 
151  bool retain_parms = false;
152 
153  // Set drawing options that are specific to the force layout
154  CGlVboNode* edge_node = ds.GetModel().FindGeomNode("TreeEdges");
155  CGlVboNode* narrow_edge_node = ds.GetModel().FindGeomNode("NarrowTreeEdges");
156 
157  if (edge_node != NULL && narrow_edge_node != NULL) {
158  edge_node->GetState().Enable(GL_LINE_SMOOTH);
159  edge_node->GetState().Enable(GL_BLEND);
160  edge_node->GetState().BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
161 
162  narrow_edge_node->GetState().Enable(GL_LINE_SMOOTH);
163  narrow_edge_node->GetState().Enable(GL_BLEND);
164  narrow_edge_node->GetState().BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
165  narrow_edge_node->GetState().ColorC(CRgbaColor(1.0f, 1.0f, 1.0f, 0.7f));
166  }
167 
168  CGlVboNode* filler_points_node = m_DS->GetModel().FindGeomNode("FillerPoints");
169  if (filler_points_node != NULL)
170  filler_points_node->SetVisible(false);
171 
172  // Special case: no need for particle system if there is only
173  // one node.
174  if (ds.GetTree()->GetRoot().NumChildren() == 0) {
175  TModelRect newRect = ds.GetBoundRect();
176 
177  newRect.Inflate(1.0f, 1.0f);
178  m_RasterRect = newRect;
179 
180  // This handles single node case too.
182 
183  return;
184  }
185 
186  if (!m_UseMainThreadPhysics) {
187 
188  try {
190 
191  // for debugging, copy the particle system parameters from the current
192  // system to the new one (parameters may be updated via attribute
193  // menus).
194  if (j != NULL) {
195  p = j->GetPS()->getPhysicParms();
196  retain_parms = true;
197  }
198 
202  if (state == IAppJob::eRunning)
203  disp.CancelJob(m_JobID);
204  else
205  disp.DeleteJob(m_JobID);
206 
207  m_Job.Reset();
208  }
209 
210  j = m_Job.GetPointerOrNull();
211 
212  if (j == NULL) {
213  // This is for debugging - if you run the force update several times,
214  // you may change parameters each time and this retains those updates,
215  // which probably occured through attribute menus, between updates.
216  CForceJob *fj = new CForceJob(ds);
217 
218  if (retain_parms) {
219  fj->GetPS()->SetPhysicsParms(p);
220 
221 
222 #ifdef ATTRIB_MENU_SUPPORT
224 #endif
225 
226  }
227 
228  m_Job.Reset(fj);
229  m_JobID = CAppJobDispatcher::GetInstance().StartJob(*m_Job, "ThreadPool", *this, 1, true);
230 
231  m_Timer.Start(200);
232  }
233  }
234  // Unable to start a job - try to do physics in foreground
235  catch (CAppJobException&) {
236  m_UseMainThreadPhysics = true;
237  }
238  }
239  else {
240  if (!m_MainThreadPS) {
241  m_MainThreadPS = new CPhyloTreePS(ds);
242  // This makes the system end more quickly since the velocity threshold
243  // below which we can stop is raised.
245  } else {
246  m_MainThreadPS->Init(ds);
247  }
248 
249  //m_Timer.Start(50); // no good for cgi...
250 
251  // This has to work for a batch, CGI version too - so there are
252  // no progressive updates - we just want to iterate until it stabilizes
253  // or we reach a maximum iteration count.
254  for (int i=0; i<200 && !m_MainThreadPS->IsDone(); ++i)
256 
259 
260  // This is the rect for viewing limits used by cgi.
262 
263  return;
264  }
265 }
266 
268 {
270 
271  StopLayout();
272 }
273 
275 {
276  m_pPane = &pane;
277  m_DS = &ds;
278 
279  // Is a job running? If so make sure we don't draw while the
280  // particle system is syncing with the graphics model. Otherwise
281  // just draw.
283 
285  if (j != NULL ) {
286 
289 
290  /// Need only to drop scale marker for force layout...
291  IPhyloTreeRender::Render(pane,ds);
292 
294  }
295  // Unable to render since force thread is busy synchrnizing
296  // the particle system data with the graphics data.
297  else {
298  //_TRACE("No render. Data synched: " << j->DataSynched() << " instead of: " << CForceJob::eDataSynched);
299  return false;
300  }
301  }
302  }
303  else {
304  IPhyloTreeRender::Render(pane,ds);
305  }
306 
307  return true;
308 }
309 
311 {
312  try {
313  m_Timer.Stop();
314 
318 
319  if (state == IAppJob::eRunning) {
320  disp.CancelJob(m_JobID);
321 
322  // Wait until job is really done (current iteration is finished)
323  // to move on:
324  int count = 0;
325  while (count++<20 && disp.GetJobState(m_JobID) == IAppJob::eRunning) {
326  wxMilliSleep(100);
327  }
328  }
329  else {
330  disp.DeleteJob(m_JobID);
331  }
332 
334  m_Job.Reset();
335  }
336  }
337  catch (CAppJobException&) {
338  _TRACE("Error deleting force layout job");
339  }
340 
342  m_Job.Reset();
343 }
344 
346 {
347  if (!m_MainThreadPS)
348  return;
349 
350  if (!m_MainThreadPS->IsDone()) {
351  for (int j=0; j<10; ++j) {
353  }
354 
356  }
357  else {
358  m_Timer.Stop();
359  }
360 }
361 
362 
363 // Function to calculate node positions in tree. Essentially a recursive
364 // function (implemented as a loop) using TreeDepthFirstEx. This prevents
365 // very deep trees from the risk of stack overflow.
367 {
368 public:
370 
371 public:
373  : m_Clad(clad)
374  , m_ComputeBoundary(0)
375  {
377  }
378 
380  TTreeIdx node_idx, int delta)
381  {
382  CPhyloTree::TNodeType& node = tree[node_idx];
383 
384  if (delta==1) {
386  }
387 
388  if (delta==1 || delta==0) {
390  m_ComputeBoundary += 1;
391 
392  m_Clad->InitLabel(&tree, node);
393  if (node.IsLeafEx()) {
394  CBoundaryPoints node_boundary_pts;
395  m_Clad->x_ComputeNodeBoundary(&tree, node, node_boundary_pts, "ForceLayout");
397  m_ComputeBoundary -= 1;
398 
399  if (m_ComputeBoundary>0) {
400  m_BoundaryPoints.top().AddBoundedPoints(node_boundary_pts);
401  }
402  }
403  m_Clad->CalculateExtents(&tree, node);
404  }
405  else if (delta == -1) {
406  // Each node that computes a boundary has to add in the points (and text rectangles)
407  // for all nodes below it in the tree
408  CBoundaryPoints pts = m_BoundaryPoints.top();
409  m_BoundaryPoints.pop();
410  m_Clad->x_ComputeNodeBoundary(&tree, node, pts, "ForceLayout");
411 
413  m_ComputeBoundary -= 1;
414  }
415 
416  if (m_ComputeBoundary>0) {
417  m_BoundaryPoints.top().AddBoundedPoints(pts);
418  }
419  }
420 
421  return eTreeTraverse;
422  }
423 
424 private:
427  stack<CBoundaryPoints> m_BoundaryPoints;
428 };
429 
431 {
432  CCalcBoundary calc_tree(this);
433  TreeDepthFirstEx(*m_DS->GetTree(), calc_tree);
434 }
435 
437 {
439  if (!b) {
441  disp.DeleteJob(m_JobID);
442  m_Timer.Stop();
443  }
444 }
445 
446 
447 /// handles "state changed" notification from CAppJobDispatcher
449 {
450  CAppJobNotification* notn = dynamic_cast<CAppJobNotification*>(evt);
451  _ASSERT(notn);
452 
453 
455  int job_id = 0;
456 
457  if(notn) {
458  job_id = notn->GetJobID();
459  if(job_id) {
460  state = notn->GetState();
461  }
462  }
463 
464  if (state != IAppJob::eRunning) {
465  // Only redraw if job completed normally - not if it was cancellled.
466  if (state == IAppJob::eCompleted) {
467  // If job is Not NULL, we will only render if the status is eRenderInProgress
468  if (!m_Job.IsNull())
469  m_Job->SetDataSynched(CForceJob::eRenderInProgress);
472  if (m_pHost != NULL)
473  m_pHost->HMGH_UpdateLimits(true);
474  }
475 
476  // Stop timer if job is not running. Can't just use job status since
477  // when layout it called it stops the current job but then immediately
478  // starts a new one, so this can be called from the cancelled job
479  // even though the timer is needed for the newly created job.
480  if (job_id == m_JobID) {
481  m_Timer.Stop();
483  m_Job.Reset();
484  }
485  }
486 }
487 
489 {
490  CAppJobNotification* notn =
491  dynamic_cast<CAppJobNotification*>(evt);
492  _ASSERT(notn);
493 
494  if(notn) {
495  // Could redraw on this with code below, but we use a separate timer
496  // since this is called to infrequently to be helpful
497  // (only called around 1/sec)
498  /*
499  CForceJob* j = m_Job.GetPointerOrNull();
500  if (j != NULL) {
501 
502  CMutexGuard guard(j->GetMutex());
503 
504  x_CalculateBoundary();
505  ComputeViewingLimits(*m_pPane, m_ForceSquare);
506  m_pHost->HMGH_UpdateLimits(true);
507  //x_GetParent()->GetPort().SetModelLimitsRect(m_MatrixPane.GetModelLimitsRect());
508  //x_GetParent()->GetPort().SetVisibleRect(m_MatrixPane.GetVisibleRect());
509  m_pPane->OpenOrtho();
510 
511  x_DrawBoundingAreas(m_DS->GetTree());
512  x_DrawTree( m_DS->GetTree() );
513  x_DrawNodes( m_DS->GetTree() );
514 
515  m_pPane->Close();
516  }
517  */
518  }
519 }
520 
521 ///////////////////////////////////////////////////////////////////////////////
522 void CPhyloForce::OnTimer(wxTimerEvent& /* evt */)
523 {
524  // If there is a valid (deform) job running and it has
525  // synchronized the visual data with the physics data
526  // since the last time called, recompute the tree boundaries
527  // and redraw.
528  if (!m_UseMainThreadPhysics &&
530 
533 
535  if (j != NULL ) {
536  CMutexGuard guard(j->GetMutex());
537  if (state == IAppJob::eRunning &&
542  m_pHost->HMGH_UpdateLimits(true);
543  //_TRACE("Synched. " << j->DataSynched());
544  }
545  }
546  else if (m_UseMainThreadPhysics) {
548 
551  if (m_pHost != NULL)
552  m_pHost->HMGH_UpdateLimits(true);
553  }
554  }
555 }
556 
557 //
558 // Background job for running force update on a separate thread
559 //
560 ///////////////////////////////////////////////////////////////////////////////
562 : m_PS(NULL)
563 , m_DataSynched(eDataSynched)
564 , m_UpdatesSinceLastSync(0)
565 {
566  m_PS = new CPhyloTreePS(ds);
567 }
568 
570 {
571  delete m_PS;
572  m_PS = NULL;
573 }
574 
576 {
577  // Update data for rendering before starting so initial
578  // image can show
579  m_PS->UpdateAndSynch();
581 
582  // Loop a large number of times. Ideally, system will stop when
583  // velocity drops (checked in x_Calculate)
584  for (int i=0; i<20000 && !IsCanceled(); i++)
585  x_Calculate();
586 
587  return eCompleted;
588 }
589 
591 {
592  if (IsCanceled()) {
593  return;
594  }
595 
596  // updates should be timer based, but make sure that
597  // a minimum number happen (otherwise it will slow down
598  // progress of the particle system)
599  //double i = 0.0f;
600 
601  CStopWatch sw;
602  sw.Start();
603 
604  // Do not update the system until at least 0.4 seconds has passed.
605  while (sw.Elapsed() < 0.2) {
606  m_PS->Update();
608  }
609 
610  // Do a special update that synchronizes the tree data with the particle
611  // system. To keep rendering (kind of ) smooth during updates of larger
612  // trees, don't do this if there were less than a (low) number of iterations
613  // since synch blocks rendering.
614  if (!IsCanceled() &&
618  CMutexGuard guard(m_Mutex);
620  m_PS->UpdateAndSynch();
622 
623  /// If velocity has dropped low enough, stop system.
624  if (m_PS->IsDone())
625  RequestCancel();
626  }
627 }
628 
630 {
631  return m_DataSynched;
632 }
633 
635 {
636  CMutexGuard guard(m_Mutex);
637  m_DataSynched = s;
638 }
639 
641 {
642  return CConstIRef<IAppJobProgress>(new CAppJobProgress(1.0, "Finished"));
643 }
644 
646 {
647  CMutexGuard guard(m_Mutex);
649  return result;
650 }
651 
653 {
654  return CConstIRef<IAppJobError>(new CAppJobError("No errors"));
655 }
656 
657 string CForceJob::GetDescr() const
658 {
659  return "Building Force Layout";
660 }
661 
662 
663 
664 
665 
667 
CAppJobDispatcher.
CAppJobError Default implementation for IAppJobError - encapsulates a text error message.
IAppJobListener Interface for components that need to be notified about changes in Jobs.
CAppJobNotification Notification send by CAppJobEventTranslator.
CAppJobProgress Default implementation for IAppJobProgress - the class encapsulates a text message an...
static CAttribMenu & GetInstance()
Return a static instance of CAttribMenu.
Definition: attrib_menu.cpp:50
virtual void SynchToUserValue()
Recursively calls each menu item to set its menu value to the current user value (if not NULL).
CCalcBoundary(CPhyloForce *clad)
stack< CBoundaryPoints > m_BoundaryPoints
ETreeTraverseCode operator()(CPhyloTree &tree, TTreeIdx node_idx, int delta)
CPhyloForce * m_Clad
CPhyloTree::TTreeIdx TTreeIdx
CEventHandler.
CEvent - generic event implementation TODO TODO - Attachments.
Definition: event.hpp:86
Class used to run deformation on separate thread.
CPhyloTreePS * m_PS
Particle system used to deform tree.
virtual CRef< CObject > GetResult()
Returns the Job Result.
virtual string GetDescr() const
Returns a human readable description of the Job (optional)
int m_UpdatesSinceLastSync
Counter to prevent synchronizing too often (that delays rendering)
virtual CConstIRef< IAppJobError > GetError()
Returns IAppJobError object describing internal error that caused the Job to fail.
CForceJob(CPhyloTreeDataSource &ds)
TDataSynchStatus DataSynched()
Return true if tree has been updated from particle system since last call.
void SetDataSynched(TDataSynchStatus s)
Update data sych state.
CMutex m_Mutex
Guard access to underlying tree.
CMutex & GetMutex()
Get mutex.
TDataSynchStatus m_DataSynched
Set to true each time particle system updates underlying tree.
CPhyloTreePS * GetPS()
Get the particle system.
virtual EJobState Run()
Function that does all the useful work, called by the Engine.
virtual CConstIRef< IAppJobProgress > GetProgress()
return progress object, the function shall be synchronized internally.
class CGlPane
Definition: glpane.hpp:62
CGlVboNode A rendering node that holds a vertex buffer object.
Definition: glvbonode.hpp:64
static CGuiRegistry & GetInstance()
access the application-wide singleton
Definition: registry.cpp:400
Main layout class.
void OnAppJobProgress(CEvent *event)
void x_SingleThreadPhysics()
TJobID m_JobID
Job ID of current force-based graph layout job.
CPhyloTreePS * m_MainThreadPS
Particle system to use if physics is to be done in main thread.
void OnTimer(wxTimerEvent &evt)
While job is running, use a timer to redraw (updated) tree.
bool m_UseMainThreadPhysics
If true, we update the physics in the main thread.
virtual void RemoveCurrentDataSource()
If datasource is deleted/recreated during layout, this will cancel current layout (to prevent from cr...
void x_Layout(CPhyloTreeDataSource &ds)
void StopLayout()
Stop active layout (particle system)
CIRef< CForceJob > m_Job
Current forced-based graph layout job.
virtual void StartRendering(bool b)
Overridden to cancel any running (deform) job when rendering switches to a different layout.
wxTimer m_Timer
run during force calculations to re-display graph during upates
bool Render(CGlPane &pane, CPhyloTreeDataSource &ds)
Render in force overrides the pane size computation (adaptive margins)
void x_CalculateBoundary()
void OnAppJobNotification(CEvent *event)
functions below handle notifications from the IAppJob
TBoundingState GetBoundedDisplay() const
void x_Layout(CPhyloTreeDataSource &ds)
CPhyloTree * GetTree()
double GetNormDistance(void)
CTreeGraphicsModel & GetModel()
Get model for rendering.
TModelRect GetBoundRect()
int NumChildren() const
Return the number of immediate children of this node.
bool IsLeafEx() const
Return true if node is a leaf or is collapsed.
class CPhyloTreePS
void SetPhysicsParms(const PhysicsParms &p)
Get/Set all the current physics parms.
void Init(CPhyloTreeDataSource &ds)
void SetVelocityThresholdK(float k)
Get/Set scaling factor for velocity threshold below which system stops.
PhysicsParms getPhysicParms()
bool IsDone() const
Return true if velocity has dropped below a threshold that indicates the system is stable (and doesn'...
void UpdateAndSynch()
Calculate forces, update positions, and update underlying tree.
void Update()
Calculate force then update positions.
Tree subclass also has functions and data needed for rendering and selection.
Definition: phylo_tree.hpp:52
class CRgbaColor provides a simple abstraction for managing colors.
Definition: rgba_color.hpp:58
CStopWatch –.
Definition: ncbitime.hpp:1937
TData & GetValue()
Return the value object for the node.
Definition: tree_model.hpp:159
TNodeType & GetRoot()
Return a reference to the root node of the tree.
Definition: tree_model.hpp:254
virtual void HMGH_UpdateLimits(bool force_redraw=false)=0
virtual bool Render(CGlPane &pane, CPhyloTreeDataSource &ds)
Returns false if rendering does not occur (e.g.
virtual void x_ComputeNodeBoundary(CPhyloTree *tree, CPhyloTree::TNodeType &node, CBoundaryPoints &boundary_pts, const string &layout_type)
void InitLabel(CPhyloTree *tree, CPhyloTree::TNodeType &node)
Initialize (for current layout) label text and extent (label rectangle)
virtual void RemoveCurrentDataSource()
CGlPane * m_pPane
event handling
void CalculateExtents(CPhyloTree *tree, CPhyloTree::TNodeType &node)
CPhyloTreeDataSource * m_DS
void ComputeViewingLimits(CGlPane &pane, bool force_square=false, bool init_collision_info=true)
Compute the optimal viewing pane size so that the tree occupies the entire viewing area,...
IPhyloTreeRenderHost * m_pHost
virtual void StartRendering(bool b)
Allow caller to indicate layout has changed from one type to another (e.g.
#define true
Definition: bool.h:35
#define NULL
Definition: ncbistd.hpp:225
#define _TRACE(message)
Definition: ncbidbg.hpp:122
virtual void Enable(GLenum glstate)
glEnable() all options in m_Enabled
Definition: glstate.cpp:356
CGlState & GetState()
TModelRect & GetModelLimitsRect(void)
Definition: glpane.hpp:347
void Inflate(T d_x, T d_y)
Definition: glrect.hpp:178
void SetVisible(bool b)
Set/get node visibility.
virtual void BlendFunc(GLenum sfactor, GLenum dfactor)
Options to be used when GL_BLEND is enabled.
Definition: glstate.cpp:562
virtual void ColorC(const CRgbaColor &c)
Definition: glstate.cpp:449
CGlVboNode * FindGeomNode(const string &name)
Find a geometry (vertex buffer object) node by name.
Definition: glmodel2d.cpp:88
static CAppJobDispatcher & GetInstance()
virtual bool IsCanceled() const override
bool DeleteJob(TJobID job_id)
when a Job is deleted the listener is not notified
EJobState
Job states (describe FSM)
Definition: app_job.hpp:86
TJobID StartJob(IAppJob &job, const string &engine_name, IEngineParams *params=NULL)
Starts a Job on the specified engine in "passive mode" - no notifications or progress reports will be...
#define END_EVENT_MAP()
Ends definition of Command Map.
#define BEGIN_EVENT_MAP(thisClass, baseClass)
Begins definition of Command Map for CEventHandler-derived class.
virtual void RequestCancel() override
RequestCancel() is called to notify the Job that it shall exit Run() function ASAP.
TJobState GetState() const
TJobState GetJobState(TJobID job_id)
All Get() functions return values stored in the Registy not the actual.
void CancelJob(TJobID job_id)
@ eCompleted
Definition: app_job.hpp:89
@ eRunning
Definition: app_job.hpp:88
@ eInvalid
Definition: app_job.hpp:87
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
Definition: ncbiobj.hpp:735
CObject(void)
Constructor.
Definition: ncbiobj.cpp:738
TObjectType * GetPointerOrNull(void) THROWS_NONE
Get pointer value.
Definition: ncbiobj.hpp:986
int32_t Int4
4-byte (32-bit) signed integer
Definition: ncbitype.h:102
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
Definition: ncbitime.hpp:2775
void Start(void)
Start the timer.
Definition: ncbitime.hpp:2764
ETreeTraverseCode
Tree traverse code returned by the traverse predicate function.
Definition: ncbi_tree.hpp:51
@ eTreeTraverse
Keep traversal.
Definition: ncbi_tree.hpp:52
static CStopWatch sw
END_EVENT_TABLE()
int i
The NCBI C++/STL use hints.
Defines: CTimeFormat - storage class for time format.
Int4 delta(size_t dimension_, const Int4 *score_)
void TreeDepthFirstEx(TTreeModel &tree_model, typename TTreeModel::TTreeIdx node_idx, Fun &func)
Depth-first tree traversal that skips collapsed nodes.
Definition: phylo_tree.hpp:429
#define PHYLO_RENDER_TIMER_ID
ON_EVENT(CAppJobNotification, CAppJobNotification::eStateChanged, &CPhyloForce::OnAppJobNotification) ON_EVENT(CAppJobNotification
#define _ASSERT
else result
Definition: token2.c:20
Modified on Wed Jul 24 17:21:16 2024 by modify_doxy.py rev. 669887