WPILibC++ 2024.3.2
wpi::CallbackThread< Derived, TUserInfo, TListenerData, TNotifierData > Class Template Reference

#include <wpi/CallbackManager.h>

Inheritance diagram for wpi::CallbackThread< Derived, TUserInfo, TListenerData, TNotifierData >:
wpi::SafeThread wpi::SafeThreadBase

Classes

struct  Poller
 

Public Types

using UserInfo = TUserInfo
 
using NotifierData = TNotifierData
 
using ListenerData = TListenerData
 

Public Member Functions

 CallbackThread (std::function< void()> on_start, std::function< void()> on_exit)
 
 ~CallbackThread () override
 
void Main () override
 
template<typename... Args>
void SendPoller (unsigned int poller_uid, Args &&... args)
 
- Public Member Functions inherited from wpi::SafeThread
void Stop () override
 
- Public Member Functions inherited from wpi::SafeThreadBase
virtual ~SafeThreadBase ()=default
 
virtual void Main ()=0
 
virtual void Stop ()=0
 

Public Attributes

wpi::UidVector< ListenerData, 64 > m_listeners
 
std::queue< std::pair< unsigned int, NotifierData > > m_queue
 
wpi::condition_variable m_queue_empty
 
wpi::UidVector< std::shared_ptr< Poller >, 64 > m_pollers
 
std::function< void()> m_on_start
 
std::function< void()> m_on_exit
 
- Public Attributes inherited from wpi::SafeThread
wpi::condition_variable m_cond
 
- Public Attributes inherited from wpi::SafeThreadBase
wpi::mutex m_mutex
 
std::atomic_bool m_active {true}
 
std::thread::id m_threadId
 

Member Typedef Documentation

◆ ListenerData

template<typename Derived , typename TUserInfo , typename TListenerData = CallbackListenerData<std::function<void(const TUserInfo& info)>>, typename TNotifierData = TUserInfo>
using wpi::CallbackThread< Derived, TUserInfo, TListenerData, TNotifierData >::ListenerData = TListenerData

◆ NotifierData

template<typename Derived , typename TUserInfo , typename TListenerData = CallbackListenerData<std::function<void(const TUserInfo& info)>>, typename TNotifierData = TUserInfo>
using wpi::CallbackThread< Derived, TUserInfo, TListenerData, TNotifierData >::NotifierData = TNotifierData

◆ UserInfo

template<typename Derived , typename TUserInfo , typename TListenerData = CallbackListenerData<std::function<void(const TUserInfo& info)>>, typename TNotifierData = TUserInfo>
using wpi::CallbackThread< Derived, TUserInfo, TListenerData, TNotifierData >::UserInfo = TUserInfo

Constructor & Destructor Documentation

◆ CallbackThread()

template<typename Derived , typename TUserInfo , typename TListenerData = CallbackListenerData<std::function<void(const TUserInfo& info)>>, typename TNotifierData = TUserInfo>
wpi::CallbackThread< Derived, TUserInfo, TListenerData, TNotifierData >::CallbackThread ( std::function< void()>  on_start,
std::function< void()>  on_exit 
)
inline

◆ ~CallbackThread()

template<typename Derived , typename TUserInfo , typename TListenerData = CallbackListenerData<std::function<void(const TUserInfo& info)>>, typename TNotifierData = TUserInfo>
wpi::CallbackThread< Derived, TUserInfo, TListenerData, TNotifierData >::~CallbackThread ( )
inlineoverride

Member Function Documentation

◆ Main()

template<typename Derived , typename TUserInfo , typename TListenerData , typename TNotifierData >
void wpi::CallbackThread< Derived, TUserInfo, TListenerData, TNotifierData >::Main
overridevirtual

Implements wpi::SafeThreadBase.

◆ SendPoller()

template<typename Derived , typename TUserInfo , typename TListenerData = CallbackListenerData<std::function<void(const TUserInfo& info)>>, typename TNotifierData = TUserInfo>
template<typename... Args>
void wpi::CallbackThread< Derived, TUserInfo, TListenerData, TNotifierData >::SendPoller ( unsigned int  poller_uid,
Args &&...  args 
)
inline

Member Data Documentation

◆ m_listeners

template<typename Derived , typename TUserInfo , typename TListenerData = CallbackListenerData<std::function<void(const TUserInfo& info)>>, typename TNotifierData = TUserInfo>
wpi::UidVector<ListenerData, 64> wpi::CallbackThread< Derived, TUserInfo, TListenerData, TNotifierData >::m_listeners

◆ m_on_exit

template<typename Derived , typename TUserInfo , typename TListenerData = CallbackListenerData<std::function<void(const TUserInfo& info)>>, typename TNotifierData = TUserInfo>
std::function<void()> wpi::CallbackThread< Derived, TUserInfo, TListenerData, TNotifierData >::m_on_exit

◆ m_on_start

template<typename Derived , typename TUserInfo , typename TListenerData = CallbackListenerData<std::function<void(const TUserInfo& info)>>, typename TNotifierData = TUserInfo>
std::function<void()> wpi::CallbackThread< Derived, TUserInfo, TListenerData, TNotifierData >::m_on_start

◆ m_pollers

template<typename Derived , typename TUserInfo , typename TListenerData = CallbackListenerData<std::function<void(const TUserInfo& info)>>, typename TNotifierData = TUserInfo>
wpi::UidVector<std::shared_ptr<Poller>, 64> wpi::CallbackThread< Derived, TUserInfo, TListenerData, TNotifierData >::m_pollers

◆ m_queue

template<typename Derived , typename TUserInfo , typename TListenerData = CallbackListenerData<std::function<void(const TUserInfo& info)>>, typename TNotifierData = TUserInfo>
std::queue<std::pair<unsigned int, NotifierData> > wpi::CallbackThread< Derived, TUserInfo, TListenerData, TNotifierData >::m_queue

◆ m_queue_empty

template<typename Derived , typename TUserInfo , typename TListenerData = CallbackListenerData<std::function<void(const TUserInfo& info)>>, typename TNotifierData = TUserInfo>
wpi::condition_variable wpi::CallbackThread< Derived, TUserInfo, TListenerData, TNotifierData >::m_queue_empty

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