SpiNNFrontEndCommon 7.3.1
Common support code for user-facing front end systems.
Loading...
Searching...
No Matches
Data Structures | Functions
aliases.h File Reference

Aliases in the routing tree. More...

#include <malloc_extras.h>
#include "../common/routing_table.h"
#include <debug.h>

Go to the source code of this file.

Data Structures

struct  alias_element_t
 Copy of key mask needed for Mundy compressor. More...
 
struct  alias_list_t
 Linked list of arrays. More...
 
union  a_key_t
 the key union from a key and mask to a 64 bit number More...
 
struct  node_t
 node struct More...
 
struct  aliases_t
 top of tree More...
 

Functions

static alias_list_talias_list_new (unsigned int max_size)
 Create a new list on the stack.
 
static bool alias_list_append (alias_list_t *as, key_mask_t val, uint32_t source)
 Append an element to a list.
 
static alias_element_t alias_list_get (alias_list_t *as, unsigned int i)
 Get an element from the list.
 
static void alias_list_join (alias_list_t *a, alias_list_t *b)
 Append a list to an existing list.
 
void alias_list_delete (alias_list_t *a)
 Delete all elements in an alias list.
 
static aliases_t aliases_init (void)
 Create a new, empty, aliases container.
 
static alias_list_taliases_find (aliases_t *a, key_mask_t key)
 Retrieve an element from an aliases container.
 
static bool aliases_contains (aliases_t *a, key_mask_t key)
 See if the aliases contain holds an element.
 
static bool aliases_insert (aliases_t *a, key_mask_t key, alias_list_t *value)
 Add/overwrite an element into an aliases tree.
 
static void aliases_remove (aliases_t *a, key_mask_t key)
 Remove an element from an aliases tree.
 
static void aliases_clear (aliases_t *a)
 Remove all elements from an aliases container and free all sub-containers.
 

Detailed Description

Aliases in the routing tree.

Aliases are built using a trie structure as this avoids the need for rebalancing at the cost of more memory.

Definition in file aliases.h.


Data Structure Documentation

◆ alias_element_t

struct alias_element_t

Copy of key mask needed for Mundy compressor.

Definition at line 32 of file aliases.h.

Data Fields
key_mask_t key_mask key_mask of the element
uint32_t source Source of packets matching the element.

◆ alias_list_t

struct alias_list_t

Linked list of arrays.

Definition at line 41 of file aliases.h.

Data Fields
unsigned int n_elements Elements in this instance.
unsigned int max_size Max number of elements in this instance.
struct _alias_list_t * next Next element in list of lists.
alias_element_t data Data region.

◆ a_key_t

union a_key_t

the key union from a key and mask to a 64 bit number

Definition at line 128 of file aliases.h.

Data Fields
key_mask_t km key mast combo
int64_t as_int the 64 bit int version

◆ node_t

struct node_t

node struct

Definition at line 137 of file aliases.h.

Data Fields
a_key_t key Key and value of this node.
alias_list_t * val alias ......
unsigned int level tree level maybe?
struct node_t * left left child
struct node_t * right right child

◆ aliases_t

struct aliases_t

top of tree

Definition at line 155 of file aliases.h.

Data Fields
node_t * root pointer to first element

Function Documentation

◆ alias_list_new()

static alias_list_t * alias_list_new ( unsigned int  max_size)
static

Create a new list on the stack.

Parameters
[in]max_sizemax size of memory to allocate to new list
Returns
new alias list. or NULL if not allocated

Definition at line 55 of file aliases.h.

◆ alias_list_append()

static bool alias_list_append ( alias_list_t as,
key_mask_t  val,
uint32_t  source 
)
static

Append an element to a list.

Parameters
[in]asthe alias list to append to
[in]valthe key mask to append to the alias
[in]sourcethe source to append to the alias
Returns
bool saying if it successfully appended or not

Definition at line 77 of file aliases.h.

◆ alias_list_get()

static alias_element_t alias_list_get ( alias_list_t as,
unsigned int  i 
)
static

Get an element from the list.

Parameters
[in]asthe alias to locate a element from
[in]ithe index to get
Returns
the alias element for the i

Definition at line 93 of file aliases.h.

◆ alias_list_join()

static void alias_list_join ( alias_list_t a,
alias_list_t b 
)
static

Append a list to an existing list.

Parameters
[in]aalias list to append to
[in]balias list to append

Definition at line 100 of file aliases.h.

◆ alias_list_delete()

void alias_list_delete ( alias_list_t a)

Delete all elements in an alias list.

Parameters
[in]aalias list to delete.

Definition at line 112 of file aliases.h.

◆ aliases_init()

static aliases_t aliases_init ( void  )
static

Create a new, empty, aliases container.

Returns
new alias list

Definition at line 162 of file aliases.h.

◆ aliases_find()

static alias_list_t * aliases_find ( aliases_t a,
key_mask_t  key 
)
inlinestatic

Retrieve an element from an aliases container.

Parameters
[in]aThe key-to-alias map
[in]keyThe key sought
Returns
The alias list for that key, or NULL if mapping absent

Definition at line 193 of file aliases.h.

◆ aliases_contains()

static bool aliases_contains ( aliases_t a,
key_mask_t  key 
)
inlinestatic

See if the aliases contain holds an element.

Parameters
[in]aThe key-to-alias map
[in]keythe key mask sought
Returns
whether the alias has the key mask.

Definition at line 206 of file aliases.h.

◆ aliases_insert()

static bool aliases_insert ( aliases_t a,
key_mask_t  key,
alias_list_t value 
)
inlinestatic

Add/overwrite an element into an aliases tree.

Parameters
[in]aThe key-to-alias map
[in]keykey mask to insert or overwrite
[in]valuethe value to write in
Returns
whether the insert was successful or not

Definition at line 301 of file aliases.h.

◆ aliases_remove()

static void aliases_remove ( aliases_t a,
key_mask_t  key 
)
inlinestatic

Remove an element from an aliases tree.

Parameters
[in]aaliases
[in]keythe key mask struct

Definition at line 312 of file aliases.h.

◆ aliases_clear()

static void aliases_clear ( aliases_t a)
inlinestatic

Remove all elements from an aliases container and free all sub-containers.

Parameters
[in]athe aliases tree.

Definition at line 349 of file aliases.h.