OGRE
1.9.0
Main Page
Related Pages
Topics
Namespaces
Classes
Files
File List
File Members
OgreMain
include
OgreMemoryAllocatedObject.h
Go to the documentation of this file.
1
/*
2
-----------------------------------------------------------------------------
3
This source file is part of OGRE
4
(Object-oriented Graphics Rendering Engine)
5
For the latest info, see http://www.ogre3d.org/
6
7
Copyright (c) 2000-2014 Torus Knot Software Ltd
8
9
Permission is hereby granted, free of charge, to any person obtaining a copy
10
of this software and associated documentation files (the "Software"), to deal
11
in the Software without restriction, including without limitation the rights
12
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
copies of the Software, and to permit persons to whom the Software is
14
furnished to do so, subject to the following conditions:
15
16
The above copyright notice and this permission notice shall be included in
17
all copies or substantial portions of the Software.
18
19
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
THE SOFTWARE.
26
-----------------------------------------------------------------------------
27
*/
28
29
#ifndef __AllocatedObject_H__
30
#define __AllocatedObject_H__
31
32
#include "
OgrePrerequisites.h
"
33
#include "
OgreHeaderPrefix.h
"
34
35
// Anything that has done a #define new <blah> will screw operator new definitions up
36
// so undefine
37
#ifdef new
38
# undef new
39
#endif
40
#ifdef delete
41
# undef delete
42
#endif
43
44
namespace
Ogre
45
{
57
template
<
class
Alloc>
58
class
_OgreExport
AllocatedObject
59
{
60
public
:
61
explicit
AllocatedObject
()
62
{ }
63
64
~AllocatedObject
()
65
{ }
66
68
void
*
operator
new
(
size_t
sz,
const
char
* file,
int
line,
const
char
* func)
69
{
70
return
Alloc::allocateBytes(sz, file, line, func);
71
}
72
73
void
*
operator
new
(
size_t
sz)
74
{
75
return
Alloc::allocateBytes(sz);
76
}
77
79
void
*
operator
new
(
size_t
sz,
void
* ptr)
80
{
81
(void) sz;
82
return
ptr;
83
}
84
86
void
*
operator
new
[] (
size_t
sz,
const
char
* file,
int
line,
const
char
* func )
87
{
88
return
Alloc::allocateBytes(sz, file, line, func);
89
}
90
91
void
*
operator
new
[] (
size_t
sz )
92
{
93
return
Alloc::allocateBytes(sz);
94
}
95
96
void
operator
delete
(
void
* ptr )
97
{
98
Alloc::deallocateBytes(ptr);
99
}
100
101
// Corresponding operator for placement delete (second param same as the first)
102
void
operator
delete
(
void
* ptr,
void
* )
103
{
104
Alloc::deallocateBytes(ptr);
105
}
106
107
// only called if there is an exception in corresponding 'new'
108
void
operator
delete
(
void
* ptr,
const
char
* , int ,
const
char
* )
109
{
110
Alloc::deallocateBytes(ptr);
111
}
112
113
void
operator
delete
[] (
void
* ptr )
114
{
115
Alloc::deallocateBytes(ptr);
116
}
117
118
119
void
operator
delete
[] (
void
* ptr,
const
char
* , int ,
const
char
* )
120
{
121
Alloc::deallocateBytes(ptr);
122
}
123
};
124
125
128
129
}
130
131
#include "
OgreHeaderSuffix.h
"
132
133
#endif
OgreHeaderPrefix.h
OgreHeaderSuffix.h
_OgreExport
#define _OgreExport
Definition
OgrePlatform.h:260
OgrePrerequisites.h
Ogre::AllocatedObject::AllocatedObject
AllocatedObject()
Definition
OgreMemoryAllocatedObject.h:61
Ogre::AllocatedObject::~AllocatedObject
~AllocatedObject()
Definition
OgreMemoryAllocatedObject.h:64
Ogre
Definition
OgreAndroidLogListener.h:35
Generated on Sun Jun 1 2025 13:08:47 for OGRE by
1.13.2