From fe20b6f0101611c72ae800d11e90dc4edc05fd5b Mon Sep 17 00:00:00 2001 From: Jaison Titus Date: Fri, 27 Sep 2019 16:34:32 -0700 Subject: [PATCH] Allocator and free functions for rmw_participant_qos_profile Signed-off-by: Jaison Titus --- rmw/include/rmw/allocators.h | 15 +++++++++++++++ rmw/src/allocators.c | 20 ++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/rmw/include/rmw/allocators.h b/rmw/include/rmw/allocators.h index 3eec025d..c10e6803 100644 --- a/rmw/include/rmw/allocators.h +++ b/rmw/include/rmw/allocators.h @@ -87,6 +87,21 @@ RMW_PUBLIC void rmw_wait_set_free(rmw_wait_set_t * wait_set); +/** +* @return an allocated instance of rmw_participant_qos_profile_t. + */ +RMW_PUBLIC +rmw_participant_qos_profile_t * +rmw_participant_qos_profile_allocate(void); + +/** + * Frees the allocated instance. + * @param participant_qos_profile the instance to free. + */ +RMW_PUBLIC +void +rmw_participant_qos_profile_free(rmw_participant_qos_profile_t * participant_qos_profile); + #ifdef __cplusplus } #endif diff --git a/rmw/src/allocators.c b/rmw/src/allocators.c index 55ba070f..dfd521ee 100644 --- a/rmw/src/allocators.c +++ b/rmw/src/allocators.c @@ -139,3 +139,23 @@ rmw_wait_set_free(rmw_wait_set_t * wait_set) // Should have matching overide with rmw_wait_set_allocate rmw_free(wait_set); } + +/** +* @return an allocated instance of rmw_participant_qos_profile_t. + */ +rmw_participant_qos_profile_t * +rmw_participant_qos_profile_allocate() +{ + return (rmw_participant_qos_profile_t *)rmw_allocate(sizeof(rmw_participant_qos_profile_t)); +} + +/** + * Frees the allocated instance. + * @param participant_qos_profile the instance to free. + */ +void +rmw_participant_qos_profile_free(rmw_participant_qos_profile_t * participant_qos_profile) +{ + rmw_free(participant_qos_profile); +} +