xo-object2: streamline setup
This commit is contained in:
parent
a136642a20
commit
441044dd01
9 changed files with 55 additions and 104 deletions
23
include/xo/object2/SetupObject2.hpp
Normal file
23
include/xo/object2/SetupObject2.hpp
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/** @file SetupObject2.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/alloc2/Collector.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
struct SetupObject2 {
|
||||
public:
|
||||
using ACollector = xo::mm::ACollector;
|
||||
|
||||
public:
|
||||
static bool register_facets();
|
||||
static bool register_types(obj<ACollector> gc);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/* end object2_register_facets.hpp */
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
/** @file object2_register_facets.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** Register object2 (facet,impl) combinations with FacetRegistry **/
|
||||
bool object2_register_facets();
|
||||
}
|
||||
}
|
||||
|
||||
/* end object2_register_facets.hpp */
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
/** @file object2_register_types.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Dec 2025
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/alloc2/Collector.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** Register object2 (facet,impl) combinations with FacetRegistry **/
|
||||
bool object2_register_types(obj<xo::mm::ACollector> gc);
|
||||
}
|
||||
}
|
||||
|
||||
/* end object2_register_types.hpp */
|
||||
|
|
@ -3,8 +3,7 @@
|
|||
set(SELF_LIB xo_object2)
|
||||
set(SELF_SRCS
|
||||
init_object2.cpp
|
||||
object2_register_types.cpp
|
||||
object2_register_facets.cpp
|
||||
SetupObject2.cpp
|
||||
|
||||
GCObjectConversion_DFloat.cpp
|
||||
GCObjectConversion_DInteger.cpp
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
/** @file object2_register_facets.cpp
|
||||
/** @file SetupObject2.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#include "object2_register_facets.hpp"
|
||||
#include "SetupObject2.hpp"
|
||||
#include "RuntimeError.hpp"
|
||||
|
||||
#include <xo/object2/Dictionary.hpp>
|
||||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
namespace xo {
|
||||
using xo::print::APrintable;
|
||||
using xo::mm::ACollector;
|
||||
using xo::mm::AAllocator;
|
||||
using xo::mm::AGCObject;
|
||||
using xo::scm::DList;
|
||||
|
|
@ -30,11 +31,12 @@ namespace xo {
|
|||
using xo::scm::DArray;
|
||||
using xo::facet::DVariantPlaceholder;
|
||||
using xo::facet::FacetRegistry;
|
||||
using xo::facet::impl_for;
|
||||
using xo::facet::typeseq;
|
||||
|
||||
namespace scm {
|
||||
bool
|
||||
object2_register_facets()
|
||||
SetupObject2::register_facets()
|
||||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
|
|
@ -81,7 +83,24 @@ namespace xo {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
SetupObject2::register_types(obj<ACollector> gc)
|
||||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
bool ok = true;
|
||||
|
||||
ok &= gc.install_type(impl_for<AGCObject, DBoolean>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DFloat>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DInteger>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DList>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DArray>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DDictionary>());
|
||||
|
||||
return ok;
|
||||
}
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end object2_register_facets.cpp */
|
||||
/* end SetupObject2.cpp */
|
||||
|
|
@ -4,23 +4,21 @@
|
|||
**/
|
||||
|
||||
#include "init_object2.hpp"
|
||||
#include "object2_register_facets.hpp"
|
||||
#include "object2_register_types.hpp"
|
||||
#include "SetupObject2.hpp"
|
||||
#include <xo/stringtable2/init_stringtable2.hpp>
|
||||
#include <xo/alloc2/CollectorTypeRegistry.hpp>
|
||||
#include <xo/alloc2/init_alloc2.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::scm::object2_register_facets;
|
||||
using xo::scm::object2_register_types;
|
||||
using xo::scm::SetupObject2;
|
||||
using xo::mm::CollectorTypeRegistry;
|
||||
|
||||
void
|
||||
InitSubsys<S_object2_tag>::init()
|
||||
{
|
||||
object2_register_facets();
|
||||
SetupObject2::register_facets();
|
||||
|
||||
CollectorTypeRegistry::instance().register_types(&object2_register_types);
|
||||
CollectorTypeRegistry::instance().register_types(&SetupObject2::register_types);
|
||||
}
|
||||
|
||||
InitEvidence
|
||||
|
|
|
|||
|
|
@ -1,50 +0,0 @@
|
|||
/** @file object2_register_types.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Dec 2025
|
||||
**/
|
||||
|
||||
#include "object2_register_types.hpp"
|
||||
|
||||
#include "boolean/IGCObject_DBoolean.hpp"
|
||||
#include "number/IGCObject_DFloat.hpp"
|
||||
#include "number/IGCObject_DInteger.hpp"
|
||||
#include "string/IGCObject_DString.hpp"
|
||||
#include "list/IGCObject_DList.hpp"
|
||||
#include "array/IGCObject_DArray.hpp"
|
||||
#include "dictionary/IGCObject_DDictionary.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::scope;
|
||||
|
||||
namespace scm {
|
||||
bool
|
||||
object2_register_types(obj<ACollector> gc)
|
||||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
bool ok = true;
|
||||
|
||||
ok &= gc.install_type(impl_for<AGCObject, DBoolean>());
|
||||
|
||||
ok &= gc.install_type(impl_for<AGCObject, DFloat>());
|
||||
|
||||
ok &= gc.install_type(impl_for<AGCObject, DInteger>());
|
||||
|
||||
ok &= gc.install_type(impl_for<AGCObject, DList>());
|
||||
|
||||
ok &= gc.install_type(impl_for<AGCObject, DArray>());
|
||||
|
||||
ok &= gc.install_type(impl_for<AGCObject, DDictionary>());
|
||||
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end object2_register_types.cpp */
|
||||
|
|
@ -5,16 +5,13 @@
|
|||
|
||||
#include "ListOps.hpp"
|
||||
#include "DList.hpp"
|
||||
#include "object2_register_types.hpp"
|
||||
#include "object2_register_facets.hpp"
|
||||
#include "SetupObject2.hpp"
|
||||
|
||||
#include <xo/object2/DList.hpp>
|
||||
#include <xo/object2/list/IGCObject_DList.hpp>
|
||||
#include <xo/object2/list/IPrintable_DList.hpp>
|
||||
|
||||
#include <xo/stringtable2/String.hpp>
|
||||
//#include <xo/object2/string/IGCObject_DString.hpp>
|
||||
//#include <xo/object2/string/IPrintable_DString.hpp>
|
||||
|
||||
#include <xo/object2/DInteger.hpp>
|
||||
#include <xo/object2/number/IGCObject_DInteger.hpp>
|
||||
|
|
@ -35,8 +32,7 @@
|
|||
#include <catch2/catch.hpp>
|
||||
|
||||
namespace ut {
|
||||
using xo::scm::object2_register_types;
|
||||
using xo::scm::object2_register_facets;
|
||||
using xo::scm::SetupObject2;
|
||||
using xo::scm::ListOps;
|
||||
using xo::scm::DList;
|
||||
using xo::scm::DInteger;
|
||||
|
|
@ -89,7 +85,7 @@ namespace ut {
|
|||
constexpr bool c_debug_flag = true;
|
||||
scope log(XO_DEBUG(c_debug_flag));
|
||||
|
||||
bool ok = object2_register_facets();
|
||||
bool ok = SetupObject2::register_facets();
|
||||
REQUIRE(ok);
|
||||
|
||||
FacetRegistry::instance().dump(&std::cerr);
|
||||
|
|
@ -114,7 +110,7 @@ namespace ut {
|
|||
auto gc_o = with_facet<AAllocator>::mkobj(&gc);
|
||||
auto c_o = with_facet<ACollector>::mkobj(&gc);
|
||||
|
||||
bool ok = object2_register_types(c_o);
|
||||
bool ok = SetupObject2::register_types(c_o);
|
||||
REQUIRE(ok);
|
||||
|
||||
auto l0_o = ListOps::nil();
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
#include "DInteger.hpp"
|
||||
#include "DList.hpp"
|
||||
#include "DArray.hpp"
|
||||
#include "object2_register_types.hpp"
|
||||
|
||||
#include "number/IGCObject_DFloat.hpp"
|
||||
#include "number/IGCObject_DInteger.hpp"
|
||||
|
|
@ -34,7 +33,6 @@
|
|||
|
||||
namespace ut {
|
||||
using xo::S_object2_tag;
|
||||
using xo::scm::object2_register_types;
|
||||
using xo::scm::ListOps;
|
||||
using xo::scm::DList;
|
||||
using xo::scm::DArray;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue