tetengo 1.8.1
A multipurpose library set
Loading...
Searching...
No Matches
path.h File Reference

A path. More...

#include <stdbool.h>
#include <stddef.h>
#include <tetengo/lattice/node.h>
+ Include dependency graph for path.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

tetengo_lattice_path_t * tetengo_lattice_path_createEmpty ()
 Creates an empty path.
 
tetengo_lattice_path_t * tetengo_lattice_path_create (const tetengo_lattice_node_t *p_nodes, size_t node_count, int cost)
 Creates a path.
 
void tetengo_lattice_path_destroy (const tetengo_lattice_path_t *p_path)
 Destroys a path.
 
bool tetengo_lattice_path_empty (const tetengo_lattice_path_t *p_path)
 Returns true when this path is empty.
 
size_t tetengo_lattice_path_pNodes (const tetengo_lattice_path_t *p_path, tetengo_lattice_node_t *p_nodes)
 Returns the nodes.
 
int tetengo_lattice_path_cost (const tetengo_lattice_path_t *p_path)
 Returns the cost.
 

Detailed Description

A path.

Copyright (C) 2019-2023 kaoru https://www.tetengo.org/

Function Documentation

◆ tetengo_lattice_path_cost()

int tetengo_lattice_path_cost ( const tetengo_lattice_path_t *  p_path)

Returns the cost.

Parameters
p_pathA pointer to a path.
Returns
The cost. Or 0 when p_path is NULL.

◆ tetengo_lattice_path_create()

tetengo_lattice_path_t * tetengo_lattice_path_create ( const tetengo_lattice_node_t p_nodes,
size_t  node_count,
int  cost 
)

Creates a path.

Parameters
p_nodesA pointer to nodes.
node_countA node count.
costA cost.
Returns
A pointer to a path. Or NULL when p_nodes is NULL and noce_count is greater than 0.

◆ tetengo_lattice_path_createEmpty()

tetengo_lattice_path_t * tetengo_lattice_path_createEmpty ( )

Creates an empty path.

Returns
A pointer to a path. Or NULL when p_nodes is NULL.

◆ tetengo_lattice_path_destroy()

void tetengo_lattice_path_destroy ( const tetengo_lattice_path_t *  p_path)

Destroys a path.

Parameters
p_pathA pointer to a path.

◆ tetengo_lattice_path_empty()

bool tetengo_lattice_path_empty ( const tetengo_lattice_path_t *  p_path)

Returns true when this path is empty.

Parameters
p_pathA pointer to a path.
Return values
trueWhen this path is empty.
falseOtherwise.

◆ tetengo_lattice_path_pNodes()

size_t tetengo_lattice_path_pNodes ( const tetengo_lattice_path_t *  p_path,
tetengo_lattice_node_t p_nodes 
)

Returns the nodes.

The second and the latter nodes follows the head node continuously.

Parameters
p_pathA pointer to a path.
p_nodesThe storage for the nodes. Can be NULL.
Returns
The node count. Or 0 when p_path is NULL.