PCL
pcl::Timer Class Reference

Client-side interface to a PixInsight Timer object. More...

#include <Timer.h>

+ Inheritance diagram for pcl::Timer:

Public Types

using timer_event_handler = void(Control::*)(Timer &sender)
 

Public Member Functions

 Timer ()
 
 ~Timer () override
 
unsigned Count () const
 
void EnsureUnique () override
 
double Interval () const
 
bool IsPeriodic () const
 
bool IsRunning () const
 
bool IsSingleShot () const
 
void OnTimer (timer_event_handler handler, Control &receiver)
 
void SetInterval (double seconds)
 
void SetPeriodic (bool p=true)
 
void SetSingleShot (bool=true)
 
void Start ()
 
void Stop ()
 
- Public Member Functions inherited from pcl::UIObject
virtual ~UIObject () noexcept(false)
 
bool IsAlias () const
 
bool IsGarbage () const
 
bool IsNull () const
 
bool IsSameObject (const UIObject &o) const
 
bool IsUnique () const
 
String ObjectId () const
 
IsoString ObjectType () const
 
bool operator< (const UIObject &o) const
 
bool operator== (const UIObject &o) const
 
size_type RefCount () const
 
void SetObjectId (const String &id)
 

Static Public Member Functions

static TimerNull ()
 
- Static Public Member Functions inherited from pcl::UIObject
static UIObjectNull ()
 

Additional Inherited Members

- Protected Member Functions inherited from pcl::UIObject
 UIObject ()=default
 
 UIObject (const UIObject &x)
 
 UIObject (UIObject &&x)
 
UIObjectoperator= (const UIObject &x)
 
UIObjectoperator= (UIObject &&x)
 

Detailed Description

A Timer object can work in two ways:

  • As a periodic timer, which generates a sequence of timer events at regular time intervals.
  • As a single-shot timer, which generates a single timer event after a prescribed time interval.

TODO: Write a detailed description for Timer.

Definition at line 82 of file Timer.h.

Constructor & Destructor Documentation

◆ Timer()

pcl::Timer::Timer ( )

Default constructor.

◆ ~Timer()

pcl::Timer::~Timer ( )
inlineoverride

Destroys a Timer object.

Definition at line 94 of file Timer.h.

Member Function Documentation

◆ Count()

unsigned pcl::Timer::Count ( ) const
inline

Returns the number of timer events generated after the last call to Start().

Definition at line 175 of file Timer.h.

◆ EnsureUnique()

void pcl::Timer::EnsureUnique ( )
inlineoverridevirtual

Ensures that the server-side object managed by this instance is uniquely referenced.

Since timers are unique objects by definition, calling this member function has no effect.

Reimplemented from pcl::UIObject.

Definition at line 105 of file Timer.h.

◆ Interval()

double pcl::Timer::Interval ( ) const

Returns the timer interval in seconds.

◆ IsPeriodic()

bool pcl::Timer::IsPeriodic ( ) const
inline

Returns true iff this is a periodic timer.

This is a convenience member function, equivalent to !IsSingleShot()

Definition at line 137 of file Timer.h.

◆ IsRunning()

bool pcl::Timer::IsRunning ( ) const

Returns true iff this Timer object is active. An active timer is generating timer events.

◆ IsSingleShot()

bool pcl::Timer::IsSingleShot ( ) const

Returns true iff this is a single-shot timer.

◆ Null()

static Timer& pcl::Timer::Null ( )
static

Returns a reference to a null Timer instance. A null Timer does not correspond to an existing timer in the PixInsight core application.

◆ SetInterval()

void pcl::Timer::SetInterval ( double  seconds)

Sets the timer interval in seconds.

◆ SetPeriodic()

void pcl::Timer::SetPeriodic ( bool  p = true)
inline

Enables or disables periodic mode for this Timer object.

Definition at line 150 of file Timer.h.

◆ SetSingleShot()

void pcl::Timer::SetSingleShot ( bool  = true)

Enables or disables single-shot mode for this Timer object.

◆ Start()

void pcl::Timer::Start ( )

Activates this Timer object. Starts generation of timer event(s).

◆ Stop()

void pcl::Timer::Stop ( )

Stops this Timer object, if it is currently active.


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