Main MRPT website > C++ reference for MRPT 1.4.0
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
octomap::OcTreeDataNode< T > Class Template Reference

Detailed Description

template<typename T>
class octomap::OcTreeDataNode< T >

Basic node in the OcTree that can hold arbitrary data of type T in value.

This is the base class for nodes used in an OcTree. The used implementation for occupancy mapping is in OcTreeNode.#

Template Parameters
Tdata to be stored in the node (e.g. a float for probabilities)

Definition at line 69 of file OcTreeDataNode.h.

#include <mrpt/otherlibs/octomap/OcTreeDataNode.h>

Inheritance diagram for octomap::OcTreeDataNode< T >:
Inheritance graph

Public Types

typedef T DataType
 Make the templated data type available from the outside. More...
 

Public Member Functions

 OcTreeDataNode ()
 
 OcTreeDataNode (T initVal)
 
 OcTreeDataNode (const OcTreeDataNode &rhs)
 Copy constructor, performs a recursive deep-copy of all children. More...
 
 ~OcTreeDataNode ()
 
bool operator== (const OcTreeDataNode &rhs) const
 Equals operator, compares if the stored value is identical. More...
 
bool createChild (unsigned int i)
 initialize i-th child, allocate children array if needed More...
 
bool childExists (unsigned int i) const
 
OcTreeDataNode< T > * getChild (unsigned int i)
 
const OcTreeDataNode< T > * getChild (unsigned int i) const
 
bool hasChildren () const
 
bool collapsible () const
 A node is collapsible if all children exist, don't have children of their own and have the same occupancy value. More...
 
void deleteChild (unsigned int i)
 Deletes the i-th child of the node. More...
 
bool pruneNode ()
 Prunes a node when it is collapsible. More...
 
void expandNode ()
 Expands a node (reverse of pruning): All children are created and their occupancy probability is set to the node's value. More...
 
getValue () const
 
void setValue (T v)
 sets value to be stored in the node More...
 
std::istream & readValue (std::istream &s)
 Read node from binary stream (incl. More...
 
std::ostream & writeValue (std::ostream &s) const
 Write node to binary stream (incl float value), recursively continue with all children. More...
 

Protected Member Functions

void allocChildren ()
 

Protected Attributes

OcTreeDataNode< T > ** children
 pointer to array of children, may be NULL More...
 
value
 stored data (payload) More...
 

Member Typedef Documentation

template<typename T>
typedef T octomap::OcTreeDataNode< T >::DataType

Make the templated data type available from the outside.

Definition at line 156 of file OcTreeDataNode.h.

Constructor & Destructor Documentation

template<typename T>
octomap::OcTreeDataNode< T >::OcTreeDataNode ( )
template<typename T>
octomap::OcTreeDataNode< T >::OcTreeDataNode ( initVal)
template<typename T>
octomap::OcTreeDataNode< T >::OcTreeDataNode ( const OcTreeDataNode< T > &  rhs)

Copy constructor, performs a recursive deep-copy of all children.

template<typename T>
octomap::OcTreeDataNode< T >::~OcTreeDataNode ( )

Member Function Documentation

template<typename T>
void octomap::OcTreeDataNode< T >::allocChildren ( )
protected
template<typename T>
bool octomap::OcTreeDataNode< T >::childExists ( unsigned int  i) const
Returns
true if the i-th child exists
template<typename T>
bool octomap::OcTreeDataNode< T >::collapsible ( ) const

A node is collapsible if all children exist, don't have children of their own and have the same occupancy value.

template<typename T>
bool octomap::OcTreeDataNode< T >::createChild ( unsigned int  i)

initialize i-th child, allocate children array if needed

template<typename T>
void octomap::OcTreeDataNode< T >::deleteChild ( unsigned int  i)

Deletes the i-th child of the node.

template<typename T>
void octomap::OcTreeDataNode< T >::expandNode ( )

Expands a node (reverse of pruning): All children are created and their occupancy probability is set to the node's value.

You need to verify that this is indeed a pruned node (i.e. not a leaf at the lowest level)

template<typename T>
OcTreeDataNode<T>* octomap::OcTreeDataNode< T >::getChild ( unsigned int  i)
Returns
a pointer to the i-th child of the node. The child needs to exist.

Referenced by octomap::CountingOcTreeNode::getChild(), and octomap::OcTreeNode::getChild().

template<typename T>
const OcTreeDataNode<T>* octomap::OcTreeDataNode< T >::getChild ( unsigned int  i) const
Returns
a const pointer to the i-th child of the node. The child needs to exist.
template<typename T>
T octomap::OcTreeDataNode< T >::getValue ( ) const
inline
Returns
value stored in the node

Definition at line 129 of file OcTreeDataNode.h.

template<typename T>
bool octomap::OcTreeDataNode< T >::hasChildren ( ) const
Returns
true if the node has at least one child
template<typename T>
bool octomap::OcTreeDataNode< T >::operator== ( const OcTreeDataNode< T > &  rhs) const

Equals operator, compares if the stored value is identical.

template<typename T>
bool octomap::OcTreeDataNode< T >::pruneNode ( )

Prunes a node when it is collapsible.

Returns
true if pruning was successful
template<typename T>
std::istream& octomap::OcTreeDataNode< T >::readValue ( std::istream &  s)

Read node from binary stream (incl.

float value), recursively continue with all children.

Parameters
s
Returns
template<typename T>
void octomap::OcTreeDataNode< T >::setValue ( v)
inline

sets value to be stored in the node

Definition at line 131 of file OcTreeDataNode.h.

template<typename T>
std::ostream& octomap::OcTreeDataNode< T >::writeValue ( std::ostream &  s) const

Write node to binary stream (incl float value), recursively continue with all children.

This preserves the complete state of the node.

Parameters
s
Returns

Member Data Documentation

template<typename T>
OcTreeDataNode<T>** octomap::OcTreeDataNode< T >::children
protected

pointer to array of children, may be NULL

Definition at line 163 of file OcTreeDataNode.h.

template<typename T>
T octomap::OcTreeDataNode< T >::value
protected

stored data (payload)

Definition at line 165 of file OcTreeDataNode.h.

Referenced by octomap::OcTreeNodeStamped::operator==(), and octomap::ColorOcTreeNode::operator==().




Page generated by Doxygen 1.8.11 for MRPT 1.4.0 SVN:Unversioned directory at Tue Jun 28 11:46:25 UTC 2016