xo-reader2 stack: + ARuntimeContext.collector()
access Collector API (if present) from runtime context
This commit is contained in:
parent
8bc5f58259
commit
3220cb1b59
4 changed files with 19 additions and 0 deletions
|
|
@ -22,12 +22,14 @@ namespace xo {
|
|||
public:
|
||||
using StringTable = xo::scm::StringTable;
|
||||
using AAllocator = xo::mm::AAllocator;
|
||||
using ACollector = xo::mm::ACollector;
|
||||
using MemorySizeVisitor = xo::mm::MemorySizeVisitor;
|
||||
|
||||
public:
|
||||
DVsmRcx(VirtualSchematikaMachine * vsm);
|
||||
|
||||
obj<AAllocator> allocator() const noexcept;
|
||||
obj<ACollector> collector() const noexcept;
|
||||
StringTable * stringtable() const noexcept;
|
||||
obj<AAllocator> error_allocator() const noexcept;
|
||||
void visit_pools(const MemorySizeVisitor & visitor) const;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ namespace xo {
|
|||
/** @defgroup scm-runtimecontext-dvsmrcx-type-traits **/
|
||||
///@{
|
||||
using AAllocator = xo::scm::ARuntimeContext::AAllocator;
|
||||
using ACollector = xo::scm::ARuntimeContext::ACollector;
|
||||
using MemorySizeVisitor = xo::scm::ARuntimeContext::MemorySizeVisitor;
|
||||
using Copaque = xo::scm::ARuntimeContext::Copaque;
|
||||
using Opaque = xo::scm::ARuntimeContext::Opaque;
|
||||
|
|
@ -49,6 +50,8 @@ namespace xo {
|
|||
// const methods
|
||||
/** default allocator to use for objects **/
|
||||
static obj<AAllocator> allocator(const DVsmRcx & self) noexcept;
|
||||
/** collector facet for allocator. If non-null, same data pointer as allocator **/
|
||||
static obj<ACollector> collector(const DVsmRcx & self) noexcept;
|
||||
/** stringtable for unique symbols **/
|
||||
static StringTable * stringtable(const DVsmRcx & self) noexcept;
|
||||
/** invoke visitor for each distinct memory pool **/
|
||||
|
|
|
|||
|
|
@ -5,9 +5,11 @@
|
|||
|
||||
#include "DVsmRcx.hpp"
|
||||
#include "VirtualSchematikaMachine.hpp"
|
||||
#include <xo/facet/FacetRegistry.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::mm::AAllocator;
|
||||
using xo::mm::ACollector;
|
||||
|
||||
namespace scm {
|
||||
|
||||
|
|
@ -19,6 +21,12 @@ namespace xo {
|
|||
return vsm_->allocator();
|
||||
}
|
||||
|
||||
obj<ACollector>
|
||||
DVsmRcx::collector() const noexcept
|
||||
{
|
||||
return vsm_->allocator().try_to_facet<ACollector>();
|
||||
}
|
||||
|
||||
obj<AAllocator>
|
||||
DVsmRcx::error_allocator() const noexcept
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,6 +21,12 @@ namespace xo {
|
|||
return self.allocator();
|
||||
}
|
||||
|
||||
auto
|
||||
IRuntimeContext_DVsmRcx::collector(const DVsmRcx & self) noexcept -> obj<ACollector>
|
||||
{
|
||||
return self.collector();
|
||||
}
|
||||
|
||||
auto
|
||||
IRuntimeContext_DVsmRcx::stringtable(const DVsmRcx & self) noexcept -> StringTable *
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue