rcl  beta1
C API providing common ROS client library functionality.
Classes | Typedefs | Functions
allocator.h File Reference
#include "rcl/macros.h"
#include "rcl/types.h"
#include "rcl/visibility_control.h"

Go to the source code of this file.

Classes

struct  rcl_allocator_t
 Encapsulation of an allocator. More...
 

Typedefs

typedef struct rcl_allocator_t rcl_allocator_t
 Encapsulation of an allocator. More...
 

Functions

rcl_allocator_t rcl_get_default_allocator (void)
 Return a properly initialized rcl_allocator_t with default values. More...
 
void * rcl_reallocf (void *pointer, size_t size, rcl_allocator_t *allocator)
 Emulate the behavior of reallocf. More...
 

Typedef Documentation

§ rcl_allocator_t

Encapsulation of an allocator.

The default allocator uses std::malloc(), std::free(), and std::realloc(). It can be obtained using rcl_get_default_allocator().

The allocator should be trivially copyable. Meaning that the struct should continue to work after being assignment copied into a new struct. Specifically the object pointed to by the state pointer should remain valid until all uses of the allocator have been made. Particular care should be taken when giving an allocator to rcl_init_* where it is stored within another object and used later.

Function Documentation

§ rcl_get_default_allocator()

rcl_allocator_t rcl_get_default_allocator ( void  )

Return a properly initialized rcl_allocator_t with default values.

This defaults to:


Attribute Adherence
Allocates Memory No
Thread-Safe Yes
Uses Atomics No
Lock-Free Yes

§ rcl_reallocf()

void* rcl_reallocf ( void *  pointer,
size_t  size,
rcl_allocator_t allocator 
)

Emulate the behavior of reallocf.

This function will return NULL if the allocator is NULL or has NULL for function pointer fields.