Quick Links: |
#include <bslalg_rbtreeanchor.h>
Public Member Functions | |
RbTreeAnchor () | |
RbTreeAnchor (RbTreeNode *rootNode, RbTreeNode *firstNode, int numNodes) | |
~RbTreeAnchor () | |
void | reset (RbTreeNode *rootNode, RbTreeNode *firstNode, int numNodes) |
void | setFirstNode (RbTreeNode *value) |
void | setRootNode (RbTreeNode *value) |
void | setNumNodes (int value) |
void | incrementNumNodes () |
void | decrementNumNodes () |
RbTreeNode * | rootNode () |
RbTreeNode * | firstNode () |
RbTreeNode * | sentinel () |
const RbTreeNode * | firstNode () const |
const RbTreeNode * | rootNode () const |
const RbTreeNode * | sentinel () const |
int | numNodes () const |
An RbTreeAnchor
provides the addresses of the first and root nodes of a binary search tree. An RbTreeAnchor
is similar to an in-core simply constrained (value-semantic) attribute class, except that it does not supply equality-comparison, copy-construction, and copy-assignment operations. Note that a node may not be copied because sentinel
returns an address unique to each RbTreeAnchor
object.
This class:
const
thread-safe For terminology see bsldoc_glossary
.
See Component bslalg_rbtreeanchor
bslalg::RbTreeAnchor::RbTreeAnchor | ( | ) |
bslalg::RbTreeAnchor::RbTreeAnchor | ( | RbTreeNode * | rootNode, | |
RbTreeNode * | firstNode, | |||
int | numNodes | |||
) |
Create a RbTreeAnchor
object having the specified rootNode
, firstNode
, and numNodes
attribute values.
bslalg::RbTreeAnchor::~RbTreeAnchor | ( | ) |
Destroy this object.
void bslalg::RbTreeAnchor::reset | ( | RbTreeNode * | rootNode, | |
RbTreeNode * | firstNode, | |||
int | numNodes | |||
) |
Set the rootNode
, firstNode
, and numNodes
attributes to the specified rootNodeValue
, firstNodeValue
, and numNodes
respectively.
void bslalg::RbTreeAnchor::setFirstNode | ( | RbTreeNode * | value | ) |
Set the firstNode
attribute of this object to the specified value
.
void bslalg::RbTreeAnchor::setRootNode | ( | RbTreeNode * | value | ) |
Set the rootNode
attribute of this object to the specified value
.
void bslalg::RbTreeAnchor::setNumNodes | ( | int | value | ) |
Set the numNodes
attribute of this object to the specified value
. The behavior is undefined unless 0 <= value
.
void bslalg::RbTreeAnchor::incrementNumNodes | ( | ) |
Increment, by 1, the numNodes
attribute of this object. The behavior is undefined unless numNodes <= INT_MAX - 1
.
void bslalg::RbTreeAnchor::decrementNumNodes | ( | ) |
Decrement, by 1, the numNodes
attribute of this object. The behavior is undefined unless 1 <= numNodes
.
RbTreeNode* bslalg::RbTreeAnchor::rootNode | ( | ) |
Return the address of the (modifiable) node referred to by the rootNode
attribute of this object.
RbTreeNode* bslalg::RbTreeAnchor::firstNode | ( | ) |
Return the address of the (modifiable) node referred to by the firstNode
attribute of this object.
RbTreeNode* bslalg::RbTreeAnchor::sentinel | ( | ) |
Return the address of the (modifiable) node referred to by the sentinel
node for this tree.
const RbTreeNode* bslalg::RbTreeAnchor::firstNode | ( | ) | const |
Return the address referred to by the firstNode
attribute of this object.
const RbTreeNode* bslalg::RbTreeAnchor::rootNode | ( | ) | const |
Return the address referred to by the rootNode
attribute of this object.
const RbTreeNode* bslalg::RbTreeAnchor::sentinel | ( | ) | const |
Return the address referred to by the sentinel
node for this tree.
int bslalg::RbTreeAnchor::numNodes | ( | ) | const |
Return the numNodes
attribute of this object.