Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
ara::com::helper::TtlTimer Class Reference

Time To Live countdown timer. More...

#include <ttl_timer.h>

Public Member Functions

 TtlTimer (const TtlTimer &)=delete
 
TtlTimeroperator= (const TtlTimer &)=delete
 
bool GetRequested () const noexcept
 Indicate whether the service client is requested or not. More...
 
void SetRequested (bool requested) noexcept
 Set the service requested status. More...
 
bool GetOffered () const noexcept
 Indicate whether the service server is offered or not. More...
 
void SetOffered (uint32_t ttl) noexcept
 Set the service offered status. More...
 
void WaitForSignal ()
 Wait for a signal from SetRequested or SetOffered. More...
 
bool WaitForExpiration ()
 Wait for the timer to expire or reset. More...
 
void Dispose () noexcept
 Dispose the timer which causes all the waitings return immediately. More...
 

Detailed Description

Time To Live countdown timer.

Note
The timer is not copyable.

Member Function Documentation

◆ Dispose()

void ara::com::helper::TtlTimer::Dispose ( )
noexcept

Dispose the timer which causes all the waitings return immediately.

Remarks
The side effect of this function call is irreversible.

◆ GetOffered()

bool ara::com::helper::TtlTimer::GetOffered ( ) const
noexcept

Indicate whether the service server is offered or not.

Returns
True if the service server is offered, otherwise false
See also
SetOffered

◆ GetRequested()

bool ara::com::helper::TtlTimer::GetRequested ( ) const
noexcept

Indicate whether the service client is requested or not.

Returns
True if the service client is requested, otherwise false
See also
SetRequested

◆ SetOffered()

void ara::com::helper::TtlTimer::SetOffered ( uint32_t  ttl)
noexcept

Set the service offered status.

Parameters
ttlReceived service offer entry TTL
See also
GetOffered
Note
Zero TTL indicates stop offering.

◆ SetRequested()

void ara::com::helper::TtlTimer::SetRequested ( bool  requested)
noexcept

Set the service requested status.

Parameters
requestedService client requested status
See also
GetRequested

◆ WaitForExpiration()

bool ara::com::helper::TtlTimer::WaitForExpiration ( )

Wait for the timer to expire or reset.

Returns
True if the TTL is expired, otherwise false in case of timer reset

◆ WaitForSignal()

void ara::com::helper::TtlTimer::WaitForSignal ( )

Wait for a signal from SetRequested or SetOffered.

See also
SetRequested(bool)
SetOffered(uint32_t)