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.
StringListNode Struct Reference

A ListNode for LinkedLists that also stores a string value. More...

#include <string_linked_list.h>

Inheritance diagram for StringListNode:
[legend]
Collaboration diagram for StringListNode:
[legend]

Public Member Functions

StringListNodeAllocateStringListNode (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...
 
LinkedListAllocateStringLinkedList (void)
 Create a LinkedList designed to hold StringListNodes. More...
 
LinkedListCopyStringLinkedList (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...
 
LinkedListGetUUIDSList (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
ListItemln_prev_p
 A pointer to the previous ListItem. More...
 
ListItemln_next_p
 A pointer to the next ListItem. More...
 

Detailed Description

A ListNode for LinkedLists that also stores a string value.

Member Function Documentation

◆ AllocateStringListNode()

StringListNode * AllocateStringListNode ( const char *const  str_p,
const MEM_FLAG  mem_flag 
)

Create a new StringListNode.

Parameters
str_pThe string to store in the newly-created StringListNode.
mem_flagHow the StringListNode should store its string.
Returns
The new StringListNode or NULL upon error.

◆ InitStringListNode()

bool InitStringListNode ( StringListNode node_p,
const char *const  value_s,
const MEM_FLAG  mem_flag 
)

Initialise a StringListNode.

Parameters
node_pThe StringListNode to initialise.
value_sThe string to store in the StringListNode.
mem_flagHow the StringListNode should store its string.
Returns
If successful, any previous value stored in the given StringListNode will be freed based upon the mem_flag and the new value will be set. The return code will be true. Upon failure, the StringListNode is unaltered and false is returned.

◆ FreeStringListNode()

void FreeStringListNode ( ListItem *const  node_p)

Free a StringListNode.

Whether the sln_string_p will be freed depends upon the sln_string_flag value.

Parameters
node_pThe ListNode to free.

◆ ClearStringListNode()

void ClearStringListNode ( StringListNode node_p)

Clear a StringListNode by deleting its sln_string_s value as appropriate.

Parameters
node_pThe StringListNode to clear.

◆ AllocateStringLinkedList()

LinkedList * AllocateStringLinkedList ( void  )

Create a LinkedList designed to hold StringListNodes.

Returns
The new LinkedList or NULL upon error.

◆ CopyStringLinkedList()

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.

Parameters
src_pThe LinkedList of StringListNodes to copy.
Returns
The copied LinkedList or NULL upon error.

◆ GetStringLinkedListAsString()

char * GetStringLinkedListAsString ( const LinkedList *const  src_p)

Get a new string that is the concatenation of all of the entries on a StringLinkedList.

Parameters
src_pThe LinkedList of StringListNodes to generate the value from.
Returns
The newly-allocated string or NULL upon error.

◆ AddStringToStringLinkedList()

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.

Parameters
list_pThe List to add the node to the end of.
str_pThe string to store in the newly-created StringListNode.
mem_flagHow the StringListNode should store its string..
Returns
true upon success, false on error.

◆ GetUUIDSList()

LinkedList * GetUUIDSList ( const char *  ids_s)

Create a LinkedList of StringListNodes with each entry being a uuid.

Parameters
ids_sThe string to parse from which the LinkedList will be generated. The values in this string need to be separated by whitespace.
Returns
The newly-allocated LinkedList of StringListNodes where each entry is a uuid or NULL upon error.

Field Documentation

◆ sln_node

ListItem sln_node

The ListNode.

◆ sln_string_s

char* sln_string_s

The string value.

◆ sln_string_flag

MEM_FLAG sln_string_flag

How the memory for the string is stored and freed.


The documentation for this struct was generated from the following files: