Oracle Coherence for C++ API


AbstractSparseArray::Node Class Reference

#include <coherence/util/AbstractSparseArray.hpp>

Inherits Object.

List of all members.

Detailed Description

An AVL tree node.

This class is used only within the AbstractSparseArray 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 void adopt (Node::Handle hChild, bool fLeft)
 Adopt a child node.
virtual Object::Holder getValue () const =0
 Get the value associated with the node.
virtual Object::Holder setValue (Object::Holder ohValue)=0
 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 bool isLinked () const
 Return true iff the node is linked to other nodes.
virtual void dissolve ()
 Unlink this element and all sub elements.
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);

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

int64_t key
 The key of the node.
int32_t balance
 The AVL balance factor of the sub-tree.
MemberHandle< Nodeparent
 The parent of this node.
MemberHandle< Nodeleft
 The left child of this node.
MemberHandle< Noderight
 The right child of this node.

Member Function Documentation

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

Adopt a child node.

hChild the child to adopt
fLeft the position of the child

virtual Object::Holder getValue (  )  const [pure virtual]

Get the value associated with the node.

the value associated with the node.

virtual Object::Holder setValue ( Object::Holder  ohValue  )  [pure virtual]

Set the value associated with the node.

ohValue the value assocaited with the node
the old value associated with the node

virtual bool isLeaf (  )  const [virtual]

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

at least one NULL child).

true if this node is a leaf

virtual bool isLinked (  )  const [virtual]

Return true iff the node is linked to other nodes.

true iff the node has a parent or children

Member Data Documentation

int64_t key

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, 2010, Oracle and/or its affiliates. All rights reserved.