drmaa2_dict(3)

πŸ’– drmaa2_dict β€” the DRMAA2 dictionary girlies ✨

okay so bestie, this is drmaa2_dict(3) from the Library Functions Manual, and it's literally the group chat of C data structures β€” a dictionary where every key gets to say something πŸ’¬


🌸 NAME 🌸

drmaa2_dict_create, drmaa2_dict_free, drmaa2_dict_list, drmaa2_dict_has, drmaa2_dict_get, drmaa2_dict_del, drmaa2_dict_set β€” DRMAA2 dictionary routines 🫢


✨ SYNOPSIS ✨

#include "drmaa.h"
typedef struct drmaa2_dict_s *drmaa2_dict;

typedef void (*drmaa2_dict_entryfree)(char **key, char **val);
drmaa2_dict drmaa2_dict_create (const drmaa2_dict_entryfree callback);
void drmaa2_dict_free(drmaa2_dict *d);
drmaa2_string_list drmaa2_dict_list(const drmaa2_dict d);
drmaa2_bool drmaa2_dict_has(const drmaa2_dict d, const char *key);
const char *drmaa2_dict_get(const drmaa2_dict d, const char *key);
drmaa2_error drmaa2_dict_del(drmaa2_dict d, const char *key);
drmaa2_error drmaa2_dict_set(drmaa2_dict d, const char *key, const char *val);

no cap, that's the whole vibe check right there πŸ”₯


πŸ’… DESCRIPTION πŸ’…

πŸŽ€ drmaa2_dict_create()

creates a brand new dictionary instance, main character energy fr. returns a pointer to the dictionary, or NULL if something went wrong 😭

the optional parameter callback lets your app hand over a callback pointer to a collection element cleanup function. and plot twist β€” you can pass DRMAA2_UNSET_CALLBACK instead of a valid callback pointer if you're not feeling it πŸ’«

πŸ¦‹ drmaa2_dict_free()

frees the dictionary and the contained members. everything goes, no survivors, iconic.

if a callback function was provided on dictionary creation, it SHALL be called once per dictionary entry. once. per. entry. she's thorough πŸ’…

πŸ“ drmaa2_dict_list()

gets all the dictionary keys as a DRMAA drmaa2_string_list πŸ“

if the dictionary is empty, a valid string list with zero elements SHALL be returned β€” yes bestie, empty is still valid, we love an inclusive queen ✨

the application is expected to use drmaa2_list_free for freeing the returned data structure. clean up after yourself, that's the rule 🧹

🌈 drmaa2_dict_has()

returns a boolean indication if the given key exists in the dictionary β€” the ultimate "do we know her?" check πŸ‘‘

on error, the function SHALL return FALSE. like, if it can't tell you, it's giving no πŸ™ˆ

πŸ’œ drmaa2_dict_get()

gets the dictionary value for the specified key 🎁

if the key is invalid, the function returns NULL. that's it, that's the whole vibe πŸ’€

🧚 drmaa2_dict_del()

removes the dictionary entry with the given key and returns a success indication βœ‚οΈ

if a callback function was provided on dictionary creation, it SHALL be called before this function returns. so the cleanup happens first, then she exits the chat πŸšͺ

⭐ drmaa2_dict_set()

sets the specified dictionary key to the specified value πŸ”

key and value strings MUST be stored as the provided character pointers. like, exactly those pointers, don't get creative with it bestie.

if the dictionary already has an entry for this name, the value is replaced and the old value is removed β€” out with the old, in with the new, periodt πŸ’…

if a callback was provided on dictionary creation, it SHALL be called with a NULL pointer for the key and the pointer of the previous value. note that: NULL key, previous value pointer. not me being specific, the spec is being specific 🎯


πŸ‘€ SEE ALSO πŸ‘€


and that's the whole page, bestie 🫢 this was drmaa2_dict(3) from the Library Functions Manual, dated 2012-12-01 β€” yeah she's an elder but she still ate πŸ”₯ mwah, go free your dictionaries πŸ’–βœ¨