xo-object2: tidy IGCObject_DList

This commit is contained in:
Roland Conybeare 2026-01-15 00:32:50 -05:00
commit 503fd41c78
12 changed files with 159 additions and 89 deletions

View file

@ -19,6 +19,7 @@ namespace xo {
using size_type = std::size_t;
using AGCObject = xo::mm::AGCObject;
using AAllocator = xo::mm::AAllocator;
using ACollector = xo::mm::ACollector;
using ppindentinfo = xo::print::ppindentinfo;
public:
@ -51,6 +52,12 @@ namespace xo {
/** pretty-printing driver; combine layout+printing **/
bool pretty(const ppindentinfo & ppii) const;
// GCObject facet
size_type shallow_size() const noexcept;
DList * shallow_copy(obj<AAllocator> mm) const noexcept;
size_type forward_children(obj<ACollector> gc) noexcept;
/** first member of list **/
obj<AGCObject> head_;
/** remainder of list **/

View file

@ -1,47 +0,0 @@
/** @file IGCObject_DList.hpp
*
* @author Roland Conybeare, Dec 2025
**/
#pragma once
#include <xo/alloc2/Allocator.hpp>
#include <xo/gc/Collector.hpp>
#include <xo/gc/detail/AGCObject.hpp>
#include <xo/gc/detail/IGCObject_Xfer.hpp>
//#include "DList.hpp" // circular
namespace xo {
namespace scm { struct IGCObject_DList; }
namespace scm { struct DList; }
namespace facet {
template <>
struct FacetImplementation<xo::mm::AGCObject,
xo::scm::DList>
{
using ImplType = xo::mm::IGCObject_Xfer
<xo::scm::DList,
xo::scm::IGCObject_DList>;
};
}
namespace scm {
/* changes here coordinate with:
* IGCObject_XFer
*/
struct IGCObject_DList {
public:
using AAllocator = xo::mm::AAllocator;
using ACollector = xo::mm::ACollector;
using size_type = std::size_t;
static size_type shallow_size(const DList & d) noexcept;
static DList * shallow_copy(const DList & d, obj<AAllocator> mm) noexcept;
static size_type forward_children(DList & d, obj<ACollector> gc) noexcept;
};
} /*namespace scm*/
} /*namespace xo*/
/* end IGCObject_DList.hpp */

View file

@ -5,7 +5,7 @@
#pragma once
#include "IGCObject_DList.hpp"
#include "list/IGCObject_DList.hpp"
#include "DList.hpp"
namespace xo {

View file

@ -0,0 +1,65 @@
/** @file IGCObject_DList.hpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IGCObject_DList.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_repr.hpp.j2]
* 3. idl for facet methods
* [idl/IGCObject_DList.json5]
**/
#pragma once
#include "GCObject.hpp"
#include "DList.hpp"
namespace xo { namespace scm { class IGCObject_DList; } }
namespace xo {
namespace facet {
template <>
struct FacetImplementation<xo::mm::AGCObject,
xo::scm::DList>
{
using ImplType = xo::mm::IGCObject_Xfer
<xo::scm::DList,
xo::scm::IGCObject_DList>;
};
}
}
namespace xo {
namespace scm {
/** @class IGCObject_DList
**/
class IGCObject_DList {
public:
/** @defgroup scm-gcobject-dlist-type-traits **/
///@{
using size_type = xo::mm::AGCObject::size_type;
using AAllocator = xo::mm::AGCObject::AAllocator;
using ACollector = xo::mm::AGCObject::ACollector;
using Copaque = xo::mm::AGCObject::Copaque;
using Opaque = xo::mm::AGCObject::Opaque;
///@}
/** @defgroup scm-gcobject-dlist-methods **/
///@{
// const methods
/** memory consumption for this instance **/
static size_type shallow_size(const DList & self) noexcept;
/** copy instance using allocator **/
static Opaque shallow_copy(const DList & self, obj<AAllocator> mm) noexcept;
// non-const methods
/** during GC: forward immdiate children **/
static size_type forward_children(DList & self, obj<ACollector> gc) noexcept;
///@}
};
} /*namespace scm*/
} /*namespace xo*/
/* end */