class ugcs::vsm::Timer_processor::Timer

Overview

Represents timer instance. More…

#include <timer_processor.h>

class Timer: public std::enable_shared_from_this< Timer >
{
public:
    // typedefs

    typedef std::shared_ptr<Timer> Ptr;
    typedef std::weak_ptr<Timer> Weak_ptr;

    // construction

    Timer(const Timer_processor::Ptr& processor, std::chrono::milliseconds interval);

    // methods

    template <typename... Args>
    static Ptr Create(Args&&... args);

    void Cancel();
    bool Is_running() const;
    std::chrono::steady_clock::time_point Get_fire_time() const;
};

Detailed Documentation

Represents timer instance.

Typedefs

typedef std::shared_ptr<Timer> Ptr

Pointer type.

typedef std::weak_ptr<Timer> Weak_ptr

Pointer type.

Construction

Timer(const Timer_processor::Ptr& processor, std::chrono::milliseconds interval)

Construct timer instance associated with a processor.

Methods

template <typename... Args>
static Ptr Create(Args&&... args)

Create an instance.

void Cancel()

Cancel running timer.

Do nothing if timer is not running.

bool Is_running() const

Check if the timer still is running - i.e.

will produce handler invocations.

std::chrono::steady_clock::time_point Get_fire_time() const

Get time of next timer firing.