x-stringtable2: streamline setup
This commit is contained in:
parent
d4c7f26c73
commit
263aa16cfb
8 changed files with 88 additions and 24 deletions
25
include/xo/stringtable2/SetupStringtable2.hpp
Normal file
25
include/xo/stringtable2/SetupStringtable2.hpp
Normal 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 */
|
||||||
|
|
@ -7,8 +7,6 @@
|
||||||
|
|
||||||
namespace xo {
|
namespace xo {
|
||||||
namespace scm {
|
namespace scm {
|
||||||
/** Register object2 (facet,impl) combinations with FacetRegistry **/
|
|
||||||
bool stringtable2_register_facets();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,6 @@
|
||||||
|
|
||||||
namespace xo {
|
namespace xo {
|
||||||
namespace scm {
|
namespace scm {
|
||||||
/** Register stringtable2 (facet,impl) combinations with FacetRegistry **/
|
|
||||||
bool stringtable2_register_types(obj<xo::mm::ACollector> gc);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@
|
||||||
set(SELF_LIB xo_stringtable2)
|
set(SELF_LIB xo_stringtable2)
|
||||||
set(SELF_SRCS
|
set(SELF_SRCS
|
||||||
init_stringtable2.cpp
|
init_stringtable2.cpp
|
||||||
stringtable2_register_facets.cpp
|
SetupStringtable2.cpp
|
||||||
|
#stringtable2_register_facets.cpp
|
||||||
stringtable2_register_types.cpp
|
stringtable2_register_types.cpp
|
||||||
|
|
||||||
StringTable.cpp
|
StringTable.cpp
|
||||||
|
|
|
||||||
55
src/stringtable2/SetupStringtable2.cpp
Normal file
55
src/stringtable2/SetupStringtable2.cpp
Normal 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 */
|
||||||
|
|
@ -4,24 +4,21 @@
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include "init_stringtable2.hpp"
|
#include "init_stringtable2.hpp"
|
||||||
#include "stringtable2_register_facets.hpp"
|
#include "SetupStringtable2.hpp"
|
||||||
#include "stringtable2_register_types.hpp"
|
|
||||||
#include <xo/stringtable2/init_stringtable2.hpp>
|
#include <xo/stringtable2/init_stringtable2.hpp>
|
||||||
//n#include <xo/printable2/init_printable2.hpp>
|
|
||||||
#include <xo/alloc2/CollectorTypeRegistry.hpp>
|
#include <xo/alloc2/CollectorTypeRegistry.hpp>
|
||||||
#include <xo/alloc2/init_alloc2.hpp>
|
#include <xo/alloc2/init_alloc2.hpp>
|
||||||
|
|
||||||
namespace xo {
|
namespace xo {
|
||||||
using xo::scm::stringtable2_register_facets;
|
using xo::scm::SetupStringtable2;
|
||||||
using xo::scm::stringtable2_register_types;
|
|
||||||
using xo::mm::CollectorTypeRegistry;
|
using xo::mm::CollectorTypeRegistry;
|
||||||
|
|
||||||
void
|
void
|
||||||
InitSubsys<S_stringtable2_tag>::init()
|
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
|
InitEvidence
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
* @author Roland Conybeare, Mar 2026
|
* @author Roland Conybeare, Mar 2026
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
#ifdef NOPE
|
||||||
#include "stringtable2_register_facets.hpp"
|
#include "stringtable2_register_facets.hpp"
|
||||||
|
|
||||||
#include <xo/stringtable2/UniqueString.hpp>
|
#include <xo/stringtable2/UniqueString.hpp>
|
||||||
|
|
@ -36,5 +37,6 @@ namespace xo {
|
||||||
}
|
}
|
||||||
} /*namespace scm*/
|
} /*namespace scm*/
|
||||||
} /*namespace xo*/
|
} /*namespace xo*/
|
||||||
|
#endif
|
||||||
|
|
||||||
/* end stringtable2_register_facets.cpp */
|
/* end stringtable2_register_facets.cpp */
|
||||||
|
|
|
||||||
|
|
@ -17,18 +17,6 @@ namespace xo {
|
||||||
using xo::scope;
|
using xo::scope;
|
||||||
|
|
||||||
namespace scm {
|
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*/
|
} /*namespace xo*/
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue