aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
progressNotification.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4  * info_at_agrum_dot_org
5  *
6  * This library is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 /**
23  * @file
24  * @brief priority queues (in which an element cannot appear more than once)
25  *
26  * @author Christophe GONZALES(@AMU) and Pierre-Henri WUILLEMIN(@LIP6)
27  *
28  */
29 
30 #ifndef AGRUM_PROGRESSNOTIFICATION_H
31 #define AGRUM_PROGRESSNOTIFICATION_H
32 
33 #include <agrum/tools/core/signal/signaler.h>
34 #include <agrum/tools/core/timer.h>
35 
36 namespace gum {
37 
38  /**
39  * @class ProgressNotifier
40  * @brief Notification for progress using listener
41  *
42  * An interface for progress notification
43  */
45  public:
46  /// Progression (percent) and time.
48 
49  /// with a possible explanation for stopping
50  Signaler1< const std::string& > onStop;
51  };
52 
53  /**
54  * @class ProgressListener
55  * @brief The ProgressListener class.
56  *
57  */
58  class ProgressListener: public Listener {
59  public:
60  /**
61  * @brief Class constructor.
62  * @param the progress notifier.
63  */
64  explicit ProgressListener(ProgressNotifier& notif);
65 
66  /**
67  * @brief Class destructor.
68  */
69  virtual ~ProgressListener();
70 
71  /**
72  * @brief When progress was made.
73  * @param src The signal source.
74  * @param step The advancement in percent.
75  * @param time The time.
76  */
77  virtual void whenProgress(const void* src, const Size step, const double time) = 0;
78 
79  /**
80  * @brief When it stops.
81  * @param src The signal source.
82  * @param message A message.
83  */
84  virtual void whenStop(const void* src, const std::string& message) = 0;
85 
86  protected:
87  /**
88  * Copy constructor.
89  */
90  ProgressListener(const ProgressListener& other);
91 
92  /**
93  * Copy operator.
94  */
96 
97  private:
98  /// The scheme configuration.
100  };
101 } // namespace gum
102 #endif // AGRUM_PROGRESSNOTIFICATION_H
Notification for progress using listener.
Signaler2< Size, double > onProgress
Progression (percent) and time.
virtual void whenProgress(const void *src, const Size step, const double time)=0
When progress was made.
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643
ProgressNotifier & _notif_
The scheme configuration.
ProgressListener(const ProgressListener &other)
Copy constructor.
virtual void whenStop(const void *src, const std::string &message)=0
When it stops.
virtual ~ProgressListener()
Class destructor.
ProgressListener(ProgressNotifier &notif)
Class constructor.
ProgressListener & operator=(const ProgressListener &other)
Copy operator.
Signaler1< const std::string &> onStop
with a possible explanation for stopping
The ProgressListener class.