Arcane  v3.16.8.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
Référence du modèle de la classe MemoryPoolAllocator< BaseAllocator >

Default memory allocator used by the parser and DOM. Plus de détails...

#include <arcane/utils/internal/json/rapidjson/allocators.h>

+ Graphe de collaboration de MemoryPoolAllocator< BaseAllocator >:

Classes

struct  ChunkHeader
 Chunk header for perpending to each chunk. Plus de détails...
 
struct  SharedData
 

Fonctions membres publiques

 MemoryPoolAllocator (size_t chunkSize=kDefaultChunkCapacity, BaseAllocator *baseAllocator=0)
 Constructor with chunkSize.
 
 MemoryPoolAllocator (void *buffer, size_t size, size_t chunkSize=kDefaultChunkCapacity, BaseAllocator *baseAllocator=0)
 Constructor with user-supplied buffer.
 
 MemoryPoolAllocator (const MemoryPoolAllocator &rhs) RAPIDJSON_NOEXCEPT
 
MemoryPoolAllocatoroperator= (const MemoryPoolAllocator &rhs) RAPIDJSON_NOEXCEPT
 
 ~MemoryPoolAllocator () RAPIDJSON_NOEXCEPT
 Destructor.
 
void Clear () RAPIDJSON_NOEXCEPT
 Deallocates all memory chunks, excluding the first/user one.
 
size_t Capacity () const RAPIDJSON_NOEXCEPT
 Computes the total capacity of allocated memory chunks.
 
size_t Size () const RAPIDJSON_NOEXCEPT
 Computes the memory blocks allocated.
 
bool Shared () const RAPIDJSON_NOEXCEPT
 Whether the allocator is shared.
 
void * Malloc (size_t size)
 Allocates a memory block. (concept Allocator)
 
void * Realloc (void *originalPtr, size_t originalSize, size_t newSize)
 Resizes a memory block (concept Allocator)
 
bool operator== (const MemoryPoolAllocator &rhs) const RAPIDJSON_NOEXCEPT
 Compare (equality) with another MemoryPoolAllocator.
 
bool operator!= (const MemoryPoolAllocator &rhs) const RAPIDJSON_NOEXCEPT
 Compare (inequality) with another MemoryPoolAllocator.
 

Fonctions membres publiques statiques

static void Free (void *ptr) RAPIDJSON_NOEXCEPT
 Frees a memory block (concept Allocator)
 

Attributs publics statiques

static const bool kNeedFree = false
 Tell users that no need to call Free() with this allocator. (concept Allocator)
 
static const bool kRefCounted = true
 Tell users that this allocator is reference counted on copy.
 

Fonctions membres privées

bool AddChunk (size_t capacity)
 Creates a new chunk.
 

Fonctions membres privées statiques

static ChunkHeaderGetChunkHead (SharedData *shared)
 
static uint8_t * GetChunkBuffer (SharedData *shared)
 
static void * AlignBuffer (void *buf, size_t &size)
 

Attributs privés

size_t chunk_capacity_
 The minimum capacity of chunk when they are allocated.
 
BaseAllocator * baseAllocator_
 base allocator for allocating memory chunks.
 
SharedDatashared_
 The shared data of the allocator.
 

Attributs privés statiques

static const size_t SIZEOF_SHARED_DATA = RAPIDJSON_ALIGN(sizeof(SharedData))
 
static const size_t SIZEOF_CHUNK_HEADER = RAPIDJSON_ALIGN(sizeof(ChunkHeader))
 
static const size_t kDefaultChunkCapacity = RAPIDJSON_ALLOCATOR_DEFAULT_CHUNK_CAPACITY
 Default chunk capacity.
 

Description détaillée

template<typename BaseAllocator = CrtAllocator>
class MemoryPoolAllocator< BaseAllocator >

Default memory allocator used by the parser and DOM.

This allocator allocate memory blocks from pre-allocated memory chunks.

It does not free memory blocks. And Realloc() only allocate new memory.

