/** SGX

The   sss    gggg x   x   
     s      g      x x    Engine
      sss   g  gg   x
         s  g   g  x x          Copyright 1995-2009.
     ssss    gggg x   x         Steven Goodwin. All Rights Reserved.
    
This version has been released under the GNU Public License v2.0.

Please see the license files for details.

File: sgx/include/sgx/core/helpers/memwatch.hpp

*/

#ifndef SGX_CORE_HELPERS_MEMWATCH_HPP
#define SGX_CORE_HELPERS_MEMWATCH_HPP	1
	
#if defined(SGX_DEBUG) || defined(SGX_FORCE_MEMORY_HELPERS)

// Initialisation of individual memory blocks
void sgxRegisterMemoryBlock(void *ptr, tMEM_SIZE size);

// Validation
void sgxCheckCheckSums();
void sgxCheckForOverwrites(void *ptr, tMEM_SIZE size);

template <typename T>
void sgxRegisterMemoryBlock(const T &var)
{
    sgxRegisterMemoryBlock((void *)&var, sizeof(T));
}

#else	// SGX_RELEASE

  #define	sgxRegisterMemoryBlock(p,s)	p;s
  #define	sgxCheckCheckSums	   
  #define	sgxCheckForOverwrites(p,s)	p;s

#endif

#endif /* SGX_CORE_HELPERS_MEMWATCH_HPP */
