SourceXtractorPlusPlus  0.11
Please provide a description of the project.
ProgressMediator.h
Go to the documentation of this file.
1 
17 /*
18  * ProgressMediator.h
19  *
20  * Created on: Sep 07, 2018
21  * Author: Alejandro Alvarez Ayllon
22  */
23 
24 #ifndef _SEMAIN_PROGRESSLISTENER_H
25 #define _SEMAIN_PROGRESSLISTENER_H
26 
29 #include "SEUtils/Observable.h"
30 #include <atomic>
31 #include <mutex>
32 
33 namespace SourceXtractor {
34 
35 struct ProgressInfo {
38 
39  ProgressInfo(const std::string &name, int done, int total): m_label(name), m_done(done), m_total(total) {}
40 };
41 
44 
52 public:
56 
57  ~ProgressMediator() = default;
58 
63 
68 
73 
78 
83 
87  void done();
88 
92  void update(void);
93 
94 private:
96  std::atomic_int m_detected, m_deblended, m_measured;
97 
101 
102  // Mediator serializes the notifications, so the observers do not need to worry about
103  // being called from multiple threads
105 
106  // This is a set of internal classes that implement the Observer pattern for different stages.
107  class ProgressCounter;
108  class SourceCounter;
109  class GroupCounter;
110 };
111 
112 } // end SourceXtractor
113 
114 #endif // _SEMAIN_PROGRESSLISTENER_H
Observable< bool > DoneObservable
Used to notify observers of the progress of the processing of the image.
Definition: Segmentation.h:48
Observer< std::shared_ptr< SourceGroupInterface > > group_observer_t
std::shared_ptr< group_observer_t > & getMeasurementObserver(void)
std::shared_ptr< group_observer_t > & getDeblendingObserver(void)
Observer< SegmentationProgress > segmentation_observer_t
STL class.
ProgressInfo(const std::string &name, int done, int total)
Implements the Observer pattern. Notifications will be made using a message of type T...
Definition: Observable.h:51
std::shared_ptr< source_observer_t > & getDetectionObserver(void)
std::shared_ptr< source_observer_t > m_detection_listener
std::shared_ptr< segmentation_observer_t > & getSegmentationObserver(void)
SegmentationProgress m_segmentation_progress
Observable< std::list< ProgressInfo > > ProgressObservable
std::shared_ptr< segmentation_observer_t > m_segmentation_listener
std::shared_ptr< group_observer_t > m_deblending_listener
std::shared_ptr< group_observer_t > m_measurement_listener
Observer< std::shared_ptr< SourceInterface > > source_observer_t