The memory chunks are allocated by BaseAllocator, which is CrtAllocator by default.

User may also supply a buffer as the first chunk.

If the user-buffer is full then additional chunks are allocated by BaseAllocator.

The user-buffer is not deallocated by this allocator.

Paramètres du template
BaseAllocatorthe allocator type for allocating memory chunks. Default is CrtAllocator.
Note
implements Allocator concept

Définition à la ligne 131 du fichier allocators.h.

Documentation des constructeurs et destructeur

◆ MemoryPoolAllocator() [1/3]

template<typename BaseAllocator = CrtAllocator>
MemoryPoolAllocator< BaseAllocator >::MemoryPoolAllocator ( size_t chunkSize = kDefaultChunkCapacity,
BaseAllocator * baseAllocator = 0 )
inlineexplicit

Constructor with chunkSize.

Paramètres
chunkSizeThe size of memory chunk. The default is kDefaultChunkSize.
baseAllocatorThe allocator for allocating memory chunks.

Définition à la ligne 171 du fichier allocators.h.

Références baseAllocator_, chunk_capacity_, kDefaultChunkCapacity, Malloc(), RAPIDJSON_ASSERT, RAPIDJSON_NEW, et shared_.

Référencé par operator!=(), et operator==().

+ Voici le graphe d'appel pour cette fonction :
+ Voici le graphe des appelants de cette fonction :

◆ MemoryPoolAllocator() [2/3]

template<typename BaseAllocator = CrtAllocator>
MemoryPoolAllocator< BaseAllocator >::MemoryPoolAllocator ( void * buffer,
size_t size,
size_t chunkSize = kDefaultChunkCapacity,
BaseAllocator * baseAllocator = 0 )
inline

Constructor with user-supplied buffer.

The user buffer will be used firstly. When it is full, memory pool allocates new chunk with chunk size.

The user buffer will not be deallocated when this allocator is destructed.

Paramètres
bufferUser supplied buffer.
sizeSize of the buffer in bytes. It must at least larger than sizeof(ChunkHeader).
chunkSizeThe size of memory chunk. The default is kDefaultChunkSize.
baseAllocatorThe allocator for allocating memory chunks.

Définition à la ligne 202 du fichier allocators.h.

Références baseAllocator_, chunk_capacity_, kDefaultChunkCapacity, RAPIDJSON_ASSERT, et shared_.

◆ MemoryPoolAllocator() [3/3]

template<typename BaseAllocator = CrtAllocator>
MemoryPoolAllocator< BaseAllocator >::MemoryPoolAllocator ( const MemoryPoolAllocator< BaseAllocator > & rhs)
inline

Définition à la ligne 217 du fichier allocators.h.

◆ ~MemoryPoolAllocator()

template<typename BaseAllocator = CrtAllocator>
MemoryPoolAllocator< BaseAllocator >::~MemoryPoolAllocator ( )
inline

Destructor.

This deallocates all memory chunks, excluding the user-supplied buffer.

Définition à la ligne 260 du fichier allocators.h.

Références baseAllocator_, Clear(), RAPIDJSON_DELETE, et shared_.

+ Voici le graphe d'appel pour cette fonction :

Documentation des fonctions membres

◆ AddChunk()

template<typename BaseAllocator = CrtAllocator>
bool MemoryPoolAllocator< BaseAllocator >::AddChunk ( size_t capacity)
inlineprivate

Creates a new chunk.

Paramètres
capacityCapacity of the chunk in bytes.
Renvoie
true if success.

Définition à la ligne 391 du fichier allocators.h.

Références baseAllocator_, RAPIDJSON_NEW, et shared_.

Référencé par Malloc().

+ Voici le graphe des appelants de cette fonction :

◆ AlignBuffer()

template<typename BaseAllocator = CrtAllocator>
static void * MemoryPoolAllocator< BaseAllocator >::AlignBuffer ( void * buf,
size_t & size )
inlinestaticprivate

Définition à la ligne 405 du fichier allocators.h.

◆ Capacity()

