summaryrefslogtreecommitdiff
path: root/XMPCommon/source/MemoryManagedObject.cpp
blob: 37a28355582b4c23148d797d2547b965f5c29a69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// =================================================================================================
// Copyright Adobe
// Copyright 2014 Adobe
// All Rights Reserved
//
// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms
// of the Adobe license agreement accompanying it. 
// =================================================================================================


#include "XMPCommon/BaseClasses/MemoryManagedObject.h"
#include "XMPCommon/Interfaces/IMemoryAllocator_I.h"

namespace XMP_COMPONENT_INT_NAMESPACE {

	void * MemoryManagedObject::operator new( std::size_t size ) {
		void * ptr = operator new ( size, std::nothrow_t() );
		if ( ptr )
			return ptr;
		throw std::bad_alloc();
	}

	void * MemoryManagedObject::operator new( std::size_t size, const std::nothrow_t & nothrow ) throw () {
		return IMemoryAllocator_I::GetMemoryAllocator()->allocate( size );
	}

	void * MemoryManagedObject::operator new( std::size_t size, void * ptr ) throw () {
		return ptr;
	}

	void * MemoryManagedObject::operator new[]( std::size_t size ) {
		return operator new( size );
	}

	void * MemoryManagedObject::operator new[]( std::size_t size, const std::nothrow_t & nothrow ) throw () {
		return operator new( size, nothrow );
	}

	void * MemoryManagedObject::operator new[]( std::size_t size, void * ptr ) throw () {
		return operator new( size, ptr );
	}

	void MemoryManagedObject::operator delete( void * ptr ) throw () {
		IMemoryAllocator_I::GetMemoryAllocator()->deallocate( ptr );
	}

	void MemoryManagedObject::operator delete( void * ptr, const std::nothrow_t & nothrow ) throw () {
		return operator delete( ptr );
	}

	void MemoryManagedObject::operator delete( void * ptr, void * voidptr2 ) throw () {
		return;
	}

	void MemoryManagedObject::operator delete[]( void * ptr ) throw () {
		return operator delete( ptr );
	}

	void MemoryManagedObject::operator delete[]( void * ptr, const std::nothrow_t & nothrow ) throw () {
		return operator delete( ptr, nothrow );
	}

	void MemoryManagedObject::operator delete[]( void * ptr, void * voidptr2 ) throw () {
		return operator delete( ptr, voidptr2 );
	}

}