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) |
void | CancelProposal () |
void | ProposalCheckFunction () |
Private Attributes | |
std::mutex | m_mutex |
std::chrono::milliseconds | m_timeout |
std::chrono::time_point< std::chrono::steady_clock > | m_proposalDeadline |
The last proposal tag that was made. | |
std::optional< std::size_t > | m_pendingProposalTag |
The last proposal that was accepted. | |
std::optional< std::size_t > | m_lastAcceptedProposalTag |
T | m_lastProposal |
Callback to call when the proposal is accepted. | |
ACTIVATION_CALLBACK | m_callback |
std::condition_variable | m_cv |
std::atomic< bool > | m_stop |
std::thread | m_thread |
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 cancelled before the timer expires, the proposal is "accepted" via a callback.
Propos
T | The type of the proposal, which will be passed to the callback (by value) |
Definition at line 44 of file construction_manager.cpp.
using ACTIVATION_HELPER< T >::ACTIVATION_CALLBACK = std::function<void( T&& )> |
Definition at line 47 of file construction_manager.cpp.
|
inline |
Definition at line 49 of file construction_manager.cpp.
|
inline |
Definition at line 55 of file construction_manager.cpp.
References ACTIVATION_HELPER< T >::m_cv, ACTIVATION_HELPER< T >::m_mutex, ACTIVATION_HELPER< T >::m_stop, and ACTIVATION_HELPER< T >::m_thread.
|
inline |
Definition at line 93 of file construction_manager.cpp.
References ACTIVATION_HELPER< T >::m_cv, ACTIVATION_HELPER< T >::m_mutex, and ACTIVATION_HELPER< T >::m_pendingProposalTag.
|
inline |
Definition at line 100 of file construction_manager.cpp.
References ACTIVATION_HELPER< T >::m_callback, ACTIVATION_HELPER< T >::m_cv, ACTIVATION_HELPER< T >::m_lastAcceptedProposalTag, ACTIVATION_HELPER< T >::m_lastProposal, ACTIVATION_HELPER< T >::m_mutex, ACTIVATION_HELPER< T >::m_pendingProposalTag, ACTIVATION_HELPER< T >::m_proposalDeadline, and ACTIVATION_HELPER< T >::m_stop.
|
inline |
Definition at line 70 of file construction_manager.cpp.
References ACTIVATION_HELPER< T >::m_cv, ACTIVATION_HELPER< T >::m_lastAcceptedProposalTag, ACTIVATION_HELPER< T >::m_lastProposal, ACTIVATION_HELPER< T >::m_mutex, ACTIVATION_HELPER< T >::m_pendingProposalTag, ACTIVATION_HELPER< T >::m_proposalDeadline, and ACTIVATION_HELPER< T >::m_timeout.
|
private |
Definition at line 161 of file construction_manager.cpp.
Referenced by ACTIVATION_HELPER< T >::ProposalCheckFunction().
|
private |
Definition at line 162 of file construction_manager.cpp.
Referenced by ACTIVATION_HELPER< T >::CancelProposal(), ACTIVATION_HELPER< T >::ProposalCheckFunction(), ACTIVATION_HELPER< T >::ProposeActivation(), and ACTIVATION_HELPER< T >::~ACTIVATION_HELPER().
|
private |
Definition at line 155 of file construction_manager.cpp.
Referenced by ACTIVATION_HELPER< T >::ProposalCheckFunction(), and ACTIVATION_HELPER< T >::ProposeActivation().
|
private |
Callback to call when the proposal is accepted.
Definition at line 158 of file construction_manager.cpp.
Referenced by ACTIVATION_HELPER< T >::ProposalCheckFunction(), and ACTIVATION_HELPER< T >::ProposeActivation().
|
mutableprivate |
Definition at line 144 of file construction_manager.cpp.
Referenced by ACTIVATION_HELPER< T >::CancelProposal(), ACTIVATION_HELPER< T >::ProposalCheckFunction(), ACTIVATION_HELPER< T >::ProposeActivation(), and ACTIVATION_HELPER< T >::~ACTIVATION_HELPER().
|
private |
The last proposal that was accepted.
Definition at line 152 of file construction_manager.cpp.
Referenced by ACTIVATION_HELPER< T >::CancelProposal(), ACTIVATION_HELPER< T >::ProposalCheckFunction(), and ACTIVATION_HELPER< T >::ProposeActivation().
|
private |
The last proposal tag that was made.
Definition at line 149 of file construction_manager.cpp.
Referenced by ACTIVATION_HELPER< T >::ProposalCheckFunction(), and ACTIVATION_HELPER< T >::ProposeActivation().
|
private |
Definition at line 163 of file construction_manager.cpp.
Referenced by ACTIVATION_HELPER< T >::ProposalCheckFunction(), and ACTIVATION_HELPER< T >::~ACTIVATION_HELPER().
|
private |
Definition at line 165 of file construction_manager.cpp.
Referenced by ACTIVATION_HELPER< T >::~ACTIVATION_HELPER().
|
private |
Definition at line 147 of file construction_manager.cpp.
Referenced by ACTIVATION_HELPER< T >::ProposeActivation().