XLE  v0.02.0
Classes | Public Member Functions | List of all members
Utility::BlockSerializerAllocator< Type > Class Template Reference

And STL allocator that will suppress deallocation when memory comes from a part of a larger heap block More...

#include <Serialization.h>

Inheritance diagram for Utility::BlockSerializerAllocator< Type >:
Inheritance graph
[legend]

Classes

struct  rebind
 

Public Member Functions

pointer allocate (size_type n, std::allocator< void >::const_pointer ptr=0)
 
void deallocate (pointer p, size_type n)
 
 BlockSerializerAllocator (unsigned fromFixedStorage)
 
 BlockSerializerAllocator (const std::allocator< Type > &copyFrom)
 
 BlockSerializerAllocator (std::allocator< Type > &&moveFrom)
 
 BlockSerializerAllocator (const BlockSerializerAllocator< Type > &copyFrom)
 
 BlockSerializerAllocator (BlockSerializerAllocator< Type > &&moveFrom)
 

Detailed Description

template<typename Type>
class Utility::BlockSerializerAllocator< Type >

And STL allocator that will suppress deallocation when memory comes from a part of a larger heap block

When we serialize an object in via the block serializer, we can loading it into a single heap block. However, objects loaded new can have STL containers and objects (like vectors and strings). In this case, the memory used by the container is a just a part of the larger heap block. When the container is destroyed, it will attempt to free it's memory. In the of a normal container, the memory is it's own unique heap block, and the normal deallocation functions can be used. But for our serialized containers, the memory is not a unique heap block. It is just a internal part of much larger block. In this case, we must suppress the deallocation. The BlockSerializerAllocator does exactly that. For vectors and containers that have been serialized in, we suppress the deallocation step.


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