| 
    KiCad PCB EDA Suite
    
   | 
 
A helper class to manage the activation of a "proposal" after a timeout. More...
Public Types | |
| using | ACTIVATION_CALLBACK = std::function<void( T&& )> | 
Public Member Functions | |
| ACTIVATION_HELPER (std::chrono::milliseconds aTimeout, ACTIVATION_CALLBACK aCallback) | |
| ~ACTIVATION_HELPER () | |
| void | ProposeActivation (T &&aProposal, std::size_t aProposalTag, bool aAcceptImmediately) | 
| void | CancelProposal () | 
Private Member Functions | |
| void | onTimerExpiry (wxTimerEvent &aEvent) | 
| Timer expiry callback in the UI thread.   | |
| void | acceptPendingProposal () | 
Private Attributes | |
| std::mutex | m_mutex | 
| std::chrono::milliseconds | m_timeout | 
| Activation timeout in milliseconds.   | |
| std::optional< std::size_t > | m_pendingProposalTag | 
| The last proposal tag that was made.   | |
| std::optional< std::size_t > | m_lastAcceptedProposalTag | 
| The last proposal that was accepted.   | |
| T | m_lastProposal | 
| The most recently-proposed item.   | |
| ACTIVATION_CALLBACK | m_callback | 
| Callback to call when the proposal is accepted.   | |
| wxTimer | m_timer | 
A helper class to manage the activation of a "proposal" after a timeout.
When a proposal is made, a timer starts. If no new proposal is made and the proposal is not canceled before the timer expires, the proposal is "accepted" via a callback.
Proposals are "tagged" with a hash - this is used to avoid reproposing the same thing multiple times.
| T | The type of the proposal, which will be passed to the callback (by value) | 
Definition at line 55 of file construction_manager.cpp.
| using ACTIVATION_HELPER< T >::ACTIVATION_CALLBACK = std::function<void( T&& )> | 
Definition at line 58 of file construction_manager.cpp.
      
  | 
  inline | 
Definition at line 60 of file construction_manager.cpp.
References m_callback, m_timeout, m_timer, move, and onTimerExpiry().
      
  | 
  inline | 
Definition at line 67 of file construction_manager.cpp.
References m_mutex, m_pendingProposalTag, m_timer, and onTimerExpiry().
      
  | 
  inlineprivate | 
Definition at line 127 of file construction_manager.cpp.
References m_callback, m_lastAcceptedProposalTag, m_lastProposal, m_mutex, m_pendingProposalTag, and T.
Referenced by onTimerExpiry(), and ProposeActivation().
      
  | 
  inline | 
Definition at line 111 of file construction_manager.cpp.
References m_mutex, m_pendingProposalTag, and m_timer.
      
  | 
  inlineprivate | 
Timer expiry callback in the UI thread.
Definition at line 122 of file construction_manager.cpp.
References acceptPendingProposal().
Referenced by ACTIVATION_HELPER(), and ~ACTIVATION_HELPER().
      
  | 
  inline | 
Definition at line 79 of file construction_manager.cpp.
References acceptPendingProposal(), m_lastAcceptedProposalTag, m_lastProposal, m_mutex, m_pendingProposalTag, m_timeout, m_timer, and T.
      
  | 
  private | 
Callback to call when the proposal is accepted.
Definition at line 161 of file construction_manager.cpp.
Referenced by acceptPendingProposal(), and ACTIVATION_HELPER().
      
  | 
  private | 
The last proposal that was accepted.
Definition at line 155 of file construction_manager.cpp.
Referenced by acceptPendingProposal(), and ProposeActivation().
      
  | 
  private | 
The most recently-proposed item.
Definition at line 158 of file construction_manager.cpp.
Referenced by acceptPendingProposal(), and ProposeActivation().
      
  | 
  mutableprivate | 
Definition at line 146 of file construction_manager.cpp.
Referenced by acceptPendingProposal(), CancelProposal(), ProposeActivation(), and ~ACTIVATION_HELPER().
      
  | 
  private | 
The last proposal tag that was made.
Definition at line 152 of file construction_manager.cpp.
Referenced by acceptPendingProposal(), CancelProposal(), ProposeActivation(), and ~ACTIVATION_HELPER().
      
  | 
  private | 
Activation timeout in milliseconds.
Definition at line 149 of file construction_manager.cpp.
Referenced by ACTIVATION_HELPER(), and ProposeActivation().
      
  | 
  private | 
Definition at line 163 of file construction_manager.cpp.
Referenced by ACTIVATION_HELPER(), CancelProposal(), ProposeActivation(), and ~ACTIVATION_HELPER().