event.h¶
// SPDX-License-Identifier: MIT
-
safuResultE_t elosEventClone(elosEvent_t **to, elosEvent_t const *from)¶
[source] Allocates a new event as a copy of an existing one
- Parameters:
to (elosEvent_t*) – return location for the Copy
from (elosEvent_t*) – event to clone
- Returns:
SAFU_RESULT_OK on success
SAFU_RESULT_FAILED on failure
-
safuResultE_t elosEventDeepCopy(elosEvent_t *to, elosEvent_t const *from)¶
[source] Creates a deep copy into an exsiting event.
- Parameters:
to (elosEvent_t*) – the event to fill with the copy.
from (elosEvent_t*) – the event to copy from.
- Returns:
SAFU_RESULT_OK on success
SAFU_RESULT_FAILED on failure
-
safuResultE_t elosEventDelete(elosEvent_t *event)¶
[source] Free the memory of an event.
- Parameters:
event (elosEvent_t*) – the event to free.
- Returns:
SAFU_RESULT_OK on success
SAFU_RESULT_FAILED on failure
-
safuResultE_t elosEventDeleteMembers(elosEvent_t *event)¶
[source] Free the memory for all the mebers of an event.
- Parameters:
event (elosEvent_t*) – the event to remove the members from.
- Returns:
SAFU_RESULT_OK on success
SAFU_RESULT_FAILED on failure
-
safuResultE_t elosEventDeserialize(elosEvent_t *to, const char *fromJsonString)¶
[source] Parse an event from a JSON string.
- Parameters:
to (elosEvent_t*) – Pointer to the event to deserialize into.
from (const char*) – the string to deserialize.
- Returns:
SAFU_RESULT_OK on success
SAFU_RESULT_FAILED on failure
-
safuResultE_t elosEventFromJsonObject(elosEvent_t *to, const json_object *from)¶
[source] Fill an event with data from a JSON object.
- Parameters:
to (elosEvent_t*) – Pointer to a
elosEvent_t
to fill withjson_object
data.from (json_object*) – The
json_object
make into an elosEvent_t*.
- Returns:
SAFU_RESULT_OK on success
SAFU_RESULT_FAILED on failure
-
safuResultE_t elosEventInitialize(elosEvent_t *event)¶
[source] Zero initilizes an event.
- Parameters:
event (elosEvent_t*) – the event to initialize.
- Returns:
SAFU_RESULT_OK on success
SAFU_RESULT_FAILED on failure
-
bool elosEventIsDateEmpty(const elosEvent_t *const event)¶
[source] Check if the date field of an event is empty.
- Parameters:
event (const elosEvent_t *const) – the event to check.
- Returns:
true if seconds and nano second of date are 0
-
safuResultE_t elosEventNew(elosEvent_t **event)¶
[source] Allocates a new zero initialized event.
- Parameters:
event (elosEvent_t**) – the event is allocated and needs to be freed later.
- Returns:
SAFU_RESULT_OK on success
SAFU_RESULT_FAILED on failure
-
safuResultE_t elosEventSerialize(char **toJsonString, const elosEvent_t *from)¶
[source] Serializes an event into a JSON string
- Parameters:
toJsonString (char**) – the string to serialize into.
from (const elosEvent_t*) – the event to serialize.
- Returns:
SAFU_RESULT_OK on success
SAFU_RESULT_FAILED on failure
-
safuResultE_t elosEventToJsonObject(json_object *to, const elosEvent_t *from)¶
[source] Generates a JSON object from an event.
- Parameters:
to (json_object*) – Pointer to a
json_object
to fill with elosEvent_t* data.from (elosEvent_t*) – the
elosEvent_t
to make into anjson_object
.
- Returns:
SAFU_RESULT_OK on success
SAFU_RESULT_FAILED on failure