xo-expression2: + IGCObject_DUniqueString + facet/type registration
This commit is contained in:
parent
6f8fb9f15a
commit
929c25a7a6
8 changed files with 227 additions and 3 deletions
|
|
@ -44,6 +44,18 @@ xo_add_genfacetimpl(
|
|||
OUTPUT_CPP_DIR src/expression2
|
||||
)
|
||||
|
||||
# note: manual target; generated code committed to git
|
||||
xo_add_genfacetimpl(
|
||||
TARGET xo-expression2-facetimpl-gcobject-uniquestring
|
||||
FACET_PKG xo_gc
|
||||
FACET GCObject
|
||||
REPR UniqueString
|
||||
INPUT idl/IGCObject_DUniqueString.json5
|
||||
OUTPUT_HPP_DIR include/xo/expression2
|
||||
OUTPUT_IMPL_SUBDIR detail
|
||||
OUTPUT_CPP_DIR src/expression2
|
||||
)
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# header-only library
|
||||
|
||||
|
|
|
|||
15
xo-expression2/idl/IGCObject_DUniqueString.json5
Normal file
15
xo-expression2/idl/IGCObject_DUniqueString.json5
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
includes: [
|
||||
"<xo/gc/GCObject.hpp>",
|
||||
"<xo/alloc2/Allocator.hpp>"
|
||||
],
|
||||
local_types: [ ],
|
||||
namespace1: "xo",
|
||||
namespace2: "scm",
|
||||
facet_idl: "idl/GCObject.json5",
|
||||
brief: "provide AGCObject interface for DUniqueString",
|
||||
using_doxygen: true,
|
||||
repr: "DUniqueString",
|
||||
doc: [ "implement AGCObject for DUniqueString" ],
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
/** @file IGCObject_DUniqueString.hpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IGCObject_DUniqueString.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_repr.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IGCObject_DUniqueString.json5]
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GCObject.hpp"
|
||||
#include <xo/gc/GCObject.hpp>
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#include "DUniqueString.hpp"
|
||||
|
||||
namespace xo { namespace scm { class IGCObject_DUniqueString; } }
|
||||
|
||||
namespace xo {
|
||||
namespace facet {
|
||||
template <>
|
||||
struct FacetImplementation<xo::mm::AGCObject,
|
||||
xo::scm::DUniqueString>
|
||||
{
|
||||
using ImplType = xo::mm::IGCObject_Xfer
|
||||
<xo::scm::DUniqueString,
|
||||
xo::scm::IGCObject_DUniqueString>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** @class IGCObject_DUniqueString
|
||||
**/
|
||||
class IGCObject_DUniqueString {
|
||||
public:
|
||||
/** @defgroup scm-gcobject-duniquestring-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-duniquestring-methods **/
|
||||
///@{
|
||||
// const methods
|
||||
/** memory consumption for this instance **/
|
||||
static size_type shallow_size(const DUniqueString & self) noexcept;
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(const DUniqueString & self, obj<AAllocator> mm) noexcept;
|
||||
|
||||
// non-const methods
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DUniqueString & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end */
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
/** @file expression2_register_facets.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/gc/Collector.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** Register expression2 (facet,impl) combinations with FacetRegistry **/
|
||||
bool expression2_register_facets();
|
||||
}
|
||||
}
|
||||
|
||||
/* end expression2_register_facets.hpp */
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
/** @file expression2_register_types.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Dec 2025
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/gc/Collector.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** Register expression2 (facet,impl) combinations with FacetRegistry **/
|
||||
bool expression2_register_types(obj<xo::mm::ACollector> gc);
|
||||
}
|
||||
}
|
||||
|
||||
/* end expression2_register_types.hpp */
|
||||
39
xo-expression2/src/expression2/IGCObject_DUniqueString.cpp
Normal file
39
xo-expression2/src/expression2/IGCObject_DUniqueString.cpp
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/** @file IGCObject_DUniqueString.cpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IGCObject_DUniqueString.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IGCObject_DUniqueString.json5]
|
||||
**/
|
||||
|
||||
#include "detail/IGCObject_DUniqueString.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IGCObject_DUniqueString::shallow_size(const DUniqueString & self) noexcept -> size_type
|
||||
{
|
||||
return self.shallow_size();
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DUniqueString::shallow_copy(const DUniqueString & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_copy(mm);
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DUniqueString::forward_children(DUniqueString & self, obj<ACollector> gc) noexcept -> size_type
|
||||
{
|
||||
return self.forward_children(gc);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IGCObject_DUniqueString.cpp */
|
||||
|
|
@ -1,11 +1,31 @@
|
|||
/** @file expression2_register_facets.cpp
|
||||
*
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#include "expression2_register_facets.hpp"
|
||||
|
||||
#include <xo/expression2/detail/IGCObject_DUniqueString.hpp>
|
||||
|
||||
#include <xo/gc/detail/AGCObject.hpp>
|
||||
#include <xo/facet/FacetRegistry.hpp>
|
||||
#include <xo/indentlog/scope.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::mm::AGCObject;
|
||||
using xo::facet::FacetRegistry;
|
||||
|
||||
namespace scm {
|
||||
}
|
||||
} /*namesapce xo*/
|
||||
bool
|
||||
expression2_register_facets()
|
||||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
FacetRegistry::register_impl<AGCObject, DUniqueString>();
|
||||
|
||||
return true;
|
||||
}
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end expression2_register_facets.cpp */
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
/** @file expression2_register_types.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#include "expression2_register_types.hpp"
|
||||
|
||||
#include "detail/IGCObject_DUniqueString.hpp"
|
||||
|
||||
//#include "detail/IPrintable_DUniqueString.hpp"
|
||||
|
||||
//#include <xo/facet/FacetRegistry.hpp>
|
||||
#include <xo/indentlog/scope.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::mm::ACollector;
|
||||
using xo::mm::AGCObject;
|
||||
using xo::facet::impl_for;
|
||||
using xo::facet::typeseq;
|
||||
using xo::scope;
|
||||
|
||||
namespace scm {
|
||||
bool
|
||||
expression2_register_types(obj<ACollector> gc)
|
||||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
bool ok = true;
|
||||
|
||||
ok &= gc.install_type(impl_for<AGCObject, DUniqueString>());
|
||||
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end expression2_register_types.cpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue