#include <coherence/util/SafeHashMap.hpp>
Inherits Object.
The Map.entrySet
method returns a collection-view of the map, whose elements are of this class.
Public Types | |
typedef spec::Handle | Handle |
Entry Handle definition. | |
typedef spec::View | View |
Entry View definition. | |
typedef spec::Holder | Holder |
Entry Holder definition. | |
Public Member Functions | |
virtual bool | isKeyEqual (Object::View vKey) const |
Return true if the supplied key is equal to the entries key. | |
virtual Object::View | getKey () const |
virtual Object::Holder | getValue () const |
virtual Object::Holder | getValue () |
virtual Object::Holder | setValue (Object::Holder ohValue) |
virtual void | onAdd () |
This method is invoked when the containing Map has actually added this Entry to itself. | |
virtual bool | equals (Object::View vThat) const |
virtual size32_t | hashCode () const |
Return a hash code value for the Object. This method is supported for the benefit of hash-based containers.
The general contract of
The default implementation is identity based.
| |
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); }
| |
Protected Member Functions | |
Entry (Object::View vKey, Object::Holder ohValue, size32_t nHash) | |
Create a new Map::Entry. | |
Entry (const Entry &that) | |
Copy Constructor. | |
Entry (Entry::View vThat) | |
Instantiate an Entry shallow copying the key and value from the Entry provided. | |
Protected Attributes | |
FinalView< Object > | f_vKey |
The key. | |
MemberHolder< Object > | m_ohValue |
The value. | |
const size32_t | m_nHash |
The key's hash code. | |
MemberHandle< Entry > | m_hNext |
The next entry in the linked list (an open hashing implementation). |
Entry | ( | Object::View | vKey, | |
Object::Holder | ohValue, | |||
size32_t | nHash | |||
) | [protected] |
Create a new Map::Entry.
vKey | the assocaited key | |
ohValue | the associated value | |
hHash | the associated hash code |
Entry | ( | Entry::View | vThat | ) | [protected] |
MemberHolder<Object> m_ohValue [protected] |
The value.
This object reference can change within the life of the Entry.
const size32_t m_nHash [protected] |
The key's hash code.
This value will not change for the life of the Entry.