Graphviz 12.0.1~dev.20240716.0800
Loading...
Searching...
No Matches
node_set.h File Reference

unordered set of Agsubnode_t * More...

#include <assert.h>
#include <cgraph/cgraph.h>
#include <stdbool.h>
#include <stddef.h>
Include dependency graph for node_set.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct graphviz_node_set node_set_t
 an unordered set
 

Functions

node_set_tnode_set_new (void)
 
void node_set_add (node_set_t *self, Agsubnode_t *item)
 
Agsubnode_tnode_set_find (node_set_t *self, IDTYPE key)
 
void node_set_remove (node_set_t *self, IDTYPE item)
 
size_t node_set_size (const node_set_t *self)
 
static bool node_set_is_empty (const node_set_t *self)
 
void node_set_free (node_set_t **self)
 

Typedef Documentation

◆ node_set_t

typedef struct graphviz_node_set node_set_t

Definition at line 12 of file node_set.h.

Function Documentation

◆ node_set_add()

void node_set_add ( node_set_t self,
Agsubnode_t item 
)

add an item to the set

If the backing store is not large enough, it is expanded on demand. On allocation failure, exit is called.

Parameters
selfSet to add to
itemElement to add

Definition at line 412 of file node.c.

References graphviz_node_set::capacity, free(), gv_calloc(), node_set_add(), node_set_index(), NULL, graphviz_node_set::size, graphviz_node_set::slots, TOMBSTONE, and UNREACHABLE.

Referenced by dict_relabel(), installnode(), and node_set_add().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ node_set_find()

Agsubnode_t * node_set_find ( node_set_t self,
IDTYPE  key 
)

lookup an existing item in a set

Parameters
selfSet to search
keyIdentifier of node to look for
Returns
The found corresponding subnode or NULL if it was not in the set

Definition at line 475 of file node.c.

References agsubnodeideq(), graphviz_node_set::capacity, key, node_set_index(), NULL, graphviz_node_set::size, graphviz_node_set::slots, and TOMBSTONE.

Referenced by agfindnode_by_id(), and agsubrep().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ node_set_free()

void node_set_free ( node_set_t **  self)

destruct a set

*self is NULL on return.

Parameters
selfSet to destroy

Definition at line 545 of file node.c.

References free(), and NULL.

Referenced by agclose().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ node_set_is_empty()

static bool node_set_is_empty ( const node_set_t self)
inlinestatic

is this set empty?

Parameters
selfSet to query
Returns
True if this set contains nothing

Definition at line 55 of file node_set.h.

References node_set_size(), and NULL.

Referenced by agclose().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ node_set_new()

node_set_t * node_set_new ( void  )

construct a new set

Calls exit on failure (out-of-memory).

Returns
A constructed set

Definition at line 391 of file node.c.

References gv_alloc().

Referenced by agopen1().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ node_set_remove()

void node_set_remove ( node_set_t self,
IDTYPE  item 
)

remove an item from a set

If the given item was not in the set, this is a no-op.

Parameters
selfSet to remove from
itemIdentifier of element to remove

Definition at line 507 of file node.c.

References agsubnodeideq(), graphviz_node_set::capacity, node_set_index(), NULL, graphviz_node_set::size, graphviz_node_set::slots, and TOMBSTONE.

Referenced by agdelnodeimage(), and dict_relabel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ node_set_size()

size_t node_set_size ( const node_set_t self)

get the number of items in a set

Parameters
selfSet to query
Returns
Number of elements in the set

Definition at line 540 of file node.c.

References NULL, and graphviz_node_set::size.

Referenced by agnnodes(), installnode(), and node_set_is_empty().

Here is the caller graph for this function: