Quick Links:

bal | bbl | bdl | bsl

Public Types | Public Member Functions

bslstl::TreeNode< VALUE > Class Template Reference

#include <bslstl_treenode.h>

Inheritance diagram for bslstl::TreeNode< VALUE >:
bslalg::RbTreeNode

List of all members.

Public Types

enum  Color { BSLALG_RED = 0, BSLALG_BLACK = 1 }

Public Member Functions

VALUE & value ()
const VALUE & value () const
void makeBlack ()
void makeRed ()
void setParent (RbTreeNode *address)
void setLeftChild (RbTreeNode *address)
void setRightChild (RbTreeNode *address)
void setColor (Color value)
void toggleColor ()
void reset (RbTreeNode *parent, RbTreeNode *leftChild, RbTreeNode *rightChild, Color color)
RbTreeNode * parent ()
const RbTreeNode * parent () const
RbTreeNode * leftChild ()
const RbTreeNode * leftChild () const
RbTreeNode * rightChild ()
const RbTreeNode * rightChild () const
bool isBlack () const
bool isRed () const
Color color () const

Detailed Description

template<class VALUE>
class bslstl::TreeNode< VALUE >

This POD-like class describes a node suitable for use in a red-black binary search tree of values of the parameterized VALUE. This class is a "POD-like" to facilitate efficient allocation and use in the context of a container implementation. In order to meet the essential requirements of a POD type, this class does not define a constructor or destructor. The manipulator, value, returns a modifiable reference to d_value so that it may be constructed in-place by the appropriate bsl::allocator_traits object.

See Component bslstl_treenode


Member Enumeration Documentation

enum bslalg::RbTreeNode::Color [inherited]
Enumerator:
BSLALG_RED 
BSLALG_BLACK 

Member Function Documentation

template<class VALUE>
VALUE& bslstl::TreeNode< VALUE >::value (  ) 

Return a reference providing modifiable access to the value of this object.

template<class VALUE>
const VALUE& bslstl::TreeNode< VALUE >::value (  )  const

Return a reference providing non-modifiable access to the value of this object.

void bslalg::RbTreeNode::makeBlack (  )  [inherited]

Set the color of this node to black. Note that this operation is at least as fast as (and potentially faster than) setColor.

void bslalg::RbTreeNode::makeRed (  )  [inherited]

Set the color of this node to red. Note that this operation is at least as fast as (and potentially faster than) setColor.

void bslalg::RbTreeNode::setParent ( RbTreeNode address  )  [inherited]

Set the parent of this node to the specified address. If address is 0, then this node will have not have a parent node (i.e., it will be the root node). The behavior is undefined unless address is aligned to at least two bytes.

void bslalg::RbTreeNode::setLeftChild ( RbTreeNode address  )  [inherited]

Set the left child of this node to the specified address. If address is 0, then this node will not have a left child.

void bslalg::RbTreeNode::setRightChild ( RbTreeNode address  )  [inherited]

Set the right child of this node to the specified address. If address is 0, then this node will not have a right child.

void bslalg::RbTreeNode::setColor ( Color  value  )  [inherited]

Set the color of this node to the specified value.

void bslalg::RbTreeNode::toggleColor (  )  [inherited]

Set the color of this node to the alternative color. If this node's color is red, set it to black, and set it to red otherwise. Note that this operation is at least as fast as (and potentially faster than) setColor.

void bslalg::RbTreeNode::reset ( RbTreeNode parent,
RbTreeNode leftChild,
RbTreeNode rightChild,
Color  color 
) [inherited]

Reset this object to have the specified parent, leftChild, rightChild, and color property values.

RbTreeNode* bslalg::RbTreeNode::parent (  )  [inherited]

Return the address of the (modifiable) parent of this node if one exists, and 0 otherwise.

const RbTreeNode* bslalg::RbTreeNode::parent (  )  const [inherited]

Return the address of the parent of this node if one exists, and 0 otherwise.

RbTreeNode* bslalg::RbTreeNode::leftChild (  )  [inherited]

Return the address of the (modifiable) left child of this node if one exists, and 0 otherwise.

const RbTreeNode* bslalg::RbTreeNode::leftChild (  )  const [inherited]

Return the address of the left child of this node if one exists, and 0 otherwise.

RbTreeNode* bslalg::RbTreeNode::rightChild (  )  [inherited]

Return the address of the (modifiable) right child of this node if one exists, and 0 otherwise.

const RbTreeNode* bslalg::RbTreeNode::rightChild (  )  const [inherited]

Return the address of the right child of this node if one exists, and 0 otherwise.

bool bslalg::RbTreeNode::isBlack (  )  const [inherited]

Return true if this node is black.

bool bslalg::RbTreeNode::isRed (  )  const [inherited]

Return true if this node is red.

Color bslalg::RbTreeNode::color (  )  const [inherited]

Return the color of this node.


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