template<typename BaseAllocator = CrtAllocator>
size_t MemoryPoolAllocator< BaseAllocator >::Capacity ( ) const
inline

Computes the total capacity of allocated memory chunks.

Renvoie
total capacity in bytes.

Définition à la ligne 294 du fichier allocators.h.

Références RAPIDJSON_NOEXCEPT_ASSERT, et shared_.

◆ Clear()

template<typename BaseAllocator = CrtAllocator>
void MemoryPoolAllocator< BaseAllocator >::Clear ( )
inline

Deallocates all memory chunks, excluding the first/user one.

Définition à la ligne 278 du fichier allocators.h.

Références baseAllocator_, MemoryPoolAllocator< BaseAllocator >::ChunkHeader::next, RAPIDJSON_NOEXCEPT_ASSERT, et shared_.

Référencé par ~MemoryPoolAllocator().

+ Voici le graphe des appelants de cette fonction :

◆ Free()

template<typename BaseAllocator = CrtAllocator>
static void MemoryPoolAllocator< BaseAllocator >::Free ( void * ptr)
inlinestatic

Frees a memory block (concept Allocator)

Définition à la ligne 373 du fichier allocators.h.

◆ GetChunkBuffer()

template<typename BaseAllocator = CrtAllocator>
static uint8_t * MemoryPoolAllocator< BaseAllocator >::GetChunkBuffer ( SharedData * shared)
inlinestaticprivate

Définition à la ligne 155 du fichier allocators.h.

◆ GetChunkHead()

template<typename BaseAllocator = CrtAllocator>
static ChunkHeader * MemoryPoolAllocator< BaseAllocator >::GetChunkHead ( SharedData * shared)
inlinestaticprivate

Définition à la ligne 151 du fichier allocators.h.

◆ Malloc()

template<typename BaseAllocator = CrtAllocator>
void * MemoryPoolAllocator< BaseAllocator >::Malloc ( size_t size)
inline

Allocates a memory block. (concept Allocator)

Définition à la ligne 322 du fichier allocators.h.

Références AddChunk(), chunk_capacity_, RAPIDJSON_ALIGN, RAPIDJSON_NOEXCEPT_ASSERT, RAPIDJSON_UNLIKELY, et shared_.

Référencé par MemoryPoolAllocator(), et Realloc().

+ Voici le graphe d'appel pour cette fonction :
+ Voici le graphe des appelants de cette fonction :

◆ operator!=()

template<typename BaseAllocator = CrtAllocator>
bool MemoryPoolAllocator< BaseAllocator >::operator!= ( const MemoryPoolAllocator< BaseAllocator > & rhs) const
inline

Compare (inequality) with another MemoryPoolAllocator.

Définition à la ligne 382 du fichier allocators.h.

Références MemoryPoolAllocator(), et operator==().

+ Voici le graphe d'appel pour cette fonction :

◆ operator=()

template<typename BaseAllocator = CrtAllocator>
MemoryPoolAllocator & MemoryPoolAllocator< BaseAllocator >::operator= ( const MemoryPoolAllocator< BaseAllocator > & rhs)
inline

Définition à la ligne 225 du fichier allocators.h.

◆ operator==()

template<typename BaseAllocator = CrtAllocator>
bool MemoryPoolAllocator< BaseAllocator >::operator== ( const MemoryPoolAllocator< BaseAllocator > & rhs) const
inline

Compare (equality) with another MemoryPoolAllocator.

Définition à la ligne 376 du fichier allocators.h.

Références MemoryPoolAllocator(), RAPIDJSON_NOEXCEPT_ASSERT, et shared_.

Référencé par operator!=().

+ Voici le graphe d'appel pour cette fonction :
+ Voici le graphe des appelants de cette fonction :

◆ Realloc()

template<typename BaseAllocator = CrtAllocator>
void * MemoryPoolAllocator< BaseAllocator >::Realloc ( void * originalPtr,
size_t originalSize,
size_t newSize )
inline

Resizes a memory block (concept Allocator)

