xo-facet xo-gc xo-alloc2: facet cleanup + use genfacet for GCObject
This commit is contained in:
parent
a8cf04d9f6
commit
03b663f291
12 changed files with 428 additions and 205 deletions
|
|
@ -18,6 +18,18 @@ add_definitions(${PROJECT_CXX_FLAGS})
|
|||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
# note: manual target; generated code committed to git
|
||||
xo_add_genfacet(
|
||||
TARGET xo-gc-facet-gcobject
|
||||
FACET GCObject
|
||||
INPUT idl/GCObject.json5
|
||||
OUTPUT_HPP_DIR include/xo/gc
|
||||
OUTPUT_IMPL_SUBDIR detail
|
||||
OUTPUT_CPP_DIR src/gc
|
||||
)
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
# must complete definition of expression lib before configuring examples
|
||||
add_subdirectory(src/gc)
|
||||
add_subdirectory(utest)
|
||||
|
|
|
|||
67
idl/GCObject.json5
Normal file
67
idl/GCObject.json5
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
mode: "facet",
|
||||
includes: [
|
||||
"<xo/alloc2/Allocator.hpp>",
|
||||
"<xo/gc/Collector.hpp>",
|
||||
"<cstdint>",
|
||||
"<cstddef>",
|
||||
],
|
||||
pretext: [
|
||||
"namespace xo { namespace mm { struct ACollector; }}",
|
||||
],
|
||||
namespace1: "xo",
|
||||
namespace2: "mm",
|
||||
facet: "GCObject",
|
||||
detail_subdir: "detail",
|
||||
brief: "xxx",
|
||||
using_doxygen: true,
|
||||
doc: [
|
||||
"GC hooks for collector-aware data"
|
||||
],
|
||||
types: [
|
||||
// using size_type = std::size_t
|
||||
{
|
||||
name: "size_type",
|
||||
doc: ["type for an amount of memory"],
|
||||
definition: "std::size_t",
|
||||
},
|
||||
],
|
||||
const_methods: [
|
||||
// size_type shallow_size() const noexcept
|
||||
{
|
||||
name: "shallow_size",
|
||||
doc: ["memory consumption for this instance"],
|
||||
return_type: "size_type",
|
||||
args: [],
|
||||
const: true,
|
||||
noexcept: true,
|
||||
attributes: [],
|
||||
},
|
||||
// Opaque shallow_copy(obj<AAllocator>>) const noexcept
|
||||
{
|
||||
name: "shallow_copy",
|
||||
doc: ["copy instance using allocator"],
|
||||
return_type: "Opaque",
|
||||
args:[
|
||||
{type: "obj<AAllocator>", name: "mm"},
|
||||
],
|
||||
const: true,
|
||||
noexcept: true,
|
||||
attributes: [],
|
||||
},
|
||||
],
|
||||
nonconst_methods: [
|
||||
// size_type forward_children(obj<ACollector>) const noexcept
|
||||
{
|
||||
name: "forward_children",
|
||||
doc: ["during GC: forward immdiate children"],
|
||||
return_type: "size_type",
|
||||
args: [
|
||||
{type: "obj<ACollector>", name: "gc"},
|
||||
],
|
||||
const: true,
|
||||
noexcept: true,
|
||||
attributes: [],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
|
@ -1,6 +1,14 @@
|
|||
/** @file GCObject.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Dec 2025
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/GCObject.json5]
|
||||
* 2. jinja2 template for facet .hpp file:
|
||||
* [facet.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/GCObject.json5]
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
|
@ -10,4 +18,4 @@
|
|||
#include "detail/IGCObject_Xfer.hpp"
|
||||
#include "detail/RGCObject.hpp"
|
||||
|
||||
/* end GCObject.hpp */
|
||||
/* end GCObject.hpp */
|
||||
|
|
@ -22,8 +22,8 @@ namespace xo {
|
|||
using Copaque = const void *;
|
||||
using Opaque = void *;
|
||||
|
||||
struct AGCObject;
|
||||
struct IGCObject_Any; // see IGCObject_Any.hpp
|
||||
class AGCObject;
|
||||
class IGCObject_Any; // see IGCObject_Any.hpp
|
||||
|
||||
/** @class ACollector
|
||||
* @brief Abstract facet for the XO garbage collector
|
||||
|
|
|
|||
|
|
@ -1,57 +1,79 @@
|
|||
/** @file AGCObject.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Dec 2025
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/GCObject.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [abstract_facet.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/GCObject.json5]
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Allocator.hpp"
|
||||
#include "xo/facet/facet_implementation.hpp"
|
||||
#include "xo/facet/typeseq.hpp"
|
||||
#include "xo/facet/obj.hpp" // for obj<AAllocator> in shallow_copy
|
||||
// includes (via {facet_includes})
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#include <xo/gc/Collector.hpp>
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include <xo/facet/obj.hpp>
|
||||
#include <xo/facet/facet_implementation.hpp>
|
||||
#include <xo/facet/typeseq.hpp>
|
||||
|
||||
namespace xo { namespace mm { struct ACollector; }}
|
||||
|
||||
namespace xo {
|
||||
namespace mm {
|
||||
using Copaque = const void *;
|
||||
using Opaque = void *;
|
||||
namespace mm {
|
||||
|
||||
struct ACollector;
|
||||
using Copaque = const void *;
|
||||
using Opaque = void *;
|
||||
|
||||
/** @class AObject
|
||||
* @brief Abstract facet for collector-eligible data
|
||||
*
|
||||
* Data that supports AGCObject can have memory managed
|
||||
* by ACollector
|
||||
**/
|
||||
struct AGCObject {
|
||||
using typeseq = xo::facet::typeseq;
|
||||
using size_type = std::size_t;
|
||||
/**
|
||||
GC hooks for collector-aware data
|
||||
**/
|
||||
class AGCObject {
|
||||
public:
|
||||
/** @defgroup mm-gcobject-type-traits **/
|
||||
///@{
|
||||
// types
|
||||
/** integer identifying a type **/
|
||||
using typeseq = xo::facet::typeseq;
|
||||
/** type for an amount of memory **/
|
||||
using size_type = std::size_t;
|
||||
///@}
|
||||
|
||||
/** RTTI: unique id# for actual runtime data representation **/
|
||||
virtual typeseq _typeseq() const noexcept = 0;
|
||||
/** @defgroup mm-gcobject-methods **/
|
||||
///@{
|
||||
// const methods
|
||||
/** RTTI: unique id# for actual runtime data representation **/
|
||||
virtual typeseq _typeseq() const noexcept = 0;
|
||||
/** memory consumption for this instance **/
|
||||
virtual size_type shallow_size(Copaque data) const noexcept = 0;
|
||||
/** copy instance using allocator **/
|
||||
virtual Opaque shallow_copy(Copaque data, obj<AAllocator> mm) const noexcept = 0;
|
||||
|
||||
virtual size_type shallow_size(Copaque d) const noexcept = 0;
|
||||
virtual Opaque shallow_copy(Copaque d,
|
||||
obj<AAllocator> mm) const noexcept = 0;
|
||||
virtual size_type forward_children(Opaque d,
|
||||
obj<ACollector>) const noexcept = 0;
|
||||
};
|
||||
// nonconst methods
|
||||
/** during GC: forward immdiate children **/
|
||||
virtual size_type forward_children(Opaque data, obj<ACollector> gc) const noexcept = 0;
|
||||
///@}
|
||||
}; /*AGCObject*/
|
||||
|
||||
// implementation IGCObject_DRepr of AGCObject for state DRepr
|
||||
// should provide a specialization:
|
||||
//
|
||||
// template <>
|
||||
// struct xo::facet::FacetImplementation<AGCObjectx, DRepr> {
|
||||
// using ImplType = IGCObject_DRepr;
|
||||
// };
|
||||
//
|
||||
// then IGCObject_ImplType<DRepr> --> IGCObject_DRepr
|
||||
//
|
||||
template <typename DRepr>
|
||||
using IGCObject_ImplType = xo::facet::FacetImplType<AGCObject, DRepr>;
|
||||
} /*namespace mm*/
|
||||
/** Implementation IGCObject_DRepr of AGCObject for state DRepr
|
||||
* should provide a specialization:
|
||||
*
|
||||
* template <>
|
||||
* struct xo::facet::FacetImplementation<AGCObject, DRepr> {
|
||||
* using Impltype = IGCObject_DRepr;
|
||||
* };
|
||||
*
|
||||
* then IGCObject_ImplType<DRepr> --> IGCObject_DRepr
|
||||
**/
|
||||
template <typename DRepr>
|
||||
using IGCObject_ImplType = xo::facet::FacetImplType<AGCObject, DRepr>;
|
||||
|
||||
} /*namespace mm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end AGCObject.hpp */
|
||||
/* AGCObject.hpp */
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "Allocator.hpp"
|
||||
#include "Collector.hpp"
|
||||
#include "DX1Collector.hpp"
|
||||
|
||||
namespace xo {
|
||||
|
|
|
|||
|
|
@ -1,51 +1,88 @@
|
|||
/** @file IGCObject_Any.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Dec 2025
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/GCObject.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/GCObject.json5]
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "AGCObject.hpp"
|
||||
#include "Collector.hpp"
|
||||
#include <new>
|
||||
#include <xo/facet/obj.hpp>
|
||||
|
||||
namespace xo { namespace mm { class IGCObject_Any; } }
|
||||
|
||||
namespace xo {
|
||||
namespace mm { struct IGCObject_Any; }
|
||||
namespace facet {
|
||||
|
||||
namespace facet {
|
||||
template <>
|
||||
struct FacetImplementation<xo::mm::AGCObject, DVariantPlaceholder> {
|
||||
using ImplType = xo::mm::IGCObject_Any;
|
||||
};
|
||||
}
|
||||
template <>
|
||||
struct FacetImplementation<xo::mm::AGCObject,
|
||||
DVariantPlaceholder>
|
||||
{
|
||||
using ImplType = xo::mm::IGCObject_Any;
|
||||
};
|
||||
|
||||
namespace mm {
|
||||
/** @class IGCObject_Any
|
||||
* @brief AGCObject implementation for empty variant instance
|
||||
**/
|
||||
struct IGCObject_Any : public AGCObject {
|
||||
using typeseq = xo::facet::typeseq;
|
||||
using size_type = std::size_t;
|
||||
}
|
||||
}
|
||||
|
||||
const AGCObject * iface() const { return std::launder(this); }
|
||||
namespace xo {
|
||||
namespace mm {
|
||||
|
||||
// from AGCObject
|
||||
typeseq _typeseq() const noexcept override { return s_typeseq; }
|
||||
/** @class IGCObject_Any
|
||||
* @brief AGCObject implementation for empty variant instance
|
||||
**/
|
||||
class IGCObject_Any : public AGCObject {
|
||||
public:
|
||||
/** @defgroup mm-gcobject-any-type-traits **/
|
||||
///@{
|
||||
|
||||
[[noreturn]] size_type shallow_size(Copaque) const noexcept override { _fatal(); }
|
||||
[[noreturn]] Opaque shallow_copy(Copaque,
|
||||
obj<AAllocator>) const noexcept override { _fatal(); }
|
||||
[[noreturn]] size_type forward_children(Opaque,
|
||||
obj<ACollector>) const noexcept override { _fatal(); }
|
||||
/** integer identifying a type **/
|
||||
using typeseq = xo::facet::typeseq;
|
||||
using size_type = AGCObject::size_type;
|
||||
|
||||
private:
|
||||
[[noreturn]] static void _fatal();
|
||||
///@}
|
||||
/** @defgroup mm-gcobject-any-methods **/
|
||||
///@{
|
||||
|
||||
public:
|
||||
static typeseq s_typeseq;
|
||||
static bool _valid;
|
||||
};
|
||||
} /*namespace mm*/
|
||||
} /*namespace xo*/
|
||||
const AGCObject * iface() const { return std::launder(this); }
|
||||
|
||||
/* end IGCObject_Any.hpp */
|
||||
// from AGCObject
|
||||
|
||||
// const methods
|
||||
typeseq _typeseq() const noexcept override { return s_typeseq; }
|
||||
[[noreturn]] size_type shallow_size(Copaque) const noexcept override { _fatal(); }
|
||||
[[noreturn]] Opaque shallow_copy(Copaque, obj<AAllocator>) const noexcept override { _fatal(); }
|
||||
|
||||
// nonconst methods
|
||||
[[noreturn]] size_type forward_children(Opaque, obj<ACollector>) const noexcept override;
|
||||
|
||||
///@}
|
||||
|
||||
private:
|
||||
/** @defgraoup mm-gcobject-any-private-methods **/
|
||||
///@{
|
||||
|
||||
[[noreturn]] static void _fatal();
|
||||
|
||||
///@}
|
||||
|
||||
public:
|
||||
/** @defgroup mm-gcobject-any-member-vars **/
|
||||
///@{
|
||||
|
||||
static typeseq s_typeseq;
|
||||
static bool _valid;
|
||||
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace mm */
|
||||
} /*namespace xo */
|
||||
|
||||
/* IGCObject_Any.hpp */
|
||||
|
|
@ -1,64 +1,90 @@
|
|||
/** @file IGCObject_Xfer.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Dec 2025
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/GCObject.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/GCObject.json5]
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "AGCObject.hpp"
|
||||
#include "ACollector.hpp"
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#include <xo/gc/Collector.hpp>
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
namespace xo {
|
||||
namespace mm {
|
||||
/** @class IGCObject_Xfer
|
||||
*
|
||||
* Adapts typed GC object implementation @tparam IGCObject_DRepr
|
||||
* to type-erased @ref AGCObject interface
|
||||
**/
|
||||
template <typename DRepr, typename IGCObject_DRepr>
|
||||
struct IGCObject_Xfer : public AGCObject {
|
||||
using Impl = IGCObject_DRepr;
|
||||
using size_type = AGCObject::size_type;
|
||||
namespace mm {
|
||||
/** @class IGCObject_Xfer
|
||||
**/
|
||||
template <typename DRepr, typename IGCObject_DRepr>
|
||||
class IGCObject_Xfer : public AGCObject {
|
||||
public:
|
||||
/** @defgroup mm-gcobject-xfer-type-traits **/
|
||||
///@{
|
||||
/** actual implementation (not generated; often delegates to DRepr) **/
|
||||
using Impl = IGCObject_DRepr;
|
||||
/** integer identifying a type **/
|
||||
using typeseq = AGCObject::typeseq;
|
||||
using size_type = AGCObject::size_type;
|
||||
///@}
|
||||
|
||||
static const DRepr & _dcast(Copaque d) { return *(const DRepr *)d; }
|
||||
static DRepr & _dcast(Opaque d) { return *(DRepr *)d; }
|
||||
/** @defgroup mm-gcobject-xfer-methods **/
|
||||
///@{
|
||||
|
||||
// from AGCObject
|
||||
static const DRepr & _dcast(Copaque d) { return *(const DRepr *)d; }
|
||||
static DRepr & _dcast(Opaque d) { return *(DRepr *)d; }
|
||||
|
||||
// const methods
|
||||
// from AGCObject
|
||||
|
||||
typeseq _typeseq() const noexcept override { return s_typeseq; }
|
||||
size_type shallow_size(Copaque d) const noexcept override {
|
||||
return I::shallow_size(_dcast(d));
|
||||
}
|
||||
Opaque shallow_copy(Copaque d, obj<AAllocator> mm) const noexcept override {
|
||||
return I::shallow_copy(_dcast(d), mm);
|
||||
}
|
||||
// const methods
|
||||
typeseq _typeseq() const noexcept override { return s_typeseq; }
|
||||
size_type shallow_size(Copaque data) const noexcept override {
|
||||
return I::shallow_size(_dcast(data));
|
||||
}
|
||||
Opaque shallow_copy(Copaque data, obj<AAllocator> mm) const noexcept override {
|
||||
return I::shallow_copy(_dcast(data), mm);
|
||||
}
|
||||
|
||||
// non-const methods
|
||||
// non-const methods
|
||||
size_type forward_children(Opaque data, obj<ACollector> gc) const noexcept override {
|
||||
return I::forward_children(_dcast(data), gc);
|
||||
}
|
||||
|
||||
size_type forward_children(Opaque d,
|
||||
obj<ACollector> gc) const noexcept override {
|
||||
return I::forward_children(_dcast(d), gc);
|
||||
}
|
||||
///@}
|
||||
|
||||
private:
|
||||
using I = Impl;
|
||||
private:
|
||||
using I = Impl;
|
||||
|
||||
public:
|
||||
static typeseq s_typeseq;
|
||||
static bool _valid;
|
||||
};
|
||||
public:
|
||||
/** @defgroup mm-gcobject-xfer-member-vars **/
|
||||
///@{
|
||||
|
||||
template <typename DRepr, typename IGCObject_DRepr>
|
||||
xo::facet::typeseq
|
||||
IGCObject_Xfer<DRepr, IGCObject_DRepr>::s_typeseq = facet::typeseq::id<DRepr>();
|
||||
/** typeseq for template parameter DRepr **/
|
||||
static typeseq s_typeseq;
|
||||
/** true iff satisfies facet implementation **/
|
||||
static bool _valid;
|
||||
|
||||
template <typename DRepr, typename IGCObject_DRepr>
|
||||
bool
|
||||
IGCObject_Xfer<DRepr, IGCObject_DRepr>::_valid = facet::valid_facet_implementation<AGCObject, IGCObject_Xfer>();
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace mm*/
|
||||
template <typename DRepr, typename IGCObject_DRepr>
|
||||
xo::facet::typeseq
|
||||
IGCObject_Xfer<DRepr, IGCObject_DRepr>::s_typeseq
|
||||
= xo::facet::typeseq::id<DRepr>();
|
||||
|
||||
template <typename DRepr, typename IGCObject_DRepr>
|
||||
bool
|
||||
IGCObject_Xfer<DRepr, IGCObject_DRepr>::_valid
|
||||
= xo::facet::valid_facet_implementation<AGCObject,
|
||||
IGCObject_Xfer>();
|
||||
|
||||
} /*namespace mm */
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IGCObject_Xfer.hpp */
|
||||
/* end IGCObject_Xfer.hpp */
|
||||
|
|
@ -1,48 +1,83 @@
|
|||
/** @file RGCObject.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Dec 2025
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/GCObject.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/GCObject.json5]
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "AGCObject.hpp"
|
||||
#include <xo/facet/RRouter.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace mm {
|
||||
/** @class RGCObject **/
|
||||
template <typename Object>
|
||||
struct RGCObject : public Object {
|
||||
private:
|
||||
using O = Object;
|
||||
public:
|
||||
using ObjectType = Object;
|
||||
using DataPtr = Object::DataPtr;
|
||||
using typeseq = xo::facet::typeseq;
|
||||
using size_type = std::size_t;
|
||||
namespace mm {
|
||||
|
||||
RGCObject() = default;
|
||||
RGCObject(Object::DataPtr data) : Object{std::move(data)} {}
|
||||
/** @class RGCObject
|
||||
**/
|
||||
template <typename Object>
|
||||
class RGCObject : public Object {
|
||||
private:
|
||||
using O = Object;
|
||||
|
||||
typeseq _typeseq() const noexcept { return O::iface()->_typeseq(); }
|
||||
size_type shallow_size() const noexcept { O::iface()->shallow_size(O::data()); }
|
||||
Opaque shallow_copy(obj<AAllocator> mm) const noexcept { O::iface()->shallow_copy(O::data(), mm); }
|
||||
size_type forward_children() noexcept { O::iface()->forward_children(O::data()); }
|
||||
public:
|
||||
/** @defgroup mm-gcobject-router-type-traits **/
|
||||
///@{
|
||||
using ObjectType = Object;
|
||||
using DataPtr = Object::DataPtr;
|
||||
using typeseq = xo::reflect::typeseq;
|
||||
using size_type = AGCObject::size_type;
|
||||
///@}
|
||||
|
||||
static bool _valid;
|
||||
};
|
||||
/** @defgroup mm-gcobject-router-ctors **/
|
||||
///@{
|
||||
RGCObject() {}
|
||||
RGCObject(Object::DataPtr data) : Object{std::move(data)} {}
|
||||
|
||||
template <typename Object>
|
||||
bool
|
||||
RGCObject<Object>::_valid = facet::valid_object_router<RGCObject>();
|
||||
} /*namespace mm*/
|
||||
///@}
|
||||
/** @defgroup mm-gcobject-router-methods **/
|
||||
///@{
|
||||
|
||||
namespace facet {
|
||||
template <typename Object>
|
||||
struct RoutingFor<xo::mm::AGCObject, Object> {
|
||||
using RoutingType = xo::mm::RGCObject<Object>;
|
||||
};
|
||||
// const methods
|
||||
typeseq _typeseq() const noexcept { return O::iface()->_typeseq(); }
|
||||
size_type shallow_size() const noexcept {
|
||||
return O::iface()->shallow_size(O::data());
|
||||
}
|
||||
Opaque shallow_copy(obj<AAllocator> mm) const noexcept {
|
||||
return O::iface()->shallow_copy(O::data(), mm);
|
||||
}
|
||||
|
||||
// non-const methods
|
||||
size_type forward_children(obj<ACollector> gc) noexcept {
|
||||
return O::iface()->forward_children(O::data(), gc);
|
||||
}
|
||||
|
||||
///@}
|
||||
/** @defgroup mm-gcobject-member-vars **/
|
||||
///@{
|
||||
|
||||
static bool _valid;
|
||||
|
||||
///@}
|
||||
};
|
||||
|
||||
template <typename Object>
|
||||
bool
|
||||
RGCObject<Object>::_valid = xo::facet::valid_object_router<Object>();
|
||||
|
||||
} /*namespace mm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end RGCObject.hpp */
|
||||
namespace xo { namespace facet {
|
||||
template <typename Object>
|
||||
struct RoutingFor<xo::mm::AGCObject, Object> {
|
||||
using RoutingType = xo::mm::RGCObject<Object>;
|
||||
};
|
||||
} }
|
||||
|
||||
/* end RGCObject.hpp */
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
* @author Roland Conybeare, Dec 2025
|
||||
**/
|
||||
|
||||
#include "Collector.hpp"
|
||||
#include "xo/gc/DX1CollectorIterator.hpp"
|
||||
#include "xo/gc/DX1Collector.hpp"
|
||||
#include <xo/indentlog/scope.hpp>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
* See also ICollector_DX1Collector.cpp for collector facet
|
||||
**/
|
||||
|
||||
#include "Collector.hpp" // for obj<ACollector> argument to GCObject.forward_children()
|
||||
#include "detail/IAllocator_DX1Collector.hpp"
|
||||
#include "detail/IAllocIterator_DX1CollectorIterator.hpp"
|
||||
#include "DX1CollectorIterator.hpp"
|
||||
|
|
|
|||
|
|
@ -1,34 +1,47 @@
|
|||
/** @file IGCObject_Any.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Dec 2025
|
||||
**/
|
||||
|
||||
#include "detail/IGCObject_Any.hpp"
|
||||
#include <iostream>
|
||||
|
||||
namespace xo {
|
||||
using xo::facet::DVariantPlaceholder;
|
||||
using xo::facet::typeseq;
|
||||
using xo::facet::valid_facet_implementation;
|
||||
namespace mm {
|
||||
|
||||
namespace mm {
|
||||
using xo::facet::DVariantPlaceholder;
|
||||
using xo::facet::typeseq;
|
||||
using xo::facet::valid_facet_implementation;
|
||||
|
||||
void
|
||||
IGCObject_Any::_fatal() {
|
||||
std::cerr << "fatal"
|
||||
<< ": attempt to call uninitialized"
|
||||
<< " IGCObject_Any method"
|
||||
<< std::endl;
|
||||
std::terminate();
|
||||
}
|
||||
void
|
||||
IGCObject_Any::_fatal()
|
||||
{
|
||||
/* control here on uninitialized IAllocator_Any.
|
||||
* Initialized instance will have specific implementation type
|
||||
*/
|
||||
std::cerr << "fatal"
|
||||
<< ": attempt to call uninitialized"
|
||||
<< " IGCObject_Any method"
|
||||
<< std::endl;
|
||||
std::terminate();
|
||||
}
|
||||
|
||||
typeseq
|
||||
IGCObject_Any::s_typeseq = typeseq::id<DVariantPlaceholder>();
|
||||
typeseq
|
||||
IGCObject_Any::s_typeseq = typeseq::id<DVariantPlaceholder>();
|
||||
|
||||
bool
|
||||
IGCObject_Any::_valid = valid_facet_implementation<AGCObject, IGCObject_Any>();
|
||||
bool
|
||||
IGCObject_Any::_valid
|
||||
= valid_facet_implementation<AGCObject, IGCObject_Any>();
|
||||
|
||||
} /*namespace mm*/
|
||||
// nonconst methods
|
||||
|
||||
auto
|
||||
IGCObject_Any::forward_children(Opaque, obj<ACollector>) const noexcept -> size_type
|
||||
{
|
||||
_fatal();
|
||||
}
|
||||
|
||||
|
||||
} /*namespace mm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IGCObject_Any.cpp */
|
||||
/* end IGCObject_Any.cpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue