Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
|
A ListNode for LinkedLists that also stores a string value. More...
#include <string_linked_list.h>
Public Member Functions | |
StringListNode * | AllocateStringListNode (const char *const str_p, const MEM_FLAG mem_flag) |
Create a new StringListNode. More... | |
bool | InitStringListNode (StringListNode *node_p, const char *const value_s, const MEM_FLAG mem_flag) |
Initialise a StringListNode. More... | |
void | FreeStringListNode (ListItem *const node_p) |
Free a StringListNode. More... | |
void | ClearStringListNode (StringListNode *node_p) |
Clear a StringListNode by deleting its sln_string_s value as appropriate. More... | |
LinkedList * | AllocateStringLinkedList (void) |
Create a LinkedList designed to hold StringListNodes. More... | |
LinkedList * | CopyStringLinkedList (const LinkedList *const src_p) |
Make a copy of a LinkedList of StringListNodes. More... | |
char * | GetStringLinkedListAsString (const LinkedList *const src_p) |
Get a new string that is the concatenation of all of the entries on a StringLinkedList. More... | |
bool | AddStringToStringLinkedList (LinkedList *list_p, const char *const str_p, const MEM_FLAG mem_flag) |
Create and add a new StringListNode to the tail of a LinkedList. More... | |
LinkedList * | GetUUIDSList (const char *ids_s) |
Create a LinkedList of StringListNodes with each entry being a uuid. More... | |
Data Fields | |
ListItem | sln_node |
The ListNode. More... | |
char * | sln_string_s |
The string value. More... | |
MEM_FLAG | sln_string_flag |
How the memory for the string is stored and freed. More... | |
Data Fields inherited from ListItem | |
ListItem * | ln_prev_p |
A pointer to the previous ListItem. More... | |
ListItem * | ln_next_p |
A pointer to the next ListItem. More... | |
A ListNode for LinkedLists that also stores a string value.
StringListNode * AllocateStringListNode | ( | const char *const | str_p, |
const MEM_FLAG | mem_flag | ||
) |
Create a new StringListNode.
str_p | The string to store in the newly-created StringListNode. |
mem_flag | How the StringListNode should store its string. |
NULL
upon error. bool InitStringListNode | ( | StringListNode * | node_p, |
const char *const | value_s, | ||
const MEM_FLAG | mem_flag | ||
) |
Initialise a StringListNode.
node_p | The StringListNode to initialise. |
value_s | The string to store in the StringListNode. |
mem_flag | How the StringListNode should store its string. |
true
. Upon failure, the StringListNode is unaltered and false
is returned. void FreeStringListNode | ( | ListItem *const | node_p | ) |
Free a StringListNode.
Whether the sln_string_p will be freed depends upon the sln_string_flag value.
node_p | The ListNode to free. |
void ClearStringListNode | ( | StringListNode * | node_p | ) |
Clear a StringListNode by deleting its sln_string_s value as appropriate.
node_p | The StringListNode to clear. |
LinkedList * AllocateStringLinkedList | ( | void | ) |
Create a LinkedList designed to hold StringListNodes.
NULL
upon error. LinkedList * CopyStringLinkedList | ( | const LinkedList *const | src_p | ) |
Make a copy of a LinkedList of StringListNodes.
For each StringListNode on the source list if sln_string_flag is MF_SHADOW_USE then the new LinkedList will just copy the address that sln_string_p points to directly. Any other value and the new StringListNodes will make deep copies of the strings.
src_p | The LinkedList of StringListNodes to copy. |
NULL
upon error. char * GetStringLinkedListAsString | ( | const LinkedList *const | src_p | ) |
Get a new string that is the concatenation of all of the entries on a StringLinkedList.
src_p | The LinkedList of StringListNodes to generate the value from. |
NULL
upon error. bool AddStringToStringLinkedList | ( | LinkedList * | list_p, |
const char *const | str_p, | ||
const MEM_FLAG | mem_flag | ||
) |
Create and add a new StringListNode to the tail of a LinkedList.
list_p | The List to add the node to the end of. |
str_p | The string to store in the newly-created StringListNode. |
mem_flag | How the StringListNode should store its string.. |
true
upon success, false
on error. LinkedList * GetUUIDSList | ( | const char * | ids_s | ) |
Create a LinkedList of StringListNodes with each entry being a uuid.
ids_s | The string to parse from which the LinkedList will be generated. The values in this string need to be separated by whitespace. |
NULL
upon error. ListItem sln_node |
The ListNode.
char* sln_string_s |
The string value.
MEM_FLAG sln_string_flag |
How the memory for the string is stored and freed.