CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
timer.h
1
2#ifndef _aspose_system_threading_timer_h_
3#define _aspose_system_threading_timer_h_
4
5#include <system/threading/timeout.h>
6#include <system/shared_ptr.h>
7#include <system/multicast_delegate.h>
8#include <system/timespan.h>
9
10
11namespace System { namespace Threading {
12
14using TimerCallback = System::MulticastDelegate<void(System::SharedPtr<System::Object>)>;
15
50class ASPOSECPP_SHARED_CLASS Timer final : public System::Object
51{
52friend class TimerQueue;
53public:
56 ASPOSECPP_SHARED_API Timer(TimerCallback callback);
62 ASPOSECPP_SHARED_API Timer(TimerCallback callback, const System::SharedPtr<System::Object>& state, int64_t dueTime, int64_t period);
68 ASPOSECPP_SHARED_API Timer(TimerCallback callback, const System::SharedPtr<System::Object>& state,
69 System::TimeSpan dueTime, System::TimeSpan period);
70
74 ASPOSECPP_SHARED_API bool Change(int64_t dueTime, int64_t period);
78 ASPOSECPP_SHARED_API bool Change(System::TimeSpan dueTime, System::TimeSpan period);
79
81 ASPOSECPP_SHARED_API void Dispose();
82
83protected:
85 ASPOSECPP_SHARED_API ~Timer() override;
86private:
88 TimerCallback m_callback;
92 int64_t m_dueTime;
94 int64_t m_period;
95
101 int64_t CheckRange(int64_t value, const String & field);
106 TimerCallback CheckCallback(TimerCallback callback);
107};
108
109}} // System::Threading
110#endif
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:62
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
Timer class that executes job item in separate thread after delay. Objects of this class should only ...
Definition: timer.h:51
bool Change(System::TimeSpan dueTime, System::TimeSpan period)
Re-schedules or cancels timer.
Timer(TimerCallback callback, const System::SharedPtr< System::Object > &state, int64_t dueTime, int64_t period)
Constructor.
~Timer() override
Destructor.
void Dispose()
De-schedules timer.
Timer(TimerCallback callback)
Constructor.
Timer(TimerCallback callback, const System::SharedPtr< System::Object > &state, System::TimeSpan dueTime, System::TimeSpan period)
Constructor.
bool Change(int64_t dueTime, int64_t period)
Re-schedules or cancels timer.
Queue that handles Timer objects. This is just an implementation. Timer objects register there by the...
Definition: timer_queue.h:22
Represents a time interval. This type should be allocated on stack and passed to functions by value o...
Definition: timespan.h:59
System::MulticastDelegate< void(System::SharedPtr< System::Object >)> TimerCallback
Callback function to be called by timer.
Definition: timer.h:14
Definition: db_command.h:9