Skip to main content

Polling

Summary

MembersDescriptions
class URH_PollingSettingsSettings for polling.
struct FRH_PollTimerSettingSettings for polling timers.
struct FRH_PollControlController for the polling.
struct FRH_AutoPollerAuto Poller to poll at a given interval for updates.

class URH_PollingSettings

class URH_PollingSettings
: public UDeveloperSettings

Settings for polling.

Summary

MembersDescriptions
public TArray< FRH_PollTimerSetting>PollingIntervalsArray of all polling timers.
public FRH_PollTimerSetting DefaultPollingTimerDefault polling time.

Members

public TArray< FRH_PollTimerSetting>PollingIntervals

Array of all polling timers.

public FRH_PollTimerSetting DefaultPollingTimer

Default polling time.

struct FRH_PollTimerSetting

Settings for polling timers.

Summary

MembersDescriptions
public FName TimerNameName of the timer.
public bool bDisabledName of the timer.
public float IntervalPoll interval of the timer.
public float JitterPctHow much jitter to add to the timer.
public float JitterPctInitialHow much jitter to add to the timer when started.
public inline FRH_PollTimerSetting()Default constructor, 60 seconds timer.

Members

public FName TimerName

Name of the timer.

public bool bDisabled

Name of the timer.

public float Interval

Poll interval of the timer.

public float JitterPct

How much jitter to add to the timer.

public float JitterPctInitial

How much jitter to add to the timer when started.

public inline FRH_PollTimerSetting()

Default constructor, 60 seconds timer.

struct FRH_PollControl

struct FRH_PollControl
: public FTickableGameObject

Controller for the polling.

Summary

MembersDescriptions
public FRH_PollControl()Default controller.
public void Register(FRH_AutoPollerPtr Ptr)Register an auto poller with the Poll Controller.
public void Unregister(FRH_AutoPollerPtr Ptr)Unregister an auto poller with the Poll Controller.
public void Unregister(const FRH_AutoPoller * Ptr)Used as a final unregister in the destructor, which cannot use a shared pointer.
public inline FORCEINLINE bool IsRegistered(const TSharedPtr< const FRH_AutoPoller > & Ptr) constGets if a given auto poller is registered.
public inline FORCEINLINE bool IsActive(const TSharedPtr< const FRH_AutoPoller > & Ptr) constGets if a given auto poller is active.
public inline FORCEINLINE bool IsWaiting(const TSharedPtr< const FRH_AutoPoller > & Ptr) constGets if a given auto poller is waiting.
public inline FORCEINLINE bool IsInactive(const TSharedPtr< const FRH_AutoPoller > & Ptr) constGets if a given auto poller is inactive.
public inline FORCEINLINE bool IsExecuting(const TSharedPtr< const FRH_AutoPoller > & Ptr) constGets if a given auto poller is executing.
public void SetPollInactive(FRH_AutoPollerPtr Ptr)Sets an auto poller to inactive.
public void SetPollWaiting(FRH_AutoPollerPtr Ptr)Sets an auto poller to waiting.
public void SetPollExecuting(FRH_AutoPollerPtr Ptr)Sets an auto poller to executing.
public virtual void Tick(float DeltaTime)Scan Waiting list to determine if any need to be kicked off.
public inline virtual bool IsTickable() constPoll controller is always tickable.
public inline virtual TStatId GetStatId() constGets the poll controller stat Id.
public void SetPollingIntervalOverride(const FRH_PollTimerSetting & TimerSetting)Sets a polling interval override by name.
public void ClearPollingIntervalOverride(const FName & TimerName)Clears a polling interval override by name.
public const FRH_PollTimerSetting&GetPollTimerSetting(const FName & TimerName) constGets the polling interval setting (including overrides) by timer name.
public inline float GetPollingInterval(const FName & TimerName) constGets a polling interval by name, or falls back to default if not found.
public inline float GetPollingIntervalWithJitter(const FName & TimerName,bool bInitial) constGets a polling interval by name, or falls back to default if not found. Adds configured jitter.
protected TArray< FRH_AutoPollerWeakPtr > InactivePollsPolls that are registered but not active.
protected TArray< FRH_AutoPollerWeakPtr > WaitingPollsPolls waiting on their timer to complete, checked each tick.
protected TArray< FRH_AutoPollerWeakPtr > ExecutingPollsPolls with their poll function executing.
protected TArray< FRH_PollTimerSetting>PollingIntervalOverridesArray of all polling timers (overrides PollingIntervals).
protected void SortWaitingPolls()Sorts the waiting pollers for by their next poll time.

