xo-object2: streamline GCObject_DFloat + codegen
This commit is contained in:
parent
503fd41c78
commit
9244302cc1
10 changed files with 152 additions and 78 deletions
|
|
@ -6,6 +6,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#include <xo/gc/Collector.hpp>
|
||||
#include <xo/facet/obj.hpp>
|
||||
#include <xo/indentlog/print/ppindentinfo.hpp>
|
||||
|
||||
|
|
@ -13,6 +14,7 @@ namespace xo {
|
|||
namespace scm {
|
||||
struct DFloat {
|
||||
using AAllocator = xo::mm::AAllocator;
|
||||
using ACollector = xo::mm::ACollector;
|
||||
using ppindentinfo = xo::print::ppindentinfo;
|
||||
using value_type = double;
|
||||
|
||||
|
|
@ -27,9 +29,14 @@ namespace xo {
|
|||
|
||||
double value() const noexcept { return value_; }
|
||||
|
||||
operator double() const noexcept { return value_; }
|
||||
|
||||
bool pretty(const ppindentinfo & ppii) const;
|
||||
|
||||
operator double() const noexcept { return value_; }
|
||||
// GCObject facet
|
||||
std::size_t shallow_size() const noexcept;
|
||||
DFloat * shallow_copy(obj<AAllocator> mm) const noexcept;
|
||||
std::size_t forward_children(obj<ACollector> gc) noexcept;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
/** @file IGCObject_DFloat.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 "DFloat.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm { struct IGCObject_DFloat; }
|
||||
|
||||
namespace facet {
|
||||
template <>
|
||||
struct FacetImplementation<xo::mm::AGCObject,
|
||||
xo::scm::DFloat>
|
||||
{
|
||||
using ImplType = xo::mm::IGCObject_Xfer
|
||||
<xo::scm::DFloat,
|
||||
xo::scm::IGCObject_DFloat>;
|
||||
};
|
||||
}
|
||||
|
||||
namespace scm {
|
||||
/* changes here coordinate with:
|
||||
* IGCObject_Xfer
|
||||
*/
|
||||
struct IGCObject_DFloat {
|
||||
public:
|
||||
using AAllocator = xo::mm::AAllocator;
|
||||
using ACollector = xo::mm::ACollector;
|
||||
using size_type = std::size_t;
|
||||
|
||||
static size_type shallow_size(const DFloat & d) noexcept;
|
||||
static DFloat * shallow_copy(const DFloat & d, obj<AAllocator> mm) noexcept;
|
||||
static size_type forward_children(DFloat & d, obj<ACollector> gc) noexcept;
|
||||
};
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IGCObject_DFloat.hpp */
|
||||
67
include/xo/object2/number/IGCObject_DFloat.hpp
Normal file
67
include/xo/object2/number/IGCObject_DFloat.hpp
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/** @file IGCObject_DFloat.hpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IGCObject_DFloat.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_repr.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IGCObject_DFloat.json5]
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GCObject.hpp"
|
||||
#include <xo/gc/GCObject.hpp>
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#include "DFloat.hpp"
|
||||
|
||||
namespace xo { namespace scm { class IGCObject_DFloat; } }
|
||||
|
||||
namespace xo {
|
||||
namespace facet {
|
||||
template <>
|
||||
struct FacetImplementation<xo::mm::AGCObject,
|
||||
xo::scm::DFloat>
|
||||
{
|
||||
using ImplType = xo::mm::IGCObject_Xfer
|
||||
<xo::scm::DFloat,
|
||||
xo::scm::IGCObject_DFloat>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** @class IGCObject_DFloat
|
||||
**/
|
||||
class IGCObject_DFloat {
|
||||
public:
|
||||
/** @defgroup scm-gcobject-dfloat-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-dfloat-methods **/
|
||||
///@{
|
||||
// const methods
|
||||
/** memory consumption for this instance **/
|
||||
static size_type shallow_size(const DFloat & self) noexcept;
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(const DFloat & self, obj<AAllocator> mm) noexcept;
|
||||
|
||||
// non-const methods
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DFloat & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end */
|
||||
Loading…
Add table
Add a link
Reference in a new issue