Function rcutils_get_zero_initialized_hash_map

Function Documentation

rcutils_hash_map_t rcutils_get_zero_initialized_hash_map()

Return an empty hash_map struct.

This function returns an empty and zero initialized hash_map struct. All hash maps should be initialized with this or manually initialized before being used.

Attribute

Adherence

Allocates Memory

No

Thread-Safe

No

Uses Atomics

No

Lock-Free

Yes

Example:

// Do not do this:
// rcutils_hash_map_t foo;
// rcutils_hash_map_fini(&foo); // undefined behavior!

// Do this instead:
rcutils_hash_map_t bar = rcutils_get_zero_initialized_hash_map();
rcutils_hash_map_fini(&bar); // ok