#include <coherence/util/AbstractSparseArray.hpp>
Inherits Object.
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 TypedHandle < const String > | toString () const |
Output a human-readable description of this Object to the given stream. Note that when overriding this method the return type must be TypedHandle<const String> rather then String::View. These two types are assignment compatible but not equivalent and declaring the override with String::View will not be a compatible override. coherence::lang::operator<<(std::ostream, Object::View) is defined and will call into the toString 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 and is generally how toString() will be implemented.
Object::View vKey = ... Object::View vValue = ... std::cout << vKey << " = " << vValue << std::endl; String::View vs = COH_TO_STRING(vKey << " = " << vValue); The COH_TO_STRING macro is also the most common way to implement the toString method. For example:
virtual TypedHandle<const String> Person::toString() const { return COH_TO_STRING("Name: " << f_sName << " SSN: " << f_nSSN); }
| |
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< Node > | parent |
The parent of this node. | |
MemberHandle< Node > | left |
The left child of this node. | |
MemberHandle< Node > | right |
The right child of this node. |
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.
virtual Object::Holder setValue | ( | Object::Holder | ohValue | ) | [pure virtual] |
Set the value associated with the node.
ohValue | the value assocaited 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).
virtual bool isLinked | ( | ) | const [virtual] |
Return true iff the node is linked to other nodes.
int64_t key |
The key of the node.
The key, once set, is considered immutable.