◆ fiftyoneDegreesGraphGetMatchingHashFromBinaryNode()
fiftyoneDegreesGraphNodeHash* fiftyoneDegreesGraphGetMatchingHashFromBinaryNode | ( | fiftyoneDegreesGraphNode * | node, |
uint32_t | hash | ||
) |
Gets a matching hash record from a node where the node a single hash record.
- Parameters
-
- node - the node to search
- hash - the hash code to search for
- Returns
- fiftyoneDegreesGraphNodeHash* data.ptr to a matching hash record, or null if none match.
◆ fiftyoneDegreesGraphGetMatchingHashFromListNode()
fiftyoneDegreesGraphNodeHash* fiftyoneDegreesGraphGetMatchingHashFromListNode ( fiftyoneDegreesGraphNode * node, uint32_t hash ) Gets a matching hash record from a node where the node has multiple hash records.
- Parameters
-
- node - the node to search
- hash - the hash code to search for
- Returns
- fiftyoneDegreesGraphNodeHash* data.ptr to a matching hash record, or null if none match.
◆ fiftyoneDegreesGraphGetMatchingHashFromListNodeSearch()
fiftyoneDegreesGraphNodeHash* fiftyoneDegreesGraphGetMatchingHashFromListNodeSearch ( fiftyoneDegreesGraphNode * node, uint32_t hash ) Gets a matching hash record from a node where the hash records are stored as an ordered list by performing a binary search.
- Parameters
-
- node - the node to search
- hash - the hash code to search for
- Returns
- fiftyoneDegreesGraphNodeHash* data.ptr to a matching hash record, or null if none match.
◆ fiftyoneDegreesGraphGetMatchingHashFromListNodeTable()
fiftyoneDegreesGraphNodeHash* fiftyoneDegreesGraphGetMatchingHashFromListNodeTable ( fiftyoneDegreesGraphNode * node, uint32_t hash ) Gets a matching hash record from a node where the hash records are structured as a hash table.
The value that index is set to can never be greater than the number of hashes. As such there is no need to perform a bounds check on index before using it with the array of hashes.
- Parameters
-
- node - the node to search
- hash - the hash code to search for
- Returns
- fiftyoneDegreesGraphNodeHash* data.ptr to a matching hash record, or null if none match.
◆ fiftyoneDegreesGraphGetMatchingHashFromNode()
fiftyoneDegreesGraphNodeHash* fiftyoneDegreesGraphGetMatchingHashFromNode ( fiftyoneDegreesGraphNode * node, uint32_t hash ) Gets a matching hash record from a match where the node a single hash record.
- Parameters
-
- node - the node to search
- hash - the hash code to search for
- Returns
- fiftyoneDegreesGraphNodeHash* data.ptr to a matching hash record, or null if none match.
◆ fiftyoneDegreesGraphGetNode()
fiftyoneDegreesGraphNode* fiftyoneDegreesGraphGetNode ( fiftyoneDegreesCollection * collection, uint32_t offset, fiftyoneDegreesCollectionItem * item, fiftyoneDegreesException * exception ) Gets the graph node at the requested offset from the graph node collection provided.
- Parameters
-
- collection - to get the node from
- offset - of the node to get
- item - to store the node item in
- exception - pointer to an exception data structure to be used if an exception occurs. See exceptions.h.
- Returns
- the node requested or NULL
◆ fiftyoneDegreesGraphNodeReadFromFile()
void* fiftyoneDegreesGraphNodeReadFromFile ( const fiftyoneDegreesCollectionFile * file, uint32_t offset, fiftyoneDegreesData * data, fiftyoneDegreesException * exception ) Read a graph node from the file collection provided and store in the data pointer.
This method is used when creating a collection from file.
- Parameters
-
- file - collection to read from
- offset - of the graph node in the collection
- data - to store the resulting graph node in
- exception - pointer to an exception data structure to be used if an exception occurs. See exceptions.h
- Returns
- pointer to the graph node allocated within the data structure
◆ fiftyoneDegreesGraphTraceAppend()
void fiftyoneDegreesGraphTraceAppend ( fiftyoneDegreesGraphTraceNode * route, fiftyoneDegreesGraphTraceNode * node ) Appends a node to an existing trace route.
The new node is added to the tail of the linked list pointed to by route.
- Parameters
-
- route - the root of the trace route linked list
- node - the new node to append to the trace route
◆ fiftyoneDegreesGraphTraceCreate()
fiftyoneDegreesGraphTraceNode* fiftyoneDegreesGraphTraceCreate ( const char * fmt, ... ) Creates a new graph trace node.
Importantly, this is not a graph node, but a graph trace node, used to trace the route taken through a graph. The node is allocated and initialized.
- Parameters
-
- fmt - the format string to use as the name of the node
- ... - arguments for the format string
- Returns
- a newly allocated graph trace node
◆ fiftyoneDegreesGraphTraceFree()
void fiftyoneDegreesGraphTraceFree ( fiftyoneDegreesGraphTraceNode * route ) Frees a graph trace structure.
This method frees all nodes in the linked list, so should be called with the root node.
- Parameters
-
- route - root node for the trace route
◆ fiftyoneDegreesGraphTraceGet()
int fiftyoneDegreesGraphTraceGet ( char * destination, size_t length, fiftyoneDegreesGraphTraceNode * route, const char * source ) Writes a trace route in a readable format to a destination will the memory allocated, and returns the number of characters written to the destination.
If called with NULL as the destination, and 0 as length, nothing will be written, but the number of characters which would have been written will still be returned.
- Parameters
-
- destination - pointer to the memory to write the trace string to
- length - the number of characters that can be written to the destination memory
- route - the highest node in the route to write the trace for. This can be the root node, or any other node along the trace
- source - the source string. Usually a User-Agent to get the matched characters from
- Returns
- the number of characters written, or the number of characters which would have been written if length was long enough