JsonCpp project page JsonCpp home page

Json::ValueMapAllocator Class Reference

Allocator to customize Value internal map. More...

#include <json/value.h>

Inherited by Json::DefaultValueMapAllocator.

List of all members.

Public Member Functions

virtual ~ValueMapAllocator ()
virtual ValueInternalMapnewMap ()=0
virtual ValueInternalMapnewMapCopy (const ValueInternalMap &other)=0
virtual void destructMap (ValueInternalMap *map)=0
virtual ValueInternalLinkallocateMapBuckets (unsigned int size)=0
virtual void releaseMapBuckets (ValueInternalLink *links)=0
virtual ValueInternalLinkallocateMapLink ()=0
virtual void releaseMapLink (ValueInternalLink *link)=0


Detailed Description

Allocator to customize Value internal map.

Below is an example of a simple implementation (default implementation actually use memory pool for speed).

      class DefaultValueMapAllocator : public ValueMapAllocator
      {
      public: // overridden from ValueMapAllocator
         virtual ValueInternalMap *newMap()
         {
            return new ValueInternalMap();
         }

         virtual ValueInternalMap *newMapCopy( const ValueInternalMap &other )
         {
            return new ValueInternalMap( other );
         }

         virtual void destructMap( ValueInternalMap *map )
         {
            delete map;
         }

         virtual ValueInternalLink *allocateMapBuckets( unsigned int size )
         {
            return new ValueInternalLink[size];
         }

         virtual void releaseMapBuckets( ValueInternalLink *links )
         {
            delete [] links;
         }

         virtual ValueInternalLink *allocateMapLink()
         {
            return new ValueInternalLink();
         }

         virtual void releaseMapLink( ValueInternalLink *link )
         {
            delete link;
         }
      };

Definition at line 616 of file value.h.


Constructor & Destructor Documentation

Json::ValueMapAllocator::~ValueMapAllocator (  )  [virtual]

Definition at line 43 of file json_internalmap.inl.


Member Function Documentation

virtual ValueInternalLink* Json::ValueMapAllocator::allocateMapBuckets ( unsigned int  size  )  [pure virtual]

Referenced by Json::ValueInternalMap::reserve().

Here is the caller graph for this function:

virtual ValueInternalLink* Json::ValueMapAllocator::allocateMapLink (  )  [pure virtual]

Referenced by Json::ValueInternalMap::unsafeAdd().

Here is the caller graph for this function:

virtual void Json::ValueMapAllocator::destructMap ( ValueInternalMap map  )  [pure virtual]

Referenced by Json::Value::~Value().

Here is the caller graph for this function:

virtual ValueInternalMap* Json::ValueMapAllocator::newMap (  )  [pure virtual]

Referenced by Json::Value::Value().

Here is the caller graph for this function:

virtual ValueInternalMap* Json::ValueMapAllocator::newMapCopy ( const ValueInternalMap other  )  [pure virtual]

Referenced by Json::Value::Value().

Here is the caller graph for this function:

virtual void Json::ValueMapAllocator::releaseMapBuckets ( ValueInternalLink links  )  [pure virtual]

Referenced by Json::ValueInternalMap::~ValueInternalMap().

Here is the caller graph for this function:

virtual void Json::ValueMapAllocator::releaseMapLink ( ValueInternalLink link  )  [pure virtual]

Referenced by Json::ValueInternalMap::doActualRemove(), and Json::ValueInternalMap::~ValueInternalMap().

Here is the caller graph for this function:


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

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