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>

Inherited by Json::DefaultValueMapAllocator.

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
virtual ValueInternalLink* Json::ValueMapAllocator::allocateMapLink ( )
pure virtual
virtual void Json::ValueMapAllocator::destructMap ( ValueInternalMap map)
pure virtual

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

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

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

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

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

virtual void Json::ValueMapAllocator::releaseMapBuckets ( ValueInternalLink links)
pure virtual
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