Ocean
Loading...
Searching...
No Matches
Ocean::KdTree< T >::Node Class Reference

This class defines a node of the k-d tree. More...

#include <KdTree.h>

Public Member Functions

 Node ()=default
 Creates an empty node.
 
 ~Node ()=default
 Destructs a node.
 
 Node (const T *value)
 Creates a new node with given value.
 
Nodeleft ()
 Returns the left child of this node.
 
Noderight ()
 Returns the right child of this node.
 
const T * value ()
 Returns value of this node.
 
void setLeft (std::unique_ptr< Node > &&left)
 Sets the left child of this node.
 
void setRight (std::unique_ptr< Node > &&right)
 Sets the right child of this node.
 
 operator bool () const
 Returns whether this node holds a valid value.
 

Protected Attributes

const T * value_ = nullptr
 Node value.
 
std::unique_ptr< Nodeleft_ = nullptr
 Left node.
 
std::unique_ptr< Noderight_ = nullptr
 Right node.
 

Detailed Description

template<typename T>
class Ocean::KdTree< T >::Node

This class defines a node of the k-d tree.

Constructor & Destructor Documentation

◆ Node() [1/2]

template<typename T >
Ocean::KdTree< T >::Node::Node ( )
default

Creates an empty node.

◆ ~Node()

template<typename T >
Ocean::KdTree< T >::Node::~Node ( )
default

Destructs a node.

◆ Node() [2/2]

template<typename T >
Ocean::KdTree< T >::Node::Node ( const T *  value)
inlineexplicit

Creates a new node with given value.

Parameters
valueNode value

Member Function Documentation

◆ left()

template<typename T >
KdTree< T >::Node * Ocean::KdTree< T >::Node::left ( )
inline

Returns the left child of this node.

Returns
Left child

◆ operator bool()

template<typename T >
Ocean::KdTree< T >::Node::operator bool ( ) const
inlineexplicit

Returns whether this node holds a valid value.

Returns
True, if so

◆ right()

template<typename T >
KdTree< T >::Node * Ocean::KdTree< T >::Node::right ( )
inline

Returns the right child of this node.

Returns
Right child

◆ setLeft()

template<typename T >
void Ocean::KdTree< T >::Node::setLeft ( std::unique_ptr< Node > &&  left)
inline

Sets the left child of this node.

Parameters
leftThe left child

◆ setRight()

template<typename T >
void Ocean::KdTree< T >::Node::setRight ( std::unique_ptr< Node > &&  right)
inline

Sets the right child of this node.

Parameters
rightThe right child

◆ value()

template<typename T >
const T * Ocean::KdTree< T >::Node::value ( )
inline

Returns value of this node.

Returns
Node value

Field Documentation

◆ left_

template<typename T >
std::unique_ptr<Node> Ocean::KdTree< T >::Node::left_ = nullptr
protected

Left node.

◆ right_

template<typename T >
std::unique_ptr<Node> Ocean::KdTree< T >::Node::right_ = nullptr
protected

Right node.

◆ value_

template<typename T >
const T* Ocean::KdTree< T >::Node::value_ = nullptr
protected

Node value.


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