Crazy Eddie's GUI System 0.8.7
MemoryStdAllocator.h
1/***********************************************************************
2 created: 14/10/2010
3 author: Martin Preisler
4
5 purpose: Implements the default "dummy" allocator
6*************************************************************************/
7/***************************************************************************
8 * Copyright (C) 2004 - 2010 Paul D Turner & The CEGUI Development Team
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining
11 * a copy of this software and associated documentation files (the
12 * "Software"), to deal in the Software without restriction, including
13 * without limitation the rights to use, copy, modify, merge, publish,
14 * distribute, sublicense, and/or sell copies of the Software, and to
15 * permit persons to whom the Software is furnished to do so, subject to
16 * the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be
19 * included in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 * OTHER DEALINGS IN THE SOFTWARE.
28 ***************************************************************************/
29#ifndef _CEGUIMemoryStdAllocator_h_
30#define _CEGUIMemoryStdAllocator_h_
31
32#include <stdlib.h>
33#include <limits>
34
35namespace CEGUI
36{
37
38class CEGUIEXPORT StdAllocator
39{
40public:
41 static inline void* allocateBytes(size_t count)
42 {
43 return malloc(count);
44 }
45
46 static inline void deallocateBytes(void* ptr)
47 {
48 free(ptr);
49 }
50
51 // !!! IF YOU GET AN ERROR HERE:
52 // that says something like: "You can't call allocateBytes with 4 arguments",
53 // you are using StdAllocator and trying to enable CEGUI_CUSTOM_ALLOCATORS_DEBUG, you
54 // have to provide your own custom memory allocator if you want memory debugging.
55
57 static inline size_t getMaxAllocationSize()
58 {
59 return std::numeric_limits<size_t>::max();
60 }
61};
62
63CEGUI_SET_DEFAULT_ALLOCATOR(StdAllocator)
64
65}
66
67#endif // end of guard _CEGUIMemoryStdAllocator_h_
Definition: MemoryStdAllocator.h:39
static size_t getMaxAllocationSize()
Get the maximum size of a single allocation.
Definition: MemoryStdAllocator.h:57
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1