Sturk 1.0.2
Publish-subscribe C implementation.
Loading...
Searching...
No Matches
vertegs.h File Reference

Vertex. More...

#include <stddef.h>
Include dependency graph for vertegs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Vertegs
 The data type for a graph vertex. More...
 

Macros

#define VX_EXCEPT(reason, file, line)
 Raise an exception.
 
#define VX_ENSURE_MEM(ptr)
 Raise an exception and return NULL if the pointer is NULL.
 

Functions

static struct Vertegsvx_4nbor (struct Vertegs **nbor)
 Cast to vertex from its neighbourhood.
 
static struct Vertegsvx_walk (struct Vertegs *v, size_t edge, int len)
 For a chain, in which all edges share the same index, find the other end.
 
static struct Vertegsvx_inslist (struct Vertegs *list, struct Vertegs *entry, int pos)
 Insert, at a given position, an entry into a list.
 
static struct Vertegsvx_remlist (struct Vertegs **listp, int pos)
 Remove, at a given position, an entry from a list.
 
static struct Vertegsvx_inscirq (struct Vertegs *cirq, struct Vertegs *entry, int pos)
 Insert, at a given position, an entry into a cirq.
 
static struct Vertegsvx_remcirq (struct Vertegs **cirqp, int pos)
 Remove, at a given position, an entry from a cirq.
 

Detailed Description

Vertex.

This header file provides data types, functions and macros that define and operate on graph vertices.

Macro Definition Documentation

◆ VX_ENSURE_MEM

#define VX_ENSURE_MEM (   ptr)
Value:
do { \
if ((ptr) == NULL) { \
VX_EXCEPT("Null param.", __FILE__, __LINE__); \
return NULL; \
} \
} while (0)

Raise an exception and return NULL if the pointer is NULL.

Parameters
[in]ptrThe pointer.

Function Documentation

◆ vx_4nbor()

static inline struct Vertegs * vx_4nbor ( struct Vertegs **  nbor)
inlinestatic

Cast to vertex from its neighbourhood.

Parameters
[in]nborThe neighbourhood.
Returns
The vertex.

◆ vx_inscirq()

static inline struct Vertegs * vx_inscirq ( struct Vertegs cirq,
struct Vertegs entry,
int  pos 
)
inlinestatic

Insert, at a given position, an entry into a cirq.

Parameters
[in]cirqThe head of the cirq.
[in]entryThe new entry.
[in]posThe position.
Returns
The new head.

◆ vx_inslist()

static inline struct Vertegs * vx_inslist ( struct Vertegs list,
struct Vertegs entry,
int  pos 
)
inlinestatic

Insert, at a given position, an entry into a list.

Parameters
[in]listThe head of the list.
[in]entryThe new entry.
[in]posThe position.
Returns
The new head.

◆ vx_remcirq()

static inline struct Vertegs * vx_remcirq ( struct Vertegs **  cirqp,
int  pos 
)
inlinestatic

Remove, at a given position, an entry from a cirq.

Parameters
[in]cirqpThe pointer to the head of the cirq.
[in]posThe position.
Returns
The removed entry.

◆ vx_remlist()

static inline struct Vertegs * vx_remlist ( struct Vertegs **  listp,
int  pos 
)
inlinestatic

Remove, at a given position, an entry from a list.

Parameters
[in]listpThe pointer to the head of the list.
[in]posThe position.
Returns
The removed entry.

◆ vx_walk()

static inline struct Vertegs * vx_walk ( struct Vertegs v,
size_t  edge,
int  len 
)
inlinestatic

For a chain, in which all edges share the same index, find the other end.

Parameters
[in]vThe first end of the chain.
[in]edgeThe index of all edges in the chain.
[in]lenThe length of the chain - the number of edges.
Returns
The other end.