Kinetis Bootloader Host  2.0.0
Host Tools for Kinetis devices
Json::ValueMapAllocator Class Referenceabstract

Allocator to customize Value internal map. Below is an example of a simple implementation (default implementation actually use memory pool for speed). More...

#include <json.h>

Public Member Functions

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;
}
};

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