xtd 0.2.0
Loading...
Searching...
No Matches
timer.h
Go to the documentation of this file.
1
4#pragma once
5#include "timer_callback.h"
6#include "../core_export.h"
7#include "../object.h"
8#include "../time_span.h"
9#include "../types.h"
10
12namespace xtd {
14 namespace threading {
47 class core_export_ timer final : public object {
48 struct data;
49 public:
51
58 explicit timer(const timer_callback& callback);
66 timer(const timer_callback& callback, int32 due_time, int32 period);
74 timer(const timer_callback& callback, int64 due_time, int64 period);
82 timer(const timer_callback& callback, const time_span& due_time, const time_span& period);
90 timer(const timer_callback& callback, uint32 due_time, uint32 period);
99 timer(const timer_callback& callback, std::any state, int32 due_time, int32 period);
108 timer(const timer_callback& callback, std::any state, int64 due_time, int64 period);
117 timer(const timer_callback& callback, std::any state, const time_span& due_time, const time_span& period);
126 timer(const timer_callback& callback, std::any state, uint32 due_time, uint32 period);
128
130 template <typename callback_t>
131 timer(callback_t callback) : timer(timer_callback {callback}) {}
132 template <typename callback_t>
133 timer(callback_t callback, int32 due_time, int32 period) : timer(timer_callback {callback}, due_time, period) {}
134 template <typename callback_t>
135 timer(callback_t callback, int64 due_time, int64 period) : timer(timer_callback {callback}, due_time, period) {}
136 template <typename callback_t>
137 timer(callback_t callback, const time_span& due_time, const time_span& period) : timer(timer_callback {callback}, due_time, period) {}
138 template <typename callback_t>
139 timer(callback_t callback, uint32 due_time, uint32 period) : timer(timer_callback {callback}, due_time, period) {}
140 template <typename callback_t>
141 timer(callback_t callback, std::any state, int32 due_time, int32 period) : timer(timer_callback {callback}, due_time, period) {}
142 template <typename callback_t>
143 timer(callback_t callback, std::any state, int64 due_time, int64 period) : timer(timer_callback {callback}, due_time, period) {}
144 template <typename callback_t>
145 timer(callback_t callback, std::any state, const time_span& due_time, const time_span& period) : timer(timer_callback {callback}, due_time, period) {}
146 template <typename callback_t>
147 timer(callback_t callback, std::any state, uint32 due_time, uint32 period) : timer(timer_callback {callback}, due_time, period) {}
148 timer();
149 timer(const timer& timer);
150 timer& operator=(const timer& timer);
151 ~timer();
153
155
161 void change(int32 due_time, int32 period);
166 void change(int64 due_time, int64 period);
172 void change(const time_span& due_time, const time_span& period);
177 void change(uint32 due_time, uint32 period);
178
180 void close();
182
183 private:
184 std::shared_ptr<data> data_;
185 };
186 }
187}
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:32
Provides a mechanism for executing a method on a thread pool thread at specified intervals....
Definition timer.h:47
void change(int64 due_time, int64 period)
changes the start time and the interval between method invocations for a timer, using 64-bit signed i...
timer(const timer_callback &callback, int32 due_time, int32 period)
Initializes a new instance of the timer class, using a 32-bit signed integer to specify the time inte...
timer(const timer_callback &callback, int64 due_time, int64 period)
Initializes a new instance of the timer class, using a 64-bit signed integer to specify the time inte...
void change(int32 due_time, int32 period)
changes the start time and the interval between method invocations for a timer, using 32-bit signed i...
timer(const timer_callback &callback, std::any state, uint32 due_time, uint32 period)
Initializes a new instance of the timer class, using a 32-bit unsigned integer to specify the time in...
void change(uint32 due_time, uint32 period)
changes the start time and the interval between method invocations for a timer, using 32-bit unsigned...
timer(const timer_callback &callback, std::any state, int64 due_time, int64 period)
Initializes a new instance of the timer class, using a 64-bit signed integer to specify the time inte...
timer(const timer_callback &callback, std::any state, const time_span &due_time, const time_span &period)
Initializes a new instance of the timer class, using a TimaSpan to specify the time interval.
timer(const timer_callback &callback, uint32 due_time, uint32 period)
Initializes a new instance of the timer class, using a 32-bit unsigned integer to specify the time in...
void change(const time_span &due_time, const time_span &period)
changes the start time and the interval between method invocations for a timer, using time_span value...
timer(const timer_callback &callback, std::any state, int32 due_time, int32 period)
Initializes a new instance of the timer class, using a 32-bit signed integer to specify the time inte...
timer(const timer_callback &callback, const time_span &due_time, const time_span &period)
Initializes a new instance of the timer class, using a TimaSpan to specify the time interval.
timer(const timer_callback &callback)
Initializes a new instance of the timer class with an infinite period and an infinite due time,...
void close()
Releases all resources used by the current instance of xtd::threading::timer.
#define core_export_
Define shared library export.
Definition core_export.h:13
int_least64_t int64
Represents a 64-bit signed integer.
Definition types.h:142
int_least32_t int32
Represents a 32-bit signed integer.
Definition types.h:131
uint_least32_t uint32
Represents a 32-bit unsigned integer.
Definition types.h:241
action< std::any > timer_callback
Represents the method that handles calls from a xtd::threading::timer.
Definition timer_callback.h:26
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Represents a time interval.
Definition time_span.h:26
Contains xtd::threading::timer_callback exception.