Harlequin RIP SDK

Farm process memory and utility functions. More...

Functions

HqBool rf_set_alloc_funcs (rf_alloc_t alloc_fn, rf_free_t free_fn)
 Set the allocation and deallocation functions for the library to use. If this function is not called the system will default to using malloc and free. More...
 
void * rf_mem_alloc (size_t size)
 Allocate memory through the library allocation functions set by rf_set_alloc_funcs(). More...
 
void rf_mem_free (void *ptr)
 Free memory allocated by the library. More...
 
char * rf_strndup (const char *str, size_t len)
 Duplicate a string of a specified length into a memory allocated using rf_mem_alloc(). More...
 
char * rf_strdup (const char *str)
 Duplicate a zero-terminated string into a memory allocated using rf_mem_alloc(). More...
 
void rf_zsys_shutdown ()
 Shut down ZeroMQ messaging before process exit. More...
 

Detailed Description

Farm process memory and utility functions.

Copyright (C) 2023 Global Graphics Software Ltd. All rights reserved. Global Graphics Software Ltd. Confidential Information.

Function Documentation

◆ rf_mem_alloc()

void* rf_mem_alloc ( size_t  size)

Allocate memory through the library allocation functions set by rf_set_alloc_funcs().

Parameters
[in]sizeThe size in bytes of the memory to allocate.
Returns
A non-NULL pointer capable of storing size bytes, or NULL if the memory could not be allocated.

◆ rf_mem_free()

void rf_mem_free ( void *  ptr)

Free memory allocated by the library.

Parameters
ptrAn object allocated by the library. It is safe to call this function with a NULL ptr value.

◆ rf_set_alloc_funcs()

HqBool rf_set_alloc_funcs ( rf_alloc_t  alloc_fn,
rf_free_t  free_fn 
)

Set the allocation and deallocation functions for the library to use. If this function is not called the system will default to using malloc and free.

Parameters
[in]alloc_fnFunction to allocate memory.
[in]free_fnFunction to free allocated memory.
Return values
TRUEThe allocation functions were set as requested.
FALSEThe allocation functions were already set, and have not been changed.
Note
This should be called before any other functions from the library.

◆ rf_strdup()

char* rf_strdup ( const char *  str)

Duplicate a zero-terminated string into a memory allocated using rf_mem_alloc().

Parameters
[in]strA non-NULL zero-terminated string to duplicate.
Returns
A zero-terminated string, or NULL if the memory could not be allocated. If non-NULL, the returned string must be freed by the caller using rf_mem_free().

◆ rf_strndup()

char* rf_strndup ( const char *  str,
size_t  len 
)

Duplicate a string of a specified length into a memory allocated using rf_mem_alloc().

Parameters
[in]strA non-NULL string to duplicate.
[in]lenThe length of the string to duplicate. This may be zero.
Returns
A zero-terminated string, or NULL if the memory could not be allocated. If non-NULL, the returned string must be freed by the caller using rf_mem_free().

◆ rf_zsys_shutdown()

void rf_zsys_shutdown ( )

Shut down ZeroMQ messaging before process exit.

Note
For technical reasons, ZeroMQ messaging cannot be shutdown by the libripfarm dynamic library on exit. This function should be called after stopping any component using the RIP Farm library, before exiting the process or restarting the component.