Defined in file: hzCron.h

The hzCron class controls when a task may run. There is both a 'run day' component which determines what days a task can be run (e.g. Weekdays only) and a time component (e.g. every hour from 6.30am to 6.30pm inclusive). This aims to cope with calenda intervals more in keeping with 'real life' scheduling requirements as well as fixed intervals such as every five minutes or every six hours. The run day component is implimented as an enumerated periodicity (hzPeriodicity), which if daily or weekly stands on its own. For 14 day periodicities, specified as 'every other' of whatever day, an 'Era start' date is also needed in order to determine if the current week applies. Periodicities that are Monthly or longer require an enumerated monthrule. Specifying run days by the periodicity on its own or in conjunction with either an era start date or a month rule, does not cater for public holidays or any other days that might be deemed an exception. This is currently dealt with by a 32 bit flag which selects which public holidays are to be observed. This approach has been depricated and awaits replacement. The intended new approach will keep the per hzCron instance flag but will test this against a map of dates to flag values. If the current day is in the map and the flags clash the task will not be queued up for that day. Populating the map will be the responsibility of the application. Note also that there is currently no means to specify what if anything should happen in lieu of excluded run days.

Constructors/Detructors

hzCron*hzCron(void)
void~hzCron(void)

Public Methods:

hzEcodeAdvance(hzXDate& date)uint32_t factor, From the supplied date, advance to the Nth next valid date & time for the cron entry, where N is the supplied factor. Skip over excluded periods or dates.
hzEcodeAdvance(hzSDate& d)uint32_t factor, Set the trigger date to the next date according to the periodicity and rules
hzSDateEra(void)
hzString&Error(void)
voidExclude(uint32_t phFlags)Exclude from this hzCron's schedule, one or more public holidays (that are represented as 'HZ_PUBHOL' flags) Returns: None
voidExclude(uint32_t month)uint32_t day, Exclude from this hzCron's schedule, dates in the year beyond the supplied month and day Returns: None
voidExclude(uint32_t fromMonth)uint32_t fromDay, uint32_t toMonth, uint32_t toDay, Exclude from this hzCron's schedule, dates in the year before the supplied month and day (args 1 and 2) and after the supplied month and day (args 3 and 4) Returns: None
hzEcodeExclude(hzString& arg)Exclude from this hzCron's schedule, dates described in the supplied control string. (Can be used directly to interpret config files).
hzEcodeExclude(hzString& from)hzString& to, Exclude from this hzCron's schedule, dates described in the supplied control strings 'from' and 'to'. (Can be used directly to interpret config files).
hzEcodeInitialize(hzSDate& start)hzPeriodicity period, hzMonthrule mrule, hzCron::Initialize Set up start of era date if Y, M and D are non-zero and if the periodicity requires them.
hzPeriodicityPeriod(void)
hzEcodeRetard(hzXDate& date)uint32_t factor, Set the trigger date to the previous date according to the periodicity and rules
hzEcodeRetard(hzSDate& d)uint32_t factor, Set the trigger date to the previous date according to the periodicity and rules
hzMonthruleRule(void)
voidSetEra(hzSDate& era)
voidSetEra(hzSDate& era)uint32_t nOset,
hzEcodeSetEraDate(uint32_t Y)uint32_t M, uint32_t D,
hzEcodeSetEraDate(hzString& dstr)
hzEcodeSetEraTime(uint32_t h)uint32_t m, uint32_t s,
hzEcodeSetEraTime(hzString& dstr)
voidSetPeriod(hzPeriodicity period)
voidSetPeriod(hzString& pstr)
voidSetRule(hzMonthrule mrule)
voidSetRule(hzString& rstr)
hzEcodeTestDate(hzSDate& D)Apply rules to see if the supplied date is a running day
hzEcodeTestDate(hzXDate& D)Apply rules to see if date is a running day
hzTimeTime(void)
hzEcodeValidate(void)Validate the hzCron settings. The following tests are performed:- 1) The periodicity must be set. 2) If the periodicty is every two weeks, then an era start date must be provided. This is because the DoW (day of week) function could not unambiquously trigger the event. 3) If the periodicty is monthly or less often, there must be a month-rule to define at which point in the month, the trigger applies. Arguments: None

Overloaded operators:

booloperator!=(hzCron& op)
booloperator==(hzCron& op)

Member Variables:

hzSDatem_EraFirst valid date in series
uint32_tm_ItemOffsetStart value for items (for the era; eg issue=1000 starts on Jan 1st, 1875)
hzPeriodicitym_PeriodPeriodicity (frequency)
hzMonthrulem_RuleWhen to run in month (for month based events)
hzTimem_WakeFirst time timer will trigger on the first valid date
boolm_bActiveSet by validation
hzStringm_errorError reports
uint32_tm_exclholsExclude [holiday] flags
unsigned charm_frDayExclude from month/day
unsigned charm_frMthExclude from month/day
unsigned charm_toDayExclude to month/day
unsigned charm_toMthExclude to month/day