NorMIT-nav  22.09
An IGT application
cxCompositeTimedAlgorithm.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #ifndef CXCOMPOSITETIMEDALGORITHM_H_
13 #define CXCOMPOSITETIMEDALGORITHM_H_
14 
15 #include "cxResourceExport.h"
16 
17 #include "cxTimedAlgorithm.h"
18 
19 #include <boost/function.hpp>
20 
21 namespace cx
22 {
23 
27 class cxResource_EXPORT CompositeTimedAlgorithm : public TimedBaseAlgorithm
28 {
29 public:
30  CompositeTimedAlgorithm(QString name);
31  virtual void append(TimedAlgorithmPtr child);
32  virtual void clear() = 0;
33 
34 protected:
35  std::vector<TimedAlgorithmPtr> mChildren;
36 };
37 typedef boost::shared_ptr<CompositeTimedAlgorithm> CompositeTimedAlgorithmPtr;
38 
39 
40 
41 
52 {
53  Q_OBJECT
54 
55 public:
56  explicit CompositeSerialTimedAlgorithm(QString name="composite");
57  virtual void clear();
58 
59  virtual QString getProduct() const;
60  virtual void execute();
61  virtual bool isFinished() const;
62  virtual bool isRunning() const;
63 
64 private slots:
65  void jumpToNextChild();
66 
67 private:
68  int mCurrent;
69 };
70 typedef boost::shared_ptr<CompositeSerialTimedAlgorithm> CompositeSerialTimedAlgorithmPtr;
71 
72 
73 
84 {
85  Q_OBJECT
86 
87 public:
88  CompositeParallelTimedAlgorithm(QString name="parallel");
89  virtual void clear();
90 
91  virtual QString getProduct() const;
92  virtual void execute();
93  virtual bool isFinished() const;
94  virtual bool isRunning() const;
95 
96 private slots:
97  void oneFinished();
98 
99 };
100 typedef boost::shared_ptr<CompositeParallelTimedAlgorithm> CompositeParallelTimedAlgorithmPtr;
101 
102 
103 }
104 
105 #endif /* CXCOMPOSITETIMEDALGORITHM_H_ */
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::CompositeSerialTimedAlgorithm
Definition: cxCompositeTimedAlgorithm.h:51
cx::TimedAlgorithmPtr
boost::shared_ptr< class TimedBaseAlgorithm > TimedAlgorithmPtr
Definition: cxReconstructionExecuter.h:27
cx::CompositeParallelTimedAlgorithmPtr
boost::shared_ptr< CompositeParallelTimedAlgorithm > CompositeParallelTimedAlgorithmPtr
Definition: cxCompositeTimedAlgorithm.h:100
cx::CompositeSerialTimedAlgorithmPtr
boost::shared_ptr< CompositeSerialTimedAlgorithm > CompositeSerialTimedAlgorithmPtr
Definition: cxCompositeTimedAlgorithm.h:70
cx::CompositeTimedAlgorithm
Definition: cxCompositeTimedAlgorithm.h:27
cx::CompositeTimedAlgorithmPtr
boost::shared_ptr< class CompositeTimedAlgorithm > CompositeTimedAlgorithmPtr
Definition: cxUsReconstructionService.h:34
cx::CompositeParallelTimedAlgorithm
Definition: cxCompositeTimedAlgorithm.h:83
cx::CompositeTimedAlgorithm::mChildren
std::vector< TimedAlgorithmPtr > mChildren
Definition: cxCompositeTimedAlgorithm.h:35
cx::TimedBaseAlgorithm
Base class for algorithms that wants to time their execution.
Definition: cxTimedAlgorithm.h:40
cxTimedAlgorithm.h