x-stringtable2: streamline setup

This commit is contained in:
Roland Conybeare 2026-03-16 19:02:00 -05:00
commit 263aa16cfb
8 changed files with 88 additions and 24 deletions

View file

@ -0,0 +1,25 @@
/** @file SetupStringtable2.hpp
*
* @author Roland Conybeare, Mar 2026
**/
#pragma once
#include <xo/alloc2/Collector.hpp>
namespace xo {
namespace scm {
struct SetupStringtable2 {
public:
using ACollector = xo::mm::ACollector;
public:
/** Register object2 (facet,impl) combinations with FacetRegistry **/
static bool register_facets();
/** Register types with garbage collector **/
static bool register_types(obj<ACollector> gc);
};
}
}
/* end SetupStringtable2.hpp */

View file

@ -7,8 +7,6 @@
namespace xo {
namespace scm {
/** Register object2 (facet,impl) combinations with FacetRegistry **/
bool stringtable2_register_facets();
}
}

View file

@ -9,8 +9,6 @@
namespace xo {
namespace scm {
/** Register stringtable2 (facet,impl) combinations with FacetRegistry **/
bool stringtable2_register_types(obj<xo::mm::ACollector> gc);
}
}

View file

@ -3,7 +3,8 @@
set(SELF_LIB xo_stringtable2)
set(SELF_SRCS
init_stringtable2.cpp
stringtable2_register_facets.cpp
SetupStringtable2.cpp
#stringtable2_register_facets.cpp
stringtable2_register_types.cpp
StringTable.cpp

View file

@ -0,0 +1,55 @@
/** @file SetupStringtable2.cpp
*
* @author Roland Conybeare, Mar 2026
**/
#include "SetupStringtable2.hpp"
#include <xo/stringtable2/UniqueString.hpp>
#include <xo/stringtable2/String.hpp>
#include <xo/facet/FacetRegistry.hpp>
#include <xo/indentlog/scope.hpp>
namespace xo {
using xo::print::APrintable;
using xo::mm::ACollector;
using xo::mm::AGCObject;
using xo::scm::DString;
using xo::facet::FacetRegistry;
using xo::facet::typeseq;
using xo::facet::impl_for;
namespace scm {
bool
SetupStringtable2::register_facets()
{
scope log(XO_DEBUG(true));
FacetRegistry::register_impl<AGCObject, DUniqueString>();
FacetRegistry::register_impl<APrintable, DUniqueString>();
FacetRegistry::register_impl<AGCObject, DString>();
FacetRegistry::register_impl<APrintable, DString>();
log && log(xtag("DString.tseq", typeseq::id<DString>()));
return true;
}
bool
SetupStringtable2::register_types(obj<ACollector> gc)
{
scope log(XO_DEBUG(true));
bool ok = true;
ok &= gc.install_type(impl_for<AGCObject, DUniqueString>());
ok &= gc.install_type(impl_for<AGCObject, DString>());
return ok;
}
} /*namespace scm*/
} /*namespace xo*/
/* end SetupStringtable2.cpp */

View file

@ -4,24 +4,21 @@
**/
#include "init_stringtable2.hpp"
#include "stringtable2_register_facets.hpp"
#include "stringtable2_register_types.hpp"
#include "SetupStringtable2.hpp"
#include <xo/stringtable2/init_stringtable2.hpp>
//n#include <xo/printable2/init_printable2.hpp>
#include <xo/alloc2/CollectorTypeRegistry.hpp>
#include <xo/alloc2/init_alloc2.hpp>
namespace xo {
using xo::scm::stringtable2_register_facets;
using xo::scm::stringtable2_register_types;
using xo::scm::SetupStringtable2;
using xo::mm::CollectorTypeRegistry;
void
InitSubsys<S_stringtable2_tag>::init()
{
stringtable2_register_facets();
SetupStringtable2::register_facets();
CollectorTypeRegistry::instance().register_types(&stringtable2_register_types);
CollectorTypeRegistry::instance().register_types(&SetupStringtable2::register_types);
}
InitEvidence

View file

@ -3,6 +3,7 @@
* @author Roland Conybeare, Mar 2026
**/
#ifdef NOPE
#include "stringtable2_register_facets.hpp"
#include <xo/stringtable2/UniqueString.hpp>
@ -36,5 +37,6 @@ namespace xo {
}
} /*namespace scm*/
} /*namespace xo*/
#endif
/* end stringtable2_register_facets.cpp */

View file

@ -17,18 +17,6 @@ namespace xo {
using xo::scope;
namespace scm {
bool
stringtable2_register_types(obj<ACollector> gc)
{
scope log(XO_DEBUG(true));
bool ok = true;
ok &= gc.install_type(impl_for<AGCObject, DUniqueString>());
ok &= gc.install_type(impl_for<AGCObject, DString>());
return ok;
}
}
} /*namespace xo*/