Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
BT::TimerQueue< _Clock, _Duration > Class Template Reference

#include <timer_queue.h>

Classes

class  Queue
 
struct  WorkItem
 

Public Member Functions

uint64_t add (std::chrono::milliseconds milliseconds, std::function< void(bool)> handler)
 Adds a new timer. More...
 
size_t cancel (uint64_t id)
 Cancels the specified timer. More...
 
size_t cancelAll ()
 Cancels all timers. More...
 
 TimerQueue ()
 
 ~TimerQueue ()
 

Private Member Functions

std::pair< bool, std::chrono::time_point< _Clock, _Duration > > calcWaitTime ()
 
void checkWork ()
 
TimerQueueoperator= (const TimerQueue &)=delete
 
void run ()
 
 TimerQueue (const TimerQueue &)=delete
 

Private Attributes

details::Semaphore m_checkWork
 
bool m_finish = false
 
uint64_t m_idcounter = 0
 
BT::TimerQueue::Queue m_items
 
std::mutex m_mtx
 
std::thread m_th
 

Detailed Description

template<typename _Clock = std::chrono::steady_clock, typename _Duration = std::chrono::steady_clock::duration>
class BT::TimerQueue< _Clock, _Duration >

Definition at line 72 of file timer_queue.h.

Constructor & Destructor Documentation

◆ TimerQueue() [1/2]

template<typename _Clock = std::chrono::steady_clock, typename _Duration = std::chrono::steady_clock::duration>
BT::TimerQueue< _Clock, _Duration >::TimerQueue ( )
inline

Definition at line 75 of file timer_queue.h.

◆ ~TimerQueue()

template<typename _Clock = std::chrono::steady_clock, typename _Duration = std::chrono::steady_clock::duration>
BT::TimerQueue< _Clock, _Duration >::~TimerQueue ( )
inline

Definition at line 80 of file timer_queue.h.

◆ TimerQueue() [2/2]

template<typename _Clock = std::chrono::steady_clock, typename _Duration = std::chrono::steady_clock::duration>
BT::TimerQueue< _Clock, _Duration >::TimerQueue ( const TimerQueue< _Clock, _Duration > &  )
privatedelete

Member Function Documentation

◆ add()

template<typename _Clock = std::chrono::steady_clock, typename _Duration = std::chrono::steady_clock::duration>
uint64_t BT::TimerQueue< _Clock, _Duration >::add ( std::chrono::milliseconds  milliseconds,
std::function< void(bool)>  handler 
)
inline

Adds a new timer.

Definition at line 92 of file timer_queue.h.

◆ calcWaitTime()

template<typename _Clock = std::chrono::steady_clock, typename _Duration = std::chrono::steady_clock::duration>
std::pair<bool, std::chrono::time_point<_Clock, _Duration> > BT::TimerQueue< _Clock, _Duration >::calcWaitTime ( )
inlineprivate

Definition at line 202 of file timer_queue.h.

◆ cancel()

template<typename _Clock = std::chrono::steady_clock, typename _Duration = std::chrono::steady_clock::duration>
size_t BT::TimerQueue< _Clock, _Duration >::cancel ( uint64_t  id)
inline

Cancels the specified timer.

Definition at line 114 of file timer_queue.h.

◆ cancelAll()

template<typename _Clock = std::chrono::steady_clock, typename _Duration = std::chrono::steady_clock::duration>
size_t BT::TimerQueue< _Clock, _Duration >::cancelAll ( )
inline

Cancels all timers.

Definition at line 151 of file timer_queue.h.

◆ checkWork()

template<typename _Clock = std::chrono::steady_clock, typename _Duration = std::chrono::steady_clock::duration>
void BT::TimerQueue< _Clock, _Duration >::checkWork ( )
inlineprivate

Definition at line 224 of file timer_queue.h.

◆ operator=()

template<typename _Clock = std::chrono::steady_clock, typename _Duration = std::chrono::steady_clock::duration>
TimerQueue& BT::TimerQueue< _Clock, _Duration >::operator= ( const TimerQueue< _Clock, _Duration > &  )
privatedelete

◆ run()

template<typename _Clock = std::chrono::steady_clock, typename _Duration = std::chrono::steady_clock::duration>
void BT::TimerQueue< _Clock, _Duration >::run ( )
inlineprivate

Definition at line 175 of file timer_queue.h.

Member Data Documentation

◆ m_checkWork

template<typename _Clock = std::chrono::steady_clock, typename _Duration = std::chrono::steady_clock::duration>
details::Semaphore BT::TimerQueue< _Clock, _Duration >::m_checkWork
private

Definition at line 241 of file timer_queue.h.

◆ m_finish

template<typename _Clock = std::chrono::steady_clock, typename _Duration = std::chrono::steady_clock::duration>
bool BT::TimerQueue< _Clock, _Duration >::m_finish = false
private

Definition at line 243 of file timer_queue.h.

◆ m_idcounter

template<typename _Clock = std::chrono::steady_clock, typename _Duration = std::chrono::steady_clock::duration>
uint64_t BT::TimerQueue< _Clock, _Duration >::m_idcounter = 0
private

Definition at line 244 of file timer_queue.h.

◆ m_items

template<typename _Clock = std::chrono::steady_clock, typename _Duration = std::chrono::steady_clock::duration>
BT::TimerQueue::Queue BT::TimerQueue< _Clock, _Duration >::m_items
private

◆ m_mtx

template<typename _Clock = std::chrono::steady_clock, typename _Duration = std::chrono::steady_clock::duration>
std::mutex BT::TimerQueue< _Clock, _Duration >::m_mtx
private

Definition at line 257 of file timer_queue.h.

◆ m_th

template<typename _Clock = std::chrono::steady_clock, typename _Duration = std::chrono::steady_clock::duration>
std::thread BT::TimerQueue< _Clock, _Duration >::m_th
private

Definition at line 242 of file timer_queue.h.


The documentation for this class was generated from the following file:


behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Jun 28 2024 02:20:09