/** @file AResourceVisitor.hpp * * Generated automagically from ingredients: * 1. code generator: * [xo-facet/codegen/genfacet] * arguments: * --input [idl/ResourceVisitor.json5] * 2. jinja2 template for abstract facet .hpp file: * [abstract_facet.hpp.j2] * 3. idl for facet methods * [idl/ResourceVisitor.json5] **/ #pragma once // includes (via {facet_includes}) #include "Allocator.hpp" #include #include #include // {pretext} here namespace xo { namespace mm { using Copaque = const void *; using Opaque = void *; /** Visitor to receive measured resource consumption **/ class AResourceVisitor { public: /** @defgroup mm-resourcevisitor-type-traits **/ ///@{ // types /** integer identifying a type **/ using typeseq = xo::facet::typeseq; using Copaque = const void *; using Opaque = void *; /** type for length of a sequence **/ using size_type = std::size_t; ///@} /** @defgroup mm-resourcevisitor-methods **/ ///@{ // const methods /** An uninitialized AResourceVisitor instance will have zero vtable pointer (per {linux,osx} abi). * Use case for this is narrow. We go to some lengths to avoid null vtable pointers. For example * obj will have non-null vtable (via IFacet_Any) with all methods terminating. **/ bool _has_null_vptr() const noexcept { return *reinterpret_cast(this) == nullptr; } /** RTTI: unique id# for actual runtime data representation **/ virtual typeseq _typeseq() const noexcept = 0; /** destroy instance @p d; calls c++ dtor only for actual runtime type; does not recover memory **/ virtual void _drop(Opaque d) const noexcept = 0; /** report memory consumption **/ virtual void on_allocator(Copaque data, obj mm) const noexcept = 0; // nonconst methods ///@} }; /*AResourceVisitor*/ /** Implementation IResourceVisitor_DRepr of AResourceVisitor for state DRepr * should provide a specialization: * * template <> * struct xo::facet::FacetImplementation { * using Impltype = IResourceVisitor_DRepr; * }; * * then IResourceVisitor_ImplType --> IResourceVisitor_DRepr **/ template using IResourceVisitor_ImplType = xo::facet::FacetImplType; } /*namespace mm*/ } /*namespace xo*/ /* AResourceVisitor.hpp */