Lugdunum  0.1.0
BoundsChecker.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <cstring>
4 #include <lug/System/Export.hpp>
5 #include <lug/System/Debug.hpp>
6 
7 namespace lug {
8 namespace System {
9 namespace Memory {
10 namespace Policies {
11 
13 public:
14  static constexpr size_t SizeFront = 0;
15  static constexpr size_t SizeBack = 0;
16 
17  void guardFront(void* ptr, size_t size) const;
18  void guardBack(void* ptr, size_t size) const;
19 
20  void checkFront(void* ptr, size_t size) const;
21  void checkBack(void* ptr, size_t size) const;
22 };
23 
25 public:
26  static constexpr size_t SizeFront = 4;
27  static constexpr size_t SizeBack = 4;
28 
29  void guardFront(void* ptr, size_t size) const;
30  void guardBack(void* ptr, size_t size) const;
31 
32  void checkFront(void* ptr, size_t size) const;
33  void checkBack(void* ptr, size_t size) const;
34 
35 private:
36  static constexpr const char* MagicFront = "\xDE\xAD";
37  static constexpr const char* MagicBack = "\xBE\xEF";
38 };
39 
41 
42 } // Policies
43 } // Memory
44 } // System
45 } // lug
void checkFront(void *ptr, size_t size) const
void guardBack(void *ptr, size_t size) const
void guardFront(void *ptr, size_t size) const
void checkBack(void *ptr, size_t size) const