Définition à la ligne 338 du fichier allocators.h.

Références Malloc(), RAPIDJSON_ALIGN, RAPIDJSON_NOEXCEPT_ASSERT, et shared_.

+ Voici le graphe d'appel pour cette fonction :

◆ Shared()

template<typename BaseAllocator = CrtAllocator>
bool MemoryPoolAllocator< BaseAllocator >::Shared ( ) const
inline

Whether the allocator is shared.

Renvoie
true or false.

Définition à la ligne 316 du fichier allocators.h.

Références RAPIDJSON_NOEXCEPT_ASSERT, et shared_.

◆ Size()

template<typename BaseAllocator = CrtAllocator>
size_t MemoryPoolAllocator< BaseAllocator >::Size ( ) const
inline

Computes the memory blocks allocated.

Renvoie
total used bytes.

Définition à la ligne 305 du fichier allocators.h.

Références RAPIDJSON_NOEXCEPT_ASSERT, et shared_.

Documentation des données membres

◆ baseAllocator_

template<typename BaseAllocator = CrtAllocator>
BaseAllocator* MemoryPoolAllocator< BaseAllocator >::baseAllocator_
private

base allocator for allocating memory chunks.

Définition à la ligne 420 du fichier allocators.h.

Référencé par AddChunk(), Clear(), MemoryPoolAllocator(), MemoryPoolAllocator(), et ~MemoryPoolAllocator().

◆ chunk_capacity_

template<typename BaseAllocator = CrtAllocator>
size_t MemoryPoolAllocator< BaseAllocator >::chunk_capacity_
private

The minimum capacity of chunk when they are allocated.

Définition à la ligne 419 du fichier allocators.h.

Référencé par Malloc(), MemoryPoolAllocator(), et MemoryPoolAllocator().

◆ kDefaultChunkCapacity

template<typename BaseAllocator = CrtAllocator>
const size_t MemoryPoolAllocator< BaseAllocator >::kDefaultChunkCapacity = RAPIDJSON_ALLOCATOR_DEFAULT_CHUNK_CAPACITY
staticprivate

Default chunk capacity.

Définition à la ligne 160 du fichier allocators.h.

Référencé par MemoryPoolAllocator(), et MemoryPoolAllocator().

◆ kNeedFree

template<typename BaseAllocator = CrtAllocator>
const bool MemoryPoolAllocator< BaseAllocator >::kNeedFree = false
static

Tell users that no need to call Free() with this allocator. (concept Allocator)

Définition à la ligne 163 du fichier allocators.h.

◆ kRefCounted

template<typename BaseAllocator = CrtAllocator>
const bool MemoryPoolAllocator< BaseAllocator >::kRefCounted = true
static

Tell users that this allocator is reference counted on copy.

Définition à la ligne 164 du fichier allocators.h.

◆ shared_

template<typename BaseAllocator = CrtAllocator>
SharedData* MemoryPoolAllocator< BaseAllocator >::shared_
private

The shared data of the allocator.

Définition à la ligne 421 du fichier allocators.h.

Référencé par AddChunk(), Capacity(), Clear(), Malloc(), MemoryPoolAllocator(), MemoryPoolAllocator(), operator==(), Realloc(), Shared(), Size(), et ~MemoryPoolAllocator().

◆ SIZEOF_CHUNK_HEADER

template<typename BaseAllocator = CrtAllocator>
const size_t MemoryPoolAllocator< BaseAllocator >::SIZEOF_CHUNK_HEADER = RAPIDJSON_ALIGN(sizeof(ChunkHeader))
staticprivate

Définition à la ligne 149 du fichier allocators.h.

◆ SIZEOF_SHARED_DATA

template<typename BaseAllocator = CrtAllocator>
const size_t MemoryPoolAllocator< BaseAllocator >::SIZEOF_SHARED_DATA = RAPIDJSON_ALIGN(sizeof(SharedData))
staticprivate

Définition à la ligne 148 du fichier allocators.h.


La documentation de cette classe a été générée à partir du fichier suivant :