xo-gc stack: fix mutation setup + xo-reader2 utest
This commit is contained in:
parent
200a027103
commit
b64940fa0a
24 changed files with 478 additions and 48 deletions
|
|
@ -13,13 +13,27 @@
|
|||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
class GCObjectConversionUtil {
|
||||
public:
|
||||
using AGCObject = xo::mm::AGCObject;
|
||||
using typeseq = xo::reflect::typeseq;
|
||||
|
||||
/** helper method fro GCObjectConversion<..>::from_gco()
|
||||
* on conversion failure
|
||||
**/
|
||||
static void _from_gco_fail_aux(obj<AGCObject> gco,
|
||||
typeseq tseq,
|
||||
scope * p_log);
|
||||
};
|
||||
|
||||
/** @brief compile-time conversion obj<AGCObject> <-> T
|
||||
*
|
||||
* Specialize for each T that participates in conversion.
|
||||
* Methods here aren't implemented
|
||||
**/
|
||||
template <typename T>
|
||||
struct GCObjectConversion {
|
||||
class GCObjectConversion {
|
||||
public:
|
||||
using AGCObject = xo::mm::AGCObject;
|
||||
using AAllocator = xo::mm::AAllocator;
|
||||
|
||||
|
|
@ -73,6 +87,13 @@ namespace xo {
|
|||
}
|
||||
}
|
||||
|
||||
/** Several use cases here:
|
||||
* 1. runtime polymorphism
|
||||
* obj<AGCObject,DArray> v(DArray::make(..));
|
||||
* // from_gco() doesn't know v repr
|
||||
* auto gc = GCObjectConversion<ASequence,DArray>::from_gco(mm, v);
|
||||
*
|
||||
**/
|
||||
static obj<AFacet,DRepr> from_gco(obj<AAllocator>,
|
||||
obj<AGCObject> gco) {
|
||||
scope log(XO_DEBUG(false));
|
||||
|
|
@ -92,14 +113,10 @@ namespace xo {
|
|||
auto retval = obj<AFacet,DRepr>::from(gco);
|
||||
|
||||
if (!retval) {
|
||||
log.retroactively_enable();
|
||||
|
||||
log && log(xtag("gco.tseq", gco._typeseq()));
|
||||
log && log(xtag("DRepr.tseq", reflect::typeseq::id<DRepr>()));
|
||||
GCObjectConversionUtil::_from_gco_fail_aux
|
||||
(gco, reflect::typeseq::id<DRepr>(), &log);
|
||||
}
|
||||
|
||||
assert(retval);
|
||||
|
||||
return retval;
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue