~hikiko/nux/arb-srgba-shader

« back to all changes in this revision

Viewing changes to NuxCore/Memory/NMemoryHook.cpp

  • Committer: Neil Jagdish Patel
  • Date: 2010-09-01 19:25:37 UTC
  • Revision ID: neil.patel@canonical.com-20100901192537-mfz7rm6q262pewg6
Import and build NuxCore

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "../NKernel.h"
 
2
 
 
3
#include "NMemoryHook.h"
 
4
 
 
5
NAMESPACE_BEGIN
 
6
 
 
7
INL_IMPLEMENT_GLOBAL_OBJECT(MemHook)
 
8
 
 
9
// Singleton constructor 
 
10
void MemHook::Constructor()
 
11
{
 
12
    // The first hook will point to our default hook...
 
13
    m_pRootHook = &m_DefaultHook;
 
14
}
 
15
 
 
16
// Singleton destructor 
 
17
void MemHook::Destructor()
 
18
{
 
19
    // Check if all object that has hooked unregistered like they should...
 
20
    nuxAssert(m_pRootHook == &m_DefaultHook);
 
21
}       
 
22
 
 
23
void MemoryHook::Hook()
 
24
{
 
25
    // Register 
 
26
    m_pNextHook = INL_GLOBAL_OBJECT_INSTANCE(MemHook).Hook(this);
 
27
}
 
28
 
 
29
void MemoryHook::UnHook()
 
30
{
 
31
    // Unregister 
 
32
    INL_GLOBAL_OBJECT_INSTANCE(MemHook).UnHook(this, m_pNextHook);
 
33
    m_pNextHook = 0;
 
34
}
 
35
 
 
36
NAMESPACE_END
 
37