Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | cron: add constructor and mutator for one-time events |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
61163cf23d357352029e1b4aa3b30484 |
| User & Date: | nat 2015-11-16 18:10:39.779 |
Context
|
2016-01-07
| ||
| 18:02 | cron-tests: test the new one-time events check-in: 10169cb96a user: nat tags: trunk | |
|
2015-11-16
| ||
| 18:10 | cron: add constructor and mutator for one-time events check-in: 61163cf23d user: nat tags: trunk | |
|
2015-11-14
| ||
| 18:12 | cron: use non-positive periods to mean non-repeating events check-in: c9ed8bd1e7 user: nat tags: trunk | |
Changes
Changes to src/natools-cron.adb.
| ︙ | ︙ | |||
77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
return Cron_Entry is
begin
return Result : Cron_Entry do
Result.Set (Time, Callback);
end return;
end Create;
function Create
(Period : in Duration;
Callback : in Cron.Callback'Class)
return Cron_Entry is
begin
return Result : Cron_Entry do
| > > > > > > > > > > > | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
return Cron_Entry is
begin
return Result : Cron_Entry do
Result.Set (Time, Callback);
end return;
end Create;
function Create
(Origin : in Ada.Calendar.Time;
Callback : in Cron.Callback'Class)
return Cron_Entry is
begin
return Result : Cron_Entry do
Result.Set (Origin, Callback);
end return;
end Create;
function Create
(Period : in Duration;
Callback : in Cron.Callback'Class)
return Cron_Entry is
begin
return Result : Cron_Entry do
|
| ︙ | ︙ | |||
106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
end Create;
begin
Self.Reset;
Self.Callback.Replace (Create'Access);
Database.Insert (Time, Self.Callback);
end Set;
procedure Set
(Self : in out Cron_Entry;
Period : in Duration;
Callback : in Cron.Callback'Class) is
begin
Set (Self, (Ada.Calendar.Clock, Period), Callback);
| > > > > > > > > > | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
end Create;
begin
Self.Reset;
Self.Callback.Replace (Create'Access);
Database.Insert (Time, Self.Callback);
end Set;
procedure Set
(Self : in out Cron_Entry;
Origin : in Ada.Calendar.Time;
Callback : in Cron.Callback'Class) is
begin
Set (Self, (Origin, 0.0), Callback);
end Set;
procedure Set
(Self : in out Cron_Entry;
Period : in Duration;
Callback : in Cron.Callback'Class) is
begin
Set (Self, (Ada.Calendar.Clock, Period), Callback);
|
| ︙ | ︙ |
Changes to src/natools-cron.ads.
1 | ------------------------------------------------------------------------------ | | | 1 2 3 4 5 6 7 8 9 | ------------------------------------------------------------------------------ -- Copyright (c) 2014-2015, Natacha Porté -- -- -- -- Permission to use, copy, modify, and distribute this software for any -- -- purpose with or without fee is hereby granted, provided that the above -- -- copyright notice and this permission notice appear in all copies. -- -- -- -- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- -- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- |
| ︙ | ︙ | |||
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
function Create
(Time : in Periodic_Time;
Callback : in Cron.Callback'Class)
return Cron_Entry;
-- Create a new entry with the given parameters
function Create
(Period : in Duration;
Callback : in Cron.Callback'Class)
return Cron_Entry;
-- Create a new entry starting within a period from now
procedure Set
(Self : in out Cron_Entry;
Time : in Periodic_Time;
Callback : in Cron.Callback'Class);
-- Reset an entry with the given parameters
procedure Set
(Self : in out Cron_Entry;
Period : in Duration;
Callback : in Cron.Callback'Class);
-- Reset entry with the given parameters, starting one period from now
procedure Reset (Self : in out Cron_Entry);
| > > > > > > > > > > > > | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
function Create
(Time : in Periodic_Time;
Callback : in Cron.Callback'Class)
return Cron_Entry;
-- Create a new entry with the given parameters
function Create
(Origin : in Ada.Calendar.Time;
Callback : in Cron.Callback'Class)
return Cron_Entry;
-- Create a new entry that executes only once, at the given time
function Create
(Period : in Duration;
Callback : in Cron.Callback'Class)
return Cron_Entry;
-- Create a new entry starting within a period from now
procedure Set
(Self : in out Cron_Entry;
Time : in Periodic_Time;
Callback : in Cron.Callback'Class);
-- Reset an entry with the given parameters
procedure Set
(Self : in out Cron_Entry;
Origin : in Ada.Calendar.Time;
Callback : in Cron.Callback'Class);
-- Reset entry with the given parameters, running only once
procedure Set
(Self : in out Cron_Entry;
Period : in Duration;
Callback : in Cron.Callback'Class);
-- Reset entry with the given parameters, starting one period from now
procedure Reset (Self : in out Cron_Entry);
|
| ︙ | ︙ |