xtd 0.2.0
Loading...
Searching...
No Matches
timer.h
Go to the documentation of this file.
1
4#pragma once
6#include "../core_export.h"
7#include "../event.h"
8#include "../isynchronize_invoke.h"
9#include "../object.h"
10#include "../time_span.h"
11#include "../types.h"
12
14namespace xtd {
16 namespace timers {
50 class core_export_ timer : public object {
51 struct data;
52 public:
54
69 explicit timer(double interval);
72 explicit timer(const xtd::time_span& interval);
74
76 timer(const timer& timer);
77 timer& operator=(const timer& timer);
78 ~timer();
80
82
88 bool auto_reset() const noexcept;
93 timer& auto_reset(bool value);
94
103 bool enabled() const noexcept;
112 timer& enabled(bool value);
113
122 double interval() const noexcept;
131 timer& interval(double value);
132
141 std::optional<std::reference_wrapper<isynchronize_invoke>> synchronizing_object() const noexcept;
149 timer& synchronizing_object(isynchronize_invoke& value);
157 timer& synchronizing_object(std::nullptr_t value);
159
161
171
173
176 void close();
177
181 void start();
182
186 void stop();
188
189 private:
190 void on_elpased(const elapsed_event_args& e);
191 xtd::sptr<data> data_;
192 };
193 }
194}
Represents an event.
Definition event.h:21
Provides a way to synchronously or asynchronously execute a delegate.
Definition isynchronize_invoke.h:26
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:42
Provides data for the xtd::timers::timer::elapsed event.
Definition elapsed_event_args.h:18
bool auto_reset() const noexcept
Gets a boolean indicating whether the xtd::timers::timer should raise the xtd::timers::timer::elapsed...
timer(const xtd::time_span &interval)
Initializes a new instance of the xtd::timers::timer class, setting the xtd::timers::timer::interval ...
timer(double interval)
Initializes a new instance of the xtd::timers::timer class, and sets the xtd::timers::timer::interval...
timer()
Initializes a new instance of the xtd::timers::timer class, and sets all the properties to their init...
Generates an event after a set interval, with an option to generate recurring events.
Definition timer.h:50
Contains xtd::timers::elapsed_event_handler event handler.
xtd::delegate< void(xtd::object &sender, const elapsed_event_args &e)> elapsed_event_handler
Represents the method that will handle the signal events of a xtd::environment.
Definition elapsed_event_handler.h:19
#define core_export_
Define shared library export.
Definition core_export.h:13
std::shared_ptr< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.h:25
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