JsonCpp project page JsonCpp home page

Public Types | Public Member Functions | Friends

Json::ValueInternalMap Class Reference

A linked page based hash-table implementation used internally by Value. More...

#include </home/iurt/rpm/BUILD/jsoncpp-src-0.5.0/include/json/value.h>

Collaboration diagram for Json::ValueInternalMap:

List of all members.

Public Types

typedef unsigned int HashKey
typedef unsigned int BucketIndex

Public Member Functions

 ValueInternalMap ()
 ValueInternalMap (const ValueInternalMap &other)
ValueInternalMapoperator= (const ValueInternalMap &other)
 ~ValueInternalMap ()
void swap (ValueInternalMap &other)
BucketIndex size () const
void clear ()
bool reserveDelta (BucketIndex growth)
bool reserve (BucketIndex newItemCount)
const Valuefind (const char *key) const
Valuefind (const char *key)
ValueresolveReference (const char *key, bool isStatic)
void remove (const char *key)
void doActualRemove (ValueInternalLink *link, BucketIndex index, BucketIndex bucketIndex)
ValueInternalLink *& getLastLinkInBucket (BucketIndex bucketIndex)
ValuesetNewItem (const char *key, bool isStatic, ValueInternalLink *link, BucketIndex index)
ValueunsafeAdd (const char *key, bool isStatic, HashKey hashedKey)
HashKey hash (const char *key) const
int compare (const ValueInternalMap &other) const

Friends

class ValueIteratorBase
class Value

Detailed Description

A linked page based hash-table implementation used internally by Value.

ValueInternalMap is a tradional bucket based hash-table, with a linked list in each bucket to handle collision. There is an addional twist in that each node of the collision linked list is a page containing a fixed amount of value. This provides a better compromise between memory usage and speed.

Each bucket is made up of a chained list of ValueInternalLink. The last link of a given bucket can be found in the 'previous_' field of the following bucket. The last link of the last bucket is stored in tailLink_ as it has no following bucket. Only the last link of a bucket may contains 'available' item. The last link always contains at least one element unless is it the bucket one very first link.

Definition at line 630 of file value.h.


Member Typedef Documentation

Definition at line 636 of file value.h.

typedef unsigned int Json::ValueInternalMap::HashKey

Definition at line 635 of file value.h.


Constructor & Destructor Documentation

Json::ValueInternalMap::ValueInternalMap ( )

Definition at line 162 of file json_internalmap.inl.

Json::ValueInternalMap::ValueInternalMap ( const ValueInternalMap other)

Definition at line 171 of file json_internalmap.inl.

References reserve(), and resolveReference().

Json::ValueInternalMap::~ValueInternalMap ( )

Member Function Documentation

void Json::ValueInternalMap::clear ( )

Definition at line 240 of file json_value.cpp.

int Json::ValueInternalMap::compare ( const ValueInternalMap other) const

Definition at line 466 of file json_value.cpp.

void Json::ValueInternalMap::doActualRemove ( ValueInternalLink link,
BucketIndex  index,
BucketIndex  bucketIndex 
)
Value * Json::ValueInternalMap::find ( const char *  key)

Definition at line 296 of file json_internalmap.inl.

References find().

const Value * Json::ValueInternalMap::find ( const char *  key) const

Definition at line 274 of file json_value.cpp.

Referenced by find().

Here is the caller graph for this function:

ValueInternalLink *& Json::ValueInternalMap::getLastLinkInBucket ( BucketIndex  bucketIndex)

Definition at line 401 of file json_internalmap.inl.

References Json::ValueInternalLink::previous_.

Referenced by doActualRemove(), and unsafeAdd().

Here is the caller graph for this function:

ValueInternalMap::HashKey Json::ValueInternalMap::hash ( const char *  key) const

Definition at line 455 of file json_internalmap.inl.

Referenced by remove().

Here is the caller graph for this function:

ValueInternalMap & Json::ValueInternalMap::operator= ( const ValueInternalMap other)

Definition at line 194 of file json_value.cpp.

void Json::ValueInternalMap::remove ( const char *  key)

Definition at line 333 of file json_internalmap.inl.

References doActualRemove(), hash(), and Json::ValueInternalLink::next_.

bool Json::ValueInternalMap::reserve ( BucketIndex  newItemCount)

Definition at line 259 of file json_internalmap.inl.

References Json::ValueMapAllocator::allocateMapBuckets(), and Json::mapAllocator().

Referenced by reserveDelta(), and ValueInternalMap().

Here is the caller graph for this function:

bool Json::ValueInternalMap::reserveDelta ( BucketIndex  growth)

Definition at line 253 of file json_internalmap.inl.

References reserve().

Value & Json::ValueInternalMap::resolveReference ( const char *  key,
bool  isStatic 
)

Definition at line 305 of file json_value.cpp.

Referenced by ValueInternalMap().

Here is the caller graph for this function:

Value & Json::ValueInternalMap::setNewItem ( const char *  key,
bool  isStatic,
ValueInternalLink link,
BucketIndex  index 
)

Definition at line 413 of file json_internalmap.inl.

References Json::ValueInternalLink::items_, Json::ValueInternalLink::keys_, Json::ValueAllocator::makeMemberName(), and Json::valueAllocator().

Referenced by unsafeAdd().

Here is the caller graph for this function:

ValueInternalMap::BucketIndex Json::ValueInternalMap::size ( ) const

Definition at line 248 of file json_value.cpp.

void Json::ValueInternalMap::swap ( ValueInternalMap other)

Definition at line 222 of file json_value.cpp.

Value & Json::ValueInternalMap::unsafeAdd ( const char *  key,
bool  isStatic,
HashKey  hashedKey 
)

Friends And Related Function Documentation

friend class Value [friend]

Definition at line 633 of file value.h.

friend class ValueIteratorBase [friend]

Definition at line 632 of file value.h.


The documentation for this class was generated from the following files:

SourceForge Logo hosts this site. Send comments to:
Json-cpp Developers