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 {
49 class core_export_ timer final : public object {
50 struct data;
51 public:
53
60 explicit timer(const timer_callback& callback);
68 timer(const timer_callback& callback, int32 due_time, int32 period);
76 timer(const timer_callback& callback, int64 due_time, int64 period);
84 timer(const timer_callback& callback, const time_span& due_time, const time_span& period);
92 timer(const timer_callback& callback, uint32 due_time, uint32 period);
101 timer(const timer_callback& callback, std::any state, int32 due_time, int32 period);
110 timer(const timer_callback& callback, std::any state, int64 due_time, int64 period);
119 timer(const timer_callback& callback, std::any state, const time_span& due_time, const time_span& period);
128 timer(const timer_callback& callback, std::any state, uint32 due_time, uint32 period);
130
132 template <typename callback_t>
133 timer(callback_t callback) : timer(timer_callback {callback}) {}
134 template <typename callback_t>
135 timer(callback_t callback, int32 due_time, int32 period) : timer(timer_callback {callback}, due_time, period) {}
136 template <typename callback_t>
137 timer(callback_t callback, int64 due_time, int64 period) : timer(timer_callback {callback}, due_time, period) {}
138 template <typename callback_t>
139 timer(callback_t callback, const time_span& due_time, const time_span& period) : timer(timer_callback {callback}, due_time, period) {}
140 template <typename callback_t>
141 timer(callback_t callback, uint32 due_time, uint32 period) : timer(timer_callback {callback}, due_time, period) {}
142 template <typename callback_t>
143 timer(callback_t callback, std::any state, int32 due_time, int32 period) : timer(timer_callback {callback}, due_time, period) {}
144 template <typename callback_t>
145 timer(callback_t callback, std::any state, int64 due_time, int64 period) : timer(timer_callback {callback}, due_time, period) {}
146 template <typename callback_t>
147 timer(callback_t callback, std::any state, const time_span& due_time, const time_span& period) : timer(timer_callback {callback}, due_time, period) {}
148 template <typename callback_t>
149 timer(callback_t callback, std::any state, uint32 due_time, uint32 period) : timer(timer_callback {callback}, due_time, period) {}
150 timer();
151 timer(const timer& timer);
152 timer& operator=(const timer& timer);
153 ~timer();
155
157
163 void change(int32 due_time, int32 period);
168 void change(int64 due_time, int64 period);
174 void change(const time_span& due_time, const time_span& period);
179 void change(uint32 due_time, uint32 period);
180
182 void close();
184
185 private:
186 xtd::sptr<data> data_;
187 };
188 }
189}
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:42
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.
Provides a mechanism for executing a method on a thread pool thread at specified intervals....
Definition timer.h:49
#define core_export_
Define shared library export.
Definition core_export.h:13
int32_t int32
Represents a 32-bit signed integer.
Definition int32.h:23
int64_t int64
Represents a 64-bit signed integer.
Definition int64.h:23
uint32_t uint32
Represents a 32-bit unsigned integer.
Definition uint32.h:23
std::shared_ptr< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.h:25
action< std::any > timer_callback
Represents the method that handles calls from a xtd::threading::timer.
Definition timer_callback.h:28
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:29
Contains xtd::threading::timer_callback exception.