Template Class OcTreeDataNode

Inheritance Relationships

Base Type

Class Documentation

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

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

.#

Note: If you derive a class (directly or indirectly) from

OcTreeDataNode, you have to implement (at least) the following functions to avoid slicing errors and memory-related bugs: createChild(), getChild(), getChild() const, expandNode() See ColorOcTreeNode in ColorOcTree.h for an example.

Template Parameters:

T – data to be stored in the node (e.g. a float for probabilities)

Public Types

typedef T DataType

Make the templated data type available from the outside.

Public Functions

OcTreeDataNode()
OcTreeDataNode(T initVal)
OcTreeDataNode(const OcTreeDataNode &rhs)

Copy constructor, performs a recursive deep-copy of all children including node data in “value”

~OcTreeDataNode()

Delete only own members. OcTree maintains tree structure and must have deleted children already

void copyData(const OcTreeDataNode &from)

Copy the payload (data in “value”) from rhs into this node Opposed to copy ctor, this does not clone the children as well

bool operator==(const OcTreeDataNode &rhs) const

Equals operator, compares if the stored value is identical.

OCTOMAP_DEPRECATED(bool childExists(unsigned int i) const)

Test whether the i-th child exists.

Deprecated:

Replaced by tree->nodeChildExists(…)

Returns:

true if the i-th child exists

OCTOMAP_DEPRECATED(bool hasChildren() const)

Deprecated:

Replaced by tree->nodeHasChildren(…)

Returns:

true if the node has at least one child

inline T getValue() const
Returns:

value stored in the node

inline void setValue(T v)

sets value to be stored in the node

std::istream &readData(std::istream &s)

Read node payload (data only) from binary stream.

std::ostream &writeData(std::ostream &s) const

Write node payload (data only) to binary stream.

Protected Functions

void allocChildren()

Protected Attributes

AbstractOcTreeNode **children

pointer to array of children, may be NULL

Note

The tree class manages this pointer, the array, and the memory for it! The children of a node are always enforced to be the same type as the node

T value

stored data (payload)