Members

public FRH_PollControl()

Default controller.

public void Register(FRH_AutoPollerPtr Ptr)

Register an auto poller with the Poll Controller.

Parameters

  • Ptr Auto poller to register.

public void Unregister(FRH_AutoPollerPtr Ptr)

Unregister an auto poller with the Poll Controller.

Parameters

  • Ptr Auto poller to unregister.

public void Unregister(const FRH_AutoPoller * Ptr)

Used as a final unregister in the destructor, which cannot use a shared pointer.

Parameters

  • Ptr Auto poller to unregister.

public inline FORCEINLINE bool IsRegistered(const TSharedPtr< const FRH_AutoPoller > & Ptr) const

Gets if a given auto poller is registered.

Parameters

  • Ptr Auto poller to check.

public inline FORCEINLINE bool IsActive(const TSharedPtr< const FRH_AutoPoller > & Ptr) const

Gets if a given auto poller is active.

Parameters

  • Ptr Auto poller to check.

public inline FORCEINLINE bool IsWaiting(const TSharedPtr< const FRH_AutoPoller > & Ptr) const

Gets if a given auto poller is waiting.

Parameters

  • Ptr Auto poller to check.

public inline FORCEINLINE bool IsInactive(const TSharedPtr< const FRH_AutoPoller > & Ptr) const

Gets if a given auto poller is inactive.

Parameters

  • Ptr Auto poller to check.

public inline FORCEINLINE bool IsExecuting(const TSharedPtr< const FRH_AutoPoller > & Ptr) const

Gets if a given auto poller is executing.

Parameters

  • Ptr Auto poller to check.

public void SetPollInactive(FRH_AutoPollerPtr Ptr)

Sets an auto poller to inactive.

Parameters

  • Ptr Auto poller to update.

public void SetPollWaiting(FRH_AutoPollerPtr Ptr)

Sets an auto poller to waiting.

Parameters

  • Ptr Auto poller to update.

public void SetPollExecuting(FRH_AutoPollerPtr Ptr)

Sets an auto poller to executing.

Parameters

  • Ptr Auto poller to update.

public virtual void Tick(float DeltaTime)

Scan Waiting list to determine if any need to be kicked off.

public inline virtual bool IsTickable() const

Poll controller is always tickable.

public inline virtual TStatId GetStatId() const

Gets the poll controller stat Id.

public void SetPollingIntervalOverride(const FRH_PollTimerSetting & TimerSetting)

Sets a polling interval override by name.

Parameters

  • TimerName Name of Timer to set interval for.

  • Interval Override Duration

public void ClearPollingIntervalOverride(const FName & TimerName)

Clears a polling interval override by name.

Parameters

  • TimerName Name of Timer to set interval for.

public const FRH_PollTimerSetting&GetPollTimerSetting(const FName & TimerName) const

Gets the polling interval setting (including overrides) by timer name.

Parameters

  • TimerName Name of Timer to set interval for.

Returns

Polling interval setting

public inline float GetPollingInterval(const FName & TimerName) const

Gets a polling interval by name, or falls back to default if not found.

Parameters

  • TimerName Name of Timer to get interval for.

Returns

Value of the polling interval

public inline float GetPollingIntervalWithJitter(const FName & TimerName,bool bInitial) const

Gets a polling interval by name, or falls back to default if not found. Adds configured jitter.

Parameters

  • TimerName Name of Timer to get interval for.

protected TArray< FRH_AutoPollerWeakPtr > InactivePolls

Polls that are registered but not active.

protected TArray< FRH_AutoPollerWeakPtr > WaitingPolls

Polls waiting on their timer to complete, checked each tick.

protected TArray< FRH_AutoPollerWeakPtr > ExecutingPolls

Polls with their poll function executing.

protected TArray< FRH_PollTimerSetting>PollingIntervalOverrides

Array of all polling timers (overrides PollingIntervals).

protected void SortWaitingPolls()

Sorts the waiting pollers for by their next poll time.

struct FRH_AutoPoller

struct FRH_AutoPoller
: public TSharedFromThis< FRH_AutoPoller >

Auto Poller to poll at a given interval for updates.

Summary

MembersDescriptions
public friend FRH_PollControl
public FRH_AutoPoller()Exposed for the shared pointer interface, please use CreateAutoPoller for construction.
public virtual ~FRH_AutoPoller()Default descrutor.
public void StartPoll(const FRH_PollFunc & InDelegate,const FName InTimerName,bool bImmediate,bool bCheckDisabledFlag)Starts a poll, only stores timer name, restart will always query settings for that timer name.
public void StopPoll()Stops the poller.
public void DeferPollTimer()Manually defer the poll timer (ex: out of band update). Safe to call at all times as it does not change state, only increments NextPollTime.
public void ExecutePoll()Executes the poller.
public inline FORCEINLINE bool IsRegistered() constGets if the poller is registered with poll control.
public inline FORCEINLINE bool IsActive() constGets if the poller is active with poll control.
public inline FORCEINLINE bool IsWaiting() constGets if the poller is waiting with poll control.
public inline FORCEINLINE bool IsInactive() constGets if the poller is inactive with poll control.
public inline FORCEINLINE bool IsExecuting() constGets if the poller is executing with poll control.
public inline FORCEINLINE const FDateTime & GetNextPollTime() constGets the next poll time.
public inline FORCEINLINE float GetTimeRemaining()Gets the poll time remaining in seconds. Returns -1.f if the poll is inactive or executing.
protected FDateTime NextPollTimeWhen the next poll should run.
protected FRH_PollFunc PollFuncCall when the poll timer fires.
protected FName TimerNameName of the timer to use for polling.
protected void OnPollFinished(bool bSuccess,bool bResetTimer)Called when a poll finishes.
protected void RestartTimer()
protected void Register()Registers with poll control (does not start timer).
protected void Unregister()Unregisters with poll control.

Members

public friend FRH_PollControl

public FRH_AutoPoller()

Exposed for the shared pointer interface, please use CreateAutoPoller for construction.

public virtual ~FRH_AutoPoller()

Default descrutor.

public void StartPoll(const FRH_PollFunc & InDelegate,const FName InTimerName,bool bImmediate,bool bCheckDisabledFlag)

Starts a poll, only stores timer name, restart will always query settings for that timer name.

Parameters

  • InDelegate Delegate to call when the poll timer fires.

  • InTimerName Name of Timer to get interval from.

  • bImmediate If the poll should start immediately.

  • bCheckDisabledFlag If the poll should check the disabled flag before starting (in which case state will be set to inactive)

public void StopPoll()

Stops the poller.

public void DeferPollTimer()

Manually defer the poll timer (ex: out of band update). Safe to call at all times as it does not change state, only increments NextPollTime.

public void ExecutePoll()

Executes the poller.

public inline FORCEINLINE bool IsRegistered() const

Gets if the poller is registered with poll control.

public inline FORCEINLINE bool IsActive() const

Gets if the poller is active with poll control.

public inline FORCEINLINE bool IsWaiting() const

Gets if the poller is waiting with poll control.

public inline FORCEINLINE bool IsInactive() const

Gets if the poller is inactive with poll control.

public inline FORCEINLINE bool IsExecuting() const

Gets if the poller is executing with poll control.

public inline FORCEINLINE const FDateTime & GetNextPollTime() const

Gets the next poll time.

public inline FORCEINLINE float GetTimeRemaining()

Gets the poll time remaining in seconds. Returns -1.f if the poll is inactive or executing.

protected FDateTime NextPollTime

When the next poll should run.

protected FRH_PollFunc PollFunc

Call when the poll timer fires.

protected FName TimerName

Name of the timer to use for polling.

protected void OnPollFinished(bool bSuccess,bool bResetTimer)

Called when a poll finishes.

Parameters

  • bSuccess If the poll was successful.

  • bResetTimer If the timer should be reset.

protected void RestartTimer()

protected void Register()

Registers with poll control (does not start timer).

protected void Unregister()

Unregisters with poll control.