PlayRho  2.0.0
An interactive physics engine & library.
playrho::pmr::StatsResource Class Referencefinal

Statistics memory resource. More...

#include <playrho/pmr/StatsResource.hpp>

Inheritance diagram for playrho::pmr::StatsResource:
[legend]
Collaboration diagram for playrho::pmr::StatsResource:
[legend]

Classes

struct  Stats
 Statistics collected. More...
 

Public Member Functions

 StatsResource (memory_resource *resource=new_delete_resource()) noexcept
 Initializing constructor. More...
 
Stats GetStats () const noexcept
 Gets the currently collected statistics.
 
pmr::memory_resourceupstream_resource () const noexcept
 Returns a pointer to the upstream resource set on construction.
 
- Public Member Functions inherited from playrho::pmr::memory_resource
 memory_resource ()=default
 Default constructor.
 
 memory_resource (const memory_resource &)=default
 Copy constructor.
 
virtual ~memory_resource ()
 Destructor.
 
void * allocate (std::size_t bytes, std::size_t alignment=alignof(std::max_align_t))
 Allocates memory.
 
void deallocate (void *p, std::size_t bytes, std::size_t alignment=alignof(std::max_align_t))
 Deallocates memory.
 
bool is_equal (const memory_resource &other) const noexcept
 Compare for equality with other resource.
 

Detailed Description

Statistics memory resource.

Forwards allocation and deallocation calls to the configured upstream memory resource, and collects statistics on successful calls.

Constructor & Destructor Documentation

◆ StatsResource()

playrho::pmr::StatsResource::StatsResource ( memory_resource resource = new_delete_resource())
inlinenoexcept

Initializing constructor.

Postcondition
upstream_resource() returns the resource given.

The documentation for this class was generated from the following files: