A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/allocators_8h_source.html below:

NCBI C++ ToolKit: include/misc/jsonwrapp/rapidjson11/allocators.h Source File

15 #ifndef RAPIDJSON_ALLOCATORS_H_ 16 #define RAPIDJSON_ALLOCATORS_H_ 64  static const bool

kNeedFree =

true

;

71  void

*

Realloc

(

void

* originalPtr,

size_t

originalSize,

size_t

newSize) {

77  return

std::realloc(originalPtr, newSize);

101 template

<

typename

BaseAllocator = CrtAllocator>

104  static const bool

kNeedFree =

false

;

111

chunkHead_(0), chunk_capacity_(chunkSize), userBuffer_(0), baseAllocator_(baseAllocator), ownBaseAllocator_(0)

126

chunkHead_(0), chunk_capacity_(chunkSize), userBuffer_(

buffer

), baseAllocator_(baseAllocator), ownBaseAllocator_(0)

132

chunkHead_->size = 0;

133

chunkHead_->next = 0;

146  while

(chunkHead_ && chunkHead_ != userBuffer_) {

148

baseAllocator_->Free(chunkHead_);

151  if

(chunkHead_ && chunkHead_ == userBuffer_)

152

chunkHead_->size = 0;

161

capacity += c->capacity;

181  if

(chunkHead_ == 0 || chunkHead_->size +

size

> chunkHead_->capacity)

182  if

(!AddChunk(chunk_capacity_ >

size

? chunk_capacity_ :

size

))

186

chunkHead_->size +=

size

;

191  void

*

Realloc

(

void

* originalPtr,

size_t

originalSize,

size_t

newSize) {

192  if

(originalPtr == 0)

202  if

(originalSize >= newSize)

206  if

(originalPtr ==

reinterpret_cast<char

*

>

(chunkHead_) +

RAPIDJSON_ALIGN

(

sizeof

(

ChunkHeader

)) + chunkHead_->size - originalSize) {

207  size_t

increment =

static_cast<size_t>

(newSize - originalSize);

208  if

(chunkHead_->size + increment <= chunkHead_->capacity) {

209

chunkHead_->size += increment;

215  if

(

void

* newBuffer =

Malloc

(newSize)) {

217

std::memcpy(newBuffer, originalPtr, originalSize);

225  static void Free

(

void

*ptr) { (void)ptr; }

239

ownBaseAllocator_ = baseAllocator_ =

RAPIDJSON_NEW

(BaseAllocator)();

241

chunk->capacity = capacity;

243

chunk->next = chunkHead_;

251  static const int

kDefaultChunkCapacity = 64 * 1024;

C-runtime library allocator.

void * Realloc(void *originalPtr, size_t originalSize, size_t newSize)

void * Malloc(size_t size)

static void Free(void *ptr)

Default memory allocator used by the parser and DOM.

void * Malloc(size_t size)

Allocates a memory block. (concept Allocator)

void * userBuffer_

User supplied buffer.

MemoryPoolAllocator(size_t chunkSize=kDefaultChunkCapacity, BaseAllocator *baseAllocator=0)

Constructor with chunkSize.

size_t chunk_capacity_

The minimum capacity of chunk when they are allocated.

ChunkHeader * chunkHead_

Head of the chunk linked-list. Only the head chunk serves allocation.

MemoryPoolAllocator(const MemoryPoolAllocator &rhs)

Copy constructor is not permitted.

void * Realloc(void *originalPtr, size_t originalSize, size_t newSize)

Resizes a memory block (concept Allocator)

static void Free(void *ptr)

Frees a memory block (concept Allocator)

void Clear()

Deallocates all memory chunks, excluding the user-supplied buffer.

MemoryPoolAllocator & operator=(const MemoryPoolAllocator &rhs)

Copy assignment operator is not permitted.

size_t Size() const

Computes the memory blocks allocated.

~MemoryPoolAllocator()

Destructor.

bool AddChunk(size_t capacity)

Creates a new chunk.

MemoryPoolAllocator(void *buffer, size_t size, size_t chunkSize=kDefaultChunkCapacity, BaseAllocator *baseAllocator=0)

Constructor with user-supplied buffer.

size_t Capacity() const

Computes the total capacity of allocated memory chunks.

BaseAllocator * baseAllocator_

base allocator for allocating memory chunks.

BaseAllocator * ownBaseAllocator_

base allocator created by this object.

static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)

#define RAPIDJSON_ALIGN(x)

Data alignment of the machine.

#define RAPIDJSON_ASSERT(x)

Assertion.

#define RAPIDJSON_NAMESPACE_BEGIN

provide custom rapidjson namespace (opening expression)

#define RAPIDJSON_NAMESPACE_END

provide custom rapidjson namespace (closing expression)

const struct ncbi::grid::netcache::search::fields::SIZE size

common definitions and configuration

#define RAPIDJSON_DELETE(x)

! customization point for global delete

#define RAPIDJSON_NEW(TypeName)

! customization point for global new


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4