From 2844e5b6ee75084514dab07cc06e3a64cfe81688 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 16 Mar 2026 15:10:53 -0500 Subject: [PATCH] xo-type: streamline setup --- include/xo/type/SetupType.hpp | 25 +++++++++++ include/xo/type/type_register_facets.hpp | 15 ------- include/xo/type/type_register_types.hpp | 17 -------- src/type/CMakeLists.txt | 3 +- ...type_register_facets.cpp => SetupType.cpp} | 24 +++++++++-- src/type/init_type.cpp | 10 ++--- src/type/type_register_types.cpp | 42 ------------------- 7 files changed, 50 insertions(+), 86 deletions(-) create mode 100644 include/xo/type/SetupType.hpp delete mode 100644 include/xo/type/type_register_facets.hpp delete mode 100644 include/xo/type/type_register_types.hpp rename src/type/{type_register_facets.cpp => SetupType.cpp} (70%) delete mode 100644 src/type/type_register_types.cpp diff --git a/include/xo/type/SetupType.hpp b/include/xo/type/SetupType.hpp new file mode 100644 index 0000000..9330490 --- /dev/null +++ b/include/xo/type/SetupType.hpp @@ -0,0 +1,25 @@ +/** @file SetupType.hpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#pragma once + +#include + +namespace xo { + namespace scm { + struct SetupType { + public: + using ACollector = xo::mm::ACollector; + + public: + /** Register type (facet,impl) combinations with FacetRegistry **/ + static bool register_facets(); + /** Register type (facet,impl) combinations with FacetRegistry **/ + static bool register_types(obj gc); + }; + } +} + +/* end SetupType.hpp */ diff --git a/include/xo/type/type_register_facets.hpp b/include/xo/type/type_register_facets.hpp deleted file mode 100644 index f418eab..0000000 --- a/include/xo/type/type_register_facets.hpp +++ /dev/null @@ -1,15 +0,0 @@ -/** @file type_register_facets.hpp - * - * @author Roland Conybeare, Jan 2026 - **/ - -#pragma once - -namespace xo { - namespace scm { - /** Register type (facet,impl) combinations with FacetRegistry **/ - bool type_register_facets(); - } -} - -/* end type_register_facets.hpp */ diff --git a/include/xo/type/type_register_types.hpp b/include/xo/type/type_register_types.hpp deleted file mode 100644 index 5ab1db0..0000000 --- a/include/xo/type/type_register_types.hpp +++ /dev/null @@ -1,17 +0,0 @@ -/** @file type_register_types.hpp - * - * @author Roland Conybeare, Dec 2025 - **/ - -#pragma once - -#include - -namespace xo { - namespace scm { - /** Register type (facet,impl) combinations with FacetRegistry **/ - bool type_register_types(obj gc); - } -} - -/* end type_register_types.hpp */ diff --git a/src/type/CMakeLists.txt b/src/type/CMakeLists.txt index d420349..59f2b9f 100644 --- a/src/type/CMakeLists.txt +++ b/src/type/CMakeLists.txt @@ -3,8 +3,7 @@ set(SELF_LIB xo_type) set(SELF_SRCS init_type.cpp - type_register_facets.cpp - type_register_types.cpp + SetupType.cpp TypeOps.cpp Metatype.cpp DAtomicType.cpp diff --git a/src/type/type_register_facets.cpp b/src/type/SetupType.cpp similarity index 70% rename from src/type/type_register_facets.cpp rename to src/type/SetupType.cpp index 047fb9f..ff5f498 100644 --- a/src/type/type_register_facets.cpp +++ b/src/type/SetupType.cpp @@ -1,9 +1,9 @@ -/** @file type_register_facets.cpp +/** @file SetupType.cpp * * @author Roland Conybeare, Feb 2026 **/ -#include "type_register_facets.hpp" +#include "SetupType.hpp" #include "AtomicType.hpp" #include "ListType.hpp" #include "ArrayType.hpp" @@ -16,12 +16,13 @@ namespace xo { using xo::mm::AGCObject; using xo::facet::FacetRegistry; + using xo::facet::impl_for; using xo::reflect::typeseq; namespace scm { bool - type_register_facets() + SetupType::register_facets() { scope log(XO_DEBUG(true)); @@ -49,7 +50,22 @@ namespace xo { return true; } + bool + SetupType::register_types(obj gc) + { + scope log(XO_DEBUG(true)); + + bool ok = true; + + ok &= gc.install_type(impl_for()); + ok &= gc.install_type(impl_for()); + ok &= gc.install_type(impl_for()); + ok &= gc.install_type(impl_for()); + ok &= gc.install_type(impl_for()); + + return ok; + } } /*namespace scm*/ } /*namespace xo*/ -/* end type_register_facets.cpp */ +/* end SetupType.cpp */ diff --git a/src/type/init_type.cpp b/src/type/init_type.cpp index bbae93d..6a54439 100644 --- a/src/type/init_type.cpp +++ b/src/type/init_type.cpp @@ -4,22 +4,20 @@ **/ #include "init_type.hpp" -#include "type_register_facets.hpp" -#include "type_register_types.hpp" +#include "SetupType.hpp" #include #include namespace xo { - using xo::scm::type_register_facets; - using xo::scm::type_register_types; + using xo::scm::SetupType; using xo::mm::CollectorTypeRegistry; void InitSubsys::init() { - type_register_facets(); + SetupType::register_facets(); - CollectorTypeRegistry::instance().register_types(&type_register_types); + CollectorTypeRegistry::instance().register_types(&SetupType::register_types); } InitEvidence diff --git a/src/type/type_register_types.cpp b/src/type/type_register_types.cpp deleted file mode 100644 index 28e9f9a..0000000 --- a/src/type/type_register_types.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/** @file type_register_types.cpp - * - * @author Roland Conybeare, Dec 2025 - **/ - -#include "type_register_types.hpp" - -#include "AtomicType.hpp" -#include "ListType.hpp" -#include "ArrayType.hpp" -#include "FunctionType.hpp" -#include "TypeVarRef.hpp" -#include -#include -#include - -namespace xo { - using xo::mm::ACollector; - using xo::mm::AGCObject; - using xo::facet::impl_for; - using xo::scope; - - namespace scm { - bool - type_register_types(obj gc) - { - scope log(XO_DEBUG(true)); - - bool ok = true; - - ok &= gc.install_type(impl_for()); - ok &= gc.install_type(impl_for()); - ok &= gc.install_type(impl_for()); - ok &= gc.install_type(impl_for()); - ok &= gc.install_type(impl_for()); - - return ok; - } - } -} /*namespace xo*/ - -/* end type_register_types.cpp */