1 | /* |
2 | * PROGRAM: Firebird interface. |
3 | * MODULE: firebird/Timer.h |
4 | * DESCRIPTION: Timer interface definition. |
5 | * |
6 | * The contents of this file are subject to the Initial |
7 | * Developer's Public License Version 1.0 (the "License"); |
8 | * you may not use this file except in compliance with the |
9 | * License. You may obtain a copy of the License at |
10 | * http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl. |
11 | * |
12 | * Software distributed under the License is distributed AS IS, |
13 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. |
14 | * See the License for the specific language governing rights |
15 | * and limitations under the License. |
16 | * |
17 | * The Original Code was created by Alex Peshkov |
18 | * for the Firebird Open Source RDBMS project. |
19 | * |
20 | * Copyright (c) 2011 Alex Peshkov <peshkoff at mail.ru> |
21 | * and all contributors signed below. |
22 | * |
23 | * All Rights Reserved. |
24 | * Contributor(s): ______________________________________. |
25 | * |
26 | * |
27 | */ |
28 | |
29 | #ifndef FIREBIRD_TIMER_H |
30 | #define FIREBIRD_TIMER_H |
31 | |
32 | #include "./Interface.h" |
33 | |
34 | namespace Firebird { |
35 | |
36 | // Identifies particular timer. |
37 | // Callback function is invoked when timer fires. |
38 | class ITimer : public IRefCounted |
39 | { |
40 | public: |
41 | virtual void FB_CARG handler() = 0; |
42 | }; |
43 | #define FB_TIMER_VERSION (FB_REFCOUNTED_VERSION + 1) |
44 | |
45 | typedef ISC_INT64 TimerDelay; |
46 | |
47 | // Interface to set timer for particular time |
48 | class ITimerControl : public IVersioned |
49 | { |
50 | public: |
51 | // Set timer |
52 | virtual void FB_CARG start(ITimer* timer, TimerDelay microSeconds) = 0; |
53 | // Stop timer |
54 | virtual void FB_CARG stop(ITimer* timer) = 0; |
55 | }; |
56 | #define FB_TIMER_CONTROL_VERSION (FB_VERSIONED_VERSION + 2) |
57 | |
58 | } // namespace Firebird |
59 | |
60 | |
61 | #endif // FIREBIRD_TIMER_H |
62 | |