tetengo 1.8.2
A multipurpose library set
Loading...
Searching...
No Matches
tetengo::lattice::node Class Reference

A node. More...

#include <node.hpp>

+ Inheritance diagram for tetengo::lattice::node:
+ Collaboration diagram for tetengo::lattice::node:

Public Member Functions

constexpr node (const input *p_key, const std::any *p_value, std::size_t index_in_step, std::size_t preceding_step, const std::vector< int > *p_preceding_edge_costs, std::size_t best_preceding_node, int node_cost, int path_cost)
 Creates a node.
 
constexpr node (const entry_view &entry, std::size_t index_in_step, std::size_t preceding_step, const std::vector< int > *p_preceding_edge_costs, std::size_t best_preceding_node, int path_cost)
 Creates a node from a vocabulary entry.
 
constexpr const inputp_key () const
 Returns the key.
 
constexpr const std::any & value () const
 Returns the value.
 
constexpr std::size_t index_in_step () const
 Returns the index in the step.
 
constexpr std::size_t preceding_step () const
 Returns the preceding step.
 
constexpr const std::vector< int > & preceding_edge_costs () const
 Returns the preceding edge costs.
 
constexpr std::size_t best_preceding_node () const
 Returns the index of the best preceding node.
 
constexpr int node_cost () const
 Returns the node cost.
 
constexpr int path_cost () const
 Returns the path cost.
 
bool is_bos () const
 Returns true is this node is the BOS.
 

Static Public Member Functions

static node bos (const std::vector< int > *p_preceding_edge_costs)
 Returns the BOS (Beginning of Sequence).
 
static node eos (std::size_t preceding_step, const std::vector< int > *p_preceding_edge_costs, std::size_t best_preceding_node, int path_cost)
 Returns an EOS (End of Sequence).
 

Friends

constexpr bool operator== (const node &one, const node &another)
 Returns true if one node is equal to another.
 

Detailed Description

A node.

Constructor & Destructor Documentation

◆ node() [1/2]

tetengo::lattice::node::node ( const input * p_key,
const std::any * p_value,
std::size_t index_in_step,
std::size_t preceding_step,
const std::vector< int > * p_preceding_edge_costs,
std::size_t best_preceding_node,
int node_cost,
int path_cost )
inlineconstexpr

Creates a node.

Parameters
p_keyA pointer to a key.
p_valueA pointer to a value.
index_in_stepAn index in the step.
preceding_stepAn index of a preceding step.
p_preceding_edge_costsA pointer to preceding edge costs.
best_preceding_nodeAn index of a best preceding node.
node_costA node cost.
path_costA path cost.

◆ node() [2/2]

tetengo::lattice::node::node ( const entry_view & entry,
std::size_t index_in_step,
std::size_t preceding_step,
const std::vector< int > * p_preceding_edge_costs,
std::size_t best_preceding_node,
int path_cost )
inlineconstexpr

Creates a node from a vocabulary entry.

Parameters
entryAn entry.
index_in_stepAn index in the step.
preceding_stepAn index of a preceding step.
p_preceding_edge_costsA pointer to preceding edge costs.
best_preceding_nodeAn index of a best preceding node.
path_costA path cost.
Exceptions
std::invalid_argumentWhen p_preceding_edge_costs is nullptr.

Member Function Documentation

◆ best_preceding_node()

std::size_t tetengo::lattice::node::best_preceding_node ( ) const
inlinenodiscardconstexpr

Returns the index of the best preceding node.

Returns
The index of the best preceding node.

◆ bos()

static node tetengo::lattice::node::bos ( const std::vector< int > * p_preceding_edge_costs)
staticnodiscard

Returns the BOS (Beginning of Sequence).

Parameters
p_preceding_edge_costsA pointer to preceding edge costs.
Returns
The BOS.
Exceptions
std::invalid_argumentWhen p_preceding_edge_costs is nullptr.

◆ eos()

static node tetengo::lattice::node::eos ( std::size_t preceding_step,
const std::vector< int > * p_preceding_edge_costs,
std::size_t best_preceding_node,
int path_cost )
staticnodiscard

Returns an EOS (End of Sequence).

Parameters
preceding_stepAn index of a preceding step.
p_preceding_edge_costsA pointer to preceding edge costs.
best_preceding_nodeAn index of a best preceding node.
path_costA path cost.
Returns
An EOS.
Exceptions
std::invalid_argumentWhen p_preceding_edge_costs is nullptr.

◆ index_in_step()

std::size_t tetengo::lattice::node::index_in_step ( ) const
inlinenodiscardconstexpr

Returns the index in the step.

Returns
The index in the step.

◆ is_bos()

bool tetengo::lattice::node::is_bos ( ) const
nodiscard

Returns true is this node is the BOS.

Return values
trueWhen this node is the BOS.
falseOtherwise.

◆ node_cost()

int tetengo::lattice::node::node_cost ( ) const
inlinenodiscardconstexpr

Returns the node cost.

Returns
The node cost.

◆ p_key()

const input * tetengo::lattice::node::p_key ( ) const
inlinenodiscardconstexpr

Returns the key.

Returns
The key.

◆ path_cost()

int tetengo::lattice::node::path_cost ( ) const
inlinenodiscardconstexpr

Returns the path cost.

Returns
The path cost.

◆ preceding_edge_costs()

const std::vector< int > & tetengo::lattice::node::preceding_edge_costs ( ) const
inlinenodiscardconstexpr

Returns the preceding edge costs.

Returns
The preceding edge costs.

◆ preceding_step()

std::size_t tetengo::lattice::node::preceding_step ( ) const
inlinenodiscardconstexpr

Returns the preceding step.

Returns
The preceding step.

◆ value()

const std::any & tetengo::lattice::node::value ( ) const
inlinenodiscardconstexpr

Returns the value.

Returns
The value.

Friends And Related Symbol Documentation

◆ operator==

bool operator== ( const node & one,
const node & another )
friend

Returns true if one node is equal to another.

Parameters
oneOne node.
anotherAnother node.
Return values
trueWhen one node is equal to another.
valseOtherwise.

The documentation for this class was generated from the following file: