JsonCpp project page | JsonCpp home page |
#include <json/value.h>
Collaboration diagram for Json::ValueInternalMap:
Public Types | |
typedef unsigned int | HashKey |
typedef unsigned int | BucketIndex |
Public Member Functions | |
ValueInternalMap () | |
ValueInternalMap (const ValueInternalMap &other) | |
ValueInternalMap & | operator= (const ValueInternalMap &other) |
~ValueInternalMap () | |
void | swap (ValueInternalMap &other) |
BucketIndex | size () const |
void | clear () |
bool | reserveDelta (BucketIndex growth) |
bool | reserve (BucketIndex newItemCount) |
const Value * | find (const char *key) const |
Value * | find (const char *key) |
Value & | resolveReference (const char *key, bool isStatic) |
void | remove (const char *key) |
void | doActualRemove (ValueInternalLink *link, BucketIndex index, BucketIndex bucketIndex) |
ValueInternalLink *& | getLastLinkInBucket (BucketIndex bucketIndex) |
Value & | setNewItem (const char *key, bool isStatic, ValueInternalLink *link, BucketIndex index) |
Value & | unsafeAdd (const char *key, bool isStatic, HashKey hashedKey) |
HashKey | hash (const char *key) const |
int | compare (const ValueInternalMap &other) const |
Friends | |
class | ValueIteratorBase |
class | 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.
typedef unsigned int Json::ValueInternalMap::BucketIndex |
typedef unsigned int Json::ValueInternalMap::HashKey |
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 itemCount_, makeBeginIterator(), makeEndIterator(), reserve(), and resolveReference().
Json::ValueInternalMap::~ValueInternalMap | ( | ) |
Definition at line 207 of file json_internalmap.inl.
References Json::mapAllocator(), Json::ValueInternalLink::next_, Json::ValueMapAllocator::releaseMapBuckets(), and Json::ValueMapAllocator::releaseMapLink().
void Json::ValueInternalMap::clear | ( | ) |
int Json::ValueInternalMap::compare | ( | const ValueInternalMap & | other | ) | const |
Definition at line 471 of file json_internalmap.inl.
References Json::Value::compare(), find(), and itemCount_.
void Json::ValueInternalMap::doActualRemove | ( | ValueInternalLink * | link, | |
BucketIndex | index, | |||
BucketIndex | bucketIndex | |||
) |
Definition at line 364 of file json_internalmap.inl.
References getLastLinkInBucket(), Json::Value::isItemAvailable(), Json::ValueInternalLink::itemPerLink, Json::ValueInternalLink::items_, Json::mapAllocator(), Json::ValueInternalLink::next_, Json::ValueInternalLink::previous_, Json::ValueMapAllocator::releaseMapLink(), and Json::Value::swap().
Referenced by remove().
Here is the caller graph for this function:
Value * Json::ValueInternalMap::find | ( | const char * | key | ) |
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 | ) |
void Json::ValueInternalMap::remove | ( | const char * | key | ) |
Definition at line 339 of file json_internalmap.inl.
References doActualRemove(), hash(), Json::ValueInternalLink::itemPerLink, and Json::ValueInternalLink::next_.
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_, Json::ValueInternalLink::keys_, Json::Value::setItemUsed(), and Json::Value::setMemberNameIsStatic().
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.
References buckets_, bucketsSize_, itemCount_, and tailLink_.
Referenced by clear(), and operator=().
Here is the caller graph for this function:
Definition at line 434 of file json_internalmap.inl.
References Json::ValueMapAllocator::allocateMapLink(), getLastLinkInBucket(), Json::Value::isItemAvailable(), Json::ValueInternalLink::itemPerLink, Json::ValueInternalLink::items_, JSON_ASSERT_MESSAGE, Json::mapAllocator(), Json::ValueInternalLink::next_, and setNewItem().
Referenced by resolveReference().
Here is the caller graph for this function:
friend class ValueIteratorBase [friend] |
|
hosts this site. |
Send comments to: Json-cpp Developers |