28 #ifndef D_CodeMemoryReportFormatter_h 29 #define D_CodeMemoryReportFormatter_h 31 #include "CppUTestExt/MemoryReportFormatter.h" 33 struct CodeReportingAllocationNode;
34 class CodeMemoryReportFormatter :
public MemoryReportFormatter
37 CodeReportingAllocationNode* codeReportingList_;
38 TestMemoryAllocator* internalAllocator_;
41 CodeMemoryReportFormatter(TestMemoryAllocator* internalAllocator);
42 virtual ~CodeMemoryReportFormatter();
44 virtual void report_testgroup_start(TestResult* result, UtestShell& test) _override;
45 virtual void report_testgroup_end(TestResult* , UtestShell& ) _override {}
47 virtual void report_test_start(TestResult* result, UtestShell& test) _override;
48 virtual void report_test_end(TestResult* result, UtestShell& test) _override;
50 virtual void report_alloc_memory(TestResult* result, TestMemoryAllocator* allocator,
size_t size,
char* memory,
const char* file,
int line) _override;
51 virtual void report_free_memory(TestResult* result, TestMemoryAllocator* allocator,
char* memory,
const char* file,
int line) _override;
55 void addNodeToList(
const char* variableName,
void* memory, CodeReportingAllocationNode* next);
56 CodeReportingAllocationNode* findNode(
void* memory);
57 bool variableExists(
const SimpleString& variableName);
58 void clearReporting();
60 bool isNewAllocator(TestMemoryAllocator* allocator);
61 SimpleString createVariableNameFromFileLineInfo(
const char *file,
int line);
63 SimpleString getAllocationString(TestMemoryAllocator* allocator,
const SimpleString& variableName,
size_t size);
64 SimpleString getDeallocationString(TestMemoryAllocator* allocator,
const SimpleString& variableName,
const char* file,
int line);