JsonCpp project page JsonCpp home page

Json::ValueInternalMap Class Reference

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

#include <json/value.h>

Collaboration diagram for Json::ValueInternalMap:

Collaboration graph
[legend]

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.

For internal use only.

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 664 of file value.h.


Member Typedef Documentation

Definition at line 670 of file value.h.

typedef unsigned int Json::ValueInternalMap::HashKey

Definition at line 669 of file value.h.


Constructor & Destructor Documentation

Json::ValueInternalMap::ValueInternalMap (  ) 

Definition at line 168 of file json_internalmap.inl.

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

Definition at line 177 of file json_internalmap.inl.

References reserve(), and resolveReference().

Json::ValueInternalMap::~ValueInternalMap (  ) 


Member Function Documentation

void Json::ValueInternalMap::clear (  ) 

Definition at line 245 of file json_internalmap.inl.

References swap().

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

Definition at line 471 of file json_internalmap.inl.

References Json::Value::compare(), and find().

void Json::ValueInternalMap::doActualRemove ( ValueInternalLink link,
BucketIndex  index,
BucketIndex  bucketIndex 
)

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

Definition at line 302 of file json_internalmap.inl.

References find().

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

Definition at line 279 of file json_internalmap.inl.

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

Referenced by compare(), and find().

Here is the caller graph for this function:

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

Definition at line 407 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 461 of file json_internalmap.inl.

Referenced by find(), remove(), and resolveReference().

Here is the caller graph for this function:

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

Definition at line 199 of file json_internalmap.inl.

References swap().

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

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

Definition at line 265 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 259 of file json_internalmap.inl.

References reserve().

Referenced by resolveReference().

Here is the caller graph for this function:

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

Definition at line 310 of file json_internalmap.inl.

References hash(), Json::ValueInternalLink::itemPerLink, Json::ValueInternalLink::next_, reserveDelta(), setNewItem(), and unsafeAdd().

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 419 of file json_internalmap.inl.

References Json::ValueInternalLink::items_, and Json::ValueInternalLink::keys_.

Referenced by resolveReference(), and unsafeAdd().

Here is the caller graph for this function:

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

Definition at line 253 of file json_internalmap.inl.

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

Definition at line 227 of file json_internalmap.inl.

Referenced by clear(), and operator=().

Here is the caller graph for this function:

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


Friends And Related Function Documentation

friend class Value [friend]

Definition at line 667 of file value.h.

friend class ValueIteratorBase [friend]

Definition at line 666 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