Oracle Coherence for C++ API
Release 3.7.1.0

E22845-01

TreeMap::Node Class Reference

#include <coherence/util/TreeMap.hpp>

Inherits Object, and Map::Entry.

List of all members.


Detailed Description

An AVL tree node.

This class is used only within the TreeMap class and its derivations.
 

Public Types

typedef spec::Handle Handle
 Node Handle definition.
typedef spec::View View
 Node View definition.
typedef spec::Holder Holder
 Node Holder definition.

Public Member Functions

virtual Object::View getKey () const
 Return the key corresponding to this entry.
virtual Object::Holder getValue ()
 Return the value corresponding to this entry.
virtual void toStream (std::ostream &out) const
 Output a human-readable description of this Object to the given stream.

coherence::lang::operator<<(std::ostream, Object::View) is defined and will call into the toStream method, to output Objects. If a managed String object is desired, the COH_TO_STRING macro can be used to build up a String from streamable contents.

 Object::View vKey   = ...
 Object::View vValue = ...
 std::cout << vKey << " = " << vValue << std::endl;

 String::Handle hs = COH_TO_STRING(vKey << " = " << vValue);

Parameters:
 out the stream used to output the description
virtual void onInit ()
 Event called once the Object has finished being constructed.

Specifically when the first attachment is made. This provides a safe point at which Handles/Views to "this" can be created. It is not safe to create Handles/Views to an Object from within its constructor, thus any operations which rely upon this should be deferred until the onInit event is triggered.

As with all event methods any derived implementation should include a call to the super class's implementation. Specifically delegation to Object::onInit() must eventually occur or an IllegalStateException will result.

The default implementation calls the onInit() method of each of the Object's SmartMembers.


Public Attributes

FinalView< Objectm_vKey
 The key of the node.
MemberHolder< Objectm_ohValue
 The value of the node.
int32_t nBalance
 The AVL balance factor of the sub-tree.
MemberHandle< Nodem_hParent
 The parent of this node.
MemberHandle< Nodem_hLeft
 The left child of this node.
MemberHandle< Nodem_hRight
 The right child of this node.

Protected Member Functions

virtual void adopt (Node::Handle hChild, bool fLeft)
 Adopt a child node.
virtual Object::Holder getValue () const
 Get the value associated with the node.
virtual Object::Holder setValue (Object::Holder ohValue)
 Set the value associated with the node.
virtual bool isLeaf () const
 Determine if this node is a part of a 2-3-4 leaf node (i.e.
virtual void dissolve ()
 Unlink this element and all sub elements.


Member Function Documentation

virtual void adopt ( Node::Handle  hChild,
    bool  fLeft 
  )    [protected, virtual]

Adopt a child node.

Parameters:
 hChild the child to adopt
 fLeft the position of the child

virtual Object::Holder getValue (  )  const [protected, virtual]

Get the value associated with the node.

Returns:
the value associated with the node.

Implements Map::Entry.

virtual Object::Holder setValue ( Object::Holder  ohValue  )  [protected, virtual]

Set the value associated with the node.

Parameters:
 ohValue the value assocaited with the node
Returns:
the old value associated with the node

Implements Map::Entry.

virtual bool isLeaf (  )  const [protected, virtual]

Determine if this node is a part of a 2-3-4 leaf node (i.e.

at least one NULL child).

Returns:
true if this node is a leaf

virtual Object::View getKey (  )  const [virtual]

Return the key corresponding to this entry.

Returns:
the key corresponding to this entry

Implements Map::Entry.

virtual Object::Holder getValue (  )  [virtual]

Return the value corresponding to this entry.

Returns:
the value corresponding to this entry

Implements Map::Entry.


Member Data Documentation

FinalView<Object> m_vKey

The key of the node.

The key, once set, is considered immutable.


The documentation for this class was generated from the following file:
Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.