JsonCpp project page JsonCpp home page

Public Member Functions | List of all members
Json::ValueMapAllocator Class Referenceabstract

Allocator to customize Value internal map. More...

#include <json/value.h>

+ Collaboration diagram for Json::ValueMapAllocator:

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;
}
};
virtual ValueInternalLink * allocateMapBuckets(unsigned int size)=0
virtual ValueInternalMap * newMapCopy(const ValueInternalMap &other)=0
virtual void releaseMapBuckets(ValueInternalLink *links)=0
virtual void releaseMapLink(ValueInternalLink *link)=0
virtual ValueInternalMap * newMap()=0
virtual void destructMap(ValueInternalMap *map)=0
virtual ValueInternalLink * allocateMapLink()=0

Definition at line 582 of file value.h.

Constructor & Destructor Documentation

◆ ~ValueMapAllocator()

ValueMapAllocator::~ValueMapAllocator ( )
virtual

Definition at line 37 of file json_internalmap.inl.

Member Function Documentation

◆ allocateMapBuckets()

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

◆ allocateMapLink()

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

◆ destructMap()

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

◆ newMap()

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

◆ newMapCopy()

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

◆ releaseMapBuckets()

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

◆ releaseMapLink()

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

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

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