xo-type: streamline setup
This commit is contained in:
parent
d464ea3f5b
commit
1b925d9747
7 changed files with 50 additions and 86 deletions
25
xo-type/include/xo/type/SetupType.hpp
Normal file
25
xo-type/include/xo/type/SetupType.hpp
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/** @file SetupType.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/alloc2/Collector.hpp>
|
||||
|
||||
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<ACollector> gc);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/* end SetupType.hpp */
|
||||
|
|
@ -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 */
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
/** @file type_register_types.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Dec 2025
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/alloc2/Collector.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** Register type (facet,impl) combinations with FacetRegistry **/
|
||||
bool type_register_types(obj<xo::mm::ACollector> gc);
|
||||
}
|
||||
}
|
||||
|
||||
/* end type_register_types.hpp */
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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<ACollector> gc)
|
||||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
bool ok = true;
|
||||
|
||||
ok &= gc.install_type(impl_for<AGCObject, DAtomicType>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DListType>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DArrayType>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DFunctionType>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DTypeVarRef>());
|
||||
|
||||
return ok;
|
||||
}
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end type_register_facets.cpp */
|
||||
/* end SetupType.cpp */
|
||||
|
|
@ -4,22 +4,20 @@
|
|||
**/
|
||||
|
||||
#include "init_type.hpp"
|
||||
#include "type_register_facets.hpp"
|
||||
#include "type_register_types.hpp"
|
||||
#include "SetupType.hpp"
|
||||
#include <xo/alloc2/CollectorTypeRegistry.hpp>
|
||||
#include <xo/alloc2/init_alloc2.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::scm::type_register_facets;
|
||||
using xo::scm::type_register_types;
|
||||
using xo::scm::SetupType;
|
||||
using xo::mm::CollectorTypeRegistry;
|
||||
|
||||
void
|
||||
InitSubsys<S_type_tag>::init()
|
||||
{
|
||||
type_register_facets();
|
||||
SetupType::register_facets();
|
||||
|
||||
CollectorTypeRegistry::instance().register_types(&type_register_types);
|
||||
CollectorTypeRegistry::instance().register_types(&SetupType::register_types);
|
||||
}
|
||||
|
||||
InitEvidence
|
||||
|
|
|
|||
|
|
@ -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 <xo/alloc2/Collector.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
|
||||
type_register_types(obj<ACollector> gc)
|
||||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
bool ok = true;
|
||||
|
||||
ok &= gc.install_type(impl_for<AGCObject, DAtomicType>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DListType>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DArrayType>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DFunctionType>());
|
||||
ok &= gc.install_type(impl_for<AGCObject, DTypeVarRef>());
|
||||
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end type_register_types.cpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue