20#ifndef _MTIME_EVENTHANDLING_H
21#define _MTIME_EVENTHANDLING_H
27#define MAX_EVENT_STR_LEN 132
29#define MAX_GROUPNAME_STR_LEN 132
31#define MAX_EVENTNAME_STR_LEN 132
63char *getEventGroupName(
struct _eventGroup *eg,
char *gname);
113struct _event *
newEvent(
const char *_eventName,
const char *_eventReferenceDate,
const char *_eventFirstDate,
114 const char *_eventLastDate,
const char *_eventInterval,
const char *_eventOffset);
127bool iseventNextInNextDay(
struct _event *e);
129bool iseventNextInNextMonth(
struct _event *e);
131bool iseventNextInNextYear(
struct _event *e);
141int64_t getEventId(
struct _event *e);
143char *getEventName(
struct _event *e,
char *ename);
153bool getNextEventIsFirst(
struct _event *e);
155bool getEventisFirstInDay(
struct _event *e);
157bool getEventisFirstInMonth(
struct _event *e);
159bool getEventisFirstInYear(
struct _event *e);
161bool getEventisLastInDay(
struct _event *e);
163bool getEventisLastInMonth(
struct _event *e);
165bool getEventisLastInYear(
struct _event *e);
bool eventisLastInDay
Is the event being triggered (i.e event when triggerCurrentEvent is true) Last-In-Day?
Definition mtime_eventHandling.h:104
bool eventisLastInMonth
Is the event being triggered (i.e event when triggerCurrentEvent is true) Last-In-Month?
Definition mtime_eventHandling.h:105
bool eventisFirstInDay
Is the event being triggered (i.e event when triggerCurrentEvent is true) First-In-Day?
Definition mtime_eventHandling.h:101
char * eventGroupName
Event Group's name.
Definition mtime_eventHandling.h:48
struct _datetime * triggeredPreviousEventDateTime
Last Trigger event happened at this DT. Initialized with "0-01-01T00:00:00.000".
Definition mtime_eventHandling.h:109
struct _datetime * eventReferenceDateTime
Anchor datetime. Can be NULL; Initialized to eventFirstDateTime. .
Definition mtime_eventHandling.h:82
struct _datetime * eventFirstDateTime
Start datetime of the event. Can be NULL; Initialized to 0-01-01T00:00:00.000.
Definition mtime_eventHandling.h:84
bool eventisLastInYear
Is the event being triggered (i.e event when triggerCurrentEvent is true) Last-In-Year?
Definition mtime_eventHandling.h:106
bool eventisFirstInMonth
Is the event being triggered (i.e event when triggerCurrentEvent is true) First-In-Month?
Definition mtime_eventHandling.h:102
bool neverTriggerEvent
for cases an event is set by an interval of 0
Definition mtime_eventHandling.h:91
struct _event * nextEventInGroup
Pointer to the next event in a given Event Group.
Definition mtime_eventHandling.h:76
bool lastEventWasFinal
Was the previously triggered event final?
Definition mtime_eventHandling.h:96
bool triggerCurrentEvent
is this event active?
Definition mtime_eventHandling.h:93
struct _datetime * triggerNextEventDateTime
Trigger the event next at this DT.
Definition mtime_eventHandling.h:108
struct _timedelta * eventOffset
Shift eventReferenceDateTime by 'eventOffset' . Can be NULL; stays a NULL pointer: Logically 0.
Definition mtime_eventHandling.h:88
struct _datetime * eventLastDateTime
Last datetime of the event. Can be NULL; stays a NULL pointer: Logically NULL.
Definition mtime_eventHandling.h:85
bool nextEventIsFirst
Is the next scheduled event the first to be triggered?
Definition mtime_eventHandling.h:95
char * eventName
Event's name.
Definition mtime_eventHandling.h:79
struct _timedelta * eventInterval
TimeDelta between succesive triggers. MUST be specified.
Definition mtime_eventHandling.h:87
bool eventisFirstInYear
Is the event being triggered (i.e event when triggerCurrentEvent is true) First-In-Year?
Definition mtime_eventHandling.h:103
struct _datetime * eventsLastEvaluationDateTime
Last evaluation datetime to allow for multiple queries.
Definition mtime_eventHandling.h:81
struct _event * rootEvent
Pointer to a List of events in this group.
Definition mtime_eventHandling.h:50
int64_t eventGroupId
Event Group's ID.
Definition mtime_eventHandling.h:47
int64_t eventId
Auto generated. (For future use. Not in use yet).
Definition mtime_eventHandling.h:78
struct _datetime * getTriggerNextEventAtDateTime(struct _event *e, struct _datetime *dt_current, struct _datetime *dt_return)
Get the Datetime when 'this' event will be triggered next.
Definition mtime_eventHandling.c:1187
void deallocateEventGroup(struct _eventGroup *eg)
Destructor of EventGroup.
Definition mtime_eventHandling.c:91
char * eventToString(struct _event *e, char *string)
Get Event as a string.
Definition mtime_eventHandling.c:904
void deallocateEvent(struct _event *e)
Destructor of Event.
Definition mtime_eventHandling.c:550
bool removeEventFromEventGroup(char *eventName, struct _eventGroup *eg)
Remove event from eventgroup. CRITICAL: Also, deallocate the event.
Definition mtime_eventHandling.c:147
struct _event * newEvent(const char *_eventName, const char *_eventReferenceDate, const char *_eventFirstDate, const char *_eventLastDate, const char *_eventInterval, const char *_eventOffset)
Construct new event using strings.
Definition mtime_eventHandling.c:226
struct _eventGroup * newEventGroup(const char *_eventGroupName)
Construct new event-Group using a string.
Definition mtime_eventHandling.c:52
struct _event * newEventWithDataType(const char *_eventName, struct _datetime *_eventReferenceDate, struct _datetime *_eventFirstDate, struct _datetime *_eventLastDate, struct _timedelta *_eventInterval, struct _timedelta *_eventOffset)
Construct new event using data-types.
Definition mtime_eventHandling.c:401
struct _datetime * getTriggeredPreviousEventAtDateTime(struct _event *e, struct _datetime *dt_return)
Get the Datetime when 'this' event was triggered last.
Definition mtime_eventHandling.c:1226
bool addNewEventToEventGroup(struct _event *e, struct _eventGroup *eg)
Add new event to an eventgroup.
Definition mtime_eventHandling.c:125
bool isCurrentEventActive(struct _event *e, struct _datetime *current_dt, struct _timedelta *plus_slack, struct _timedelta *minus_slack)
Check if this event is active by comparing event's trigger time with current_dt.
Definition mtime_eventHandling.c:699
struct _datetime contains a struct _date and a struct _time element.
Definition mtime_datetime.h:36
struct _event defines events. Events are set to be triggered at pre-specified intervals.
Definition mtime_eventHandling.h:75
struct _eventGroup defines an Event-group. Each event group has an associated list of events....
Definition mtime_eventHandling.h:46
Struct _timedelta containing timedelta and sign of year parameter.
Definition mtime_timedelta.h:40