lumiera_documentation/src/steam/engine/diagnostic-buffer-provider.cpp
Ichthyostega bb6401aaf3 BufferProvider: reshape diagnostics into a decorator
The intention is to build the tracking functionality from scratch,
while wrapping the old implementation as delegate. Hopefully this allows
to reduce the complexity of the existing implementation step by step,
until I'm ''able to grasp what this implementation does''.

This old implementation works, but is highly problematic code.
The Git history shows that I had already problems to understand this code
while building the DiagnosticOutputSlot, one year later.

To my defense, in both cases (2011 and 2012), I had no clear idea yet
how the processing within the engine would work, and thus I considered
that Buffer Type registry a mere implementation detail, that can be
lumped into the »code behind«.
2026-02-09 03:29:06 +01:00

70 lines
1.8 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
DiagnosticBufferProvider - helper for testing against the BufferProvider interface
Copyright (C)
2011, Hermann Vosseler <Ichthyostega@web.de>
  **Lumiera** is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by the
  Free Software Foundation; either version 2 of the License, or (at your
  option) any later version. See the file COPYING for further details.
* *****************************************************************/
/** @file diagnostic-buffer-provider.cpp
** Implementation details of unit test support regarding internals of the render engine.
**
** @todo WIP from 2013, half finished, stalled
** @see buffer-provider-protocol-test.cpp
*/
//#include "lib/error.hpp"
//#include "include/logging.h"
//#include "lib/meta/function.hpp"
#include "steam/engine/diagnostic-buffer-provider.hpp"
#include "steam/engine/heap-mem-provider.hpp"
namespace steam {
namespace engine {
DiagnosticBufferProvider::DiagnosticBufferProvider()
: BufferProvider{"Diagnostic_HeapAllocated"}
{ }
DiagnosticBufferProvider::~DiagnosticBufferProvider()
{
// INFO (proc_mem, "discarding %zu diagnostic buffer entries", outSeq_.size()); ////////////OOO implement based on dedicated tracking information in-object
}
/* === diagnostic API === */
bool
BufferDiagnostic::buffer_was_used (uint bufferID)
{
return dbp_.heapMemProvider_.access_emitted(bufferID).was_used();
}
bool
BufferDiagnostic::buffer_was_closed (uint bufferID)
{
return dbp_.heapMemProvider_.access_emitted(bufferID).was_closed();
}
void*
BufferDiagnostic::accessMemory (uint bufferID)
{
return dbp_.heapMemProvider_.access_emitted(bufferID).accessMemory();
}
}} // namespace engine