Mako 8.2.0 API
MakoCore SDK API Documentation
Loading...
Searching...
No Matches
edlallocator.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2007 Global Graphics Software Ltd. All rights reserved.
3 */
4
5/*
6* edlallocator.h
7*
8* A memory allocator, similar to the STL Allocator.
9*
10* Useful for defining who has ownership of memory allocation and deallocation.
11* This is primarily for the windows platform, to handle conflicts between execution and DLL memory spaces.
12*
13*/
14
15#ifndef EDLALLOCATOR_H
16#define EDLALLOCATOR_H
17
18#include <stdlib.h>
19#include <edl/edltypes.h>
20#include <edl/edlnamespaces.h>
21
23
25{
26public:
27
28 typedef void *(*AllocatorFn)(size_t n);
29 typedef void (*DeallocatorFn)(void *p);
30 typedef void *(*ReallocateFn)(void *p, size_t newSize);
31
33
34 virtual ~EDLAllocator()
35 {}
36
37 EDLAllocator(AllocatorFn allocator, DeallocatorFn deallocator, ReallocateFn reallocator)
38 {
39 m_allocator = allocator;
40 m_deallocator = deallocator;
41 m_reallocator = reallocator;
42 }
43
44 void *allocate(size_t size) { return m_allocator(size); }
45 void deallocate(void *p) { m_deallocator(p); }
46 void *reallocate(void *p, size_t newSize) { return m_reallocator(p, newSize); }
47
48private:
49
50 AllocatorFn m_allocator;
51 DeallocatorFn m_deallocator;
52 ReallocateFn m_reallocator;
53};
54
55
57
58#endif /* EDLALLOCATOR */
59
void * reallocate(void *p, size_t newSize)
Definition edlallocator.h:46
void * allocate(size_t size)
Definition edlallocator.h:44
void *(* AllocatorFn)(size_t n)
Definition edlallocator.h:28
EDLAllocator(AllocatorFn allocator, DeallocatorFn deallocator, ReallocateFn reallocator)
Definition edlallocator.h:37
void *(* ReallocateFn)(void *p, size_t newSize)
Definition edlallocator.h:30
void(* DeallocatorFn)(void *p)
Definition edlallocator.h:29
virtual ~EDLAllocator()
Definition edlallocator.h:34
void deallocate(void *p)
Definition edlallocator.h:45
EDL C++ namespace(s)
#define _BEGIN_EDL_NAMESPACE
Definition edlnamespaces.h:75
#define _END_EDL_NAMESPACE
Definition edlnamespaces.h:76
EDL "standard" types including known bit-length signed and unsigned integer type[def]s and definition...
#define EDL_API
Definition edltypes.h:86