xo-alloc2: register DArena facet + subsystem init
This commit is contained in:
parent
13345f5b72
commit
19adf834ad
5 changed files with 110 additions and 7 deletions
15
include/xo/alloc2/alloc2_register_facets.hpp
Normal file
15
include/xo/alloc2/alloc2_register_facets.hpp
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
/** @file alloc2_register_facets.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Feb 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace xo {
|
||||
namespace mm {
|
||||
/** Register alloc2 (facet,impl) combinations with Facet Registry **/
|
||||
bool alloc2_register_facets();
|
||||
}
|
||||
}
|
||||
|
||||
/* end alloc2_register_facets.hpp */
|
||||
23
include/xo/alloc2/init_alloc2.hpp
Normal file
23
include/xo/alloc2/init_alloc2.hpp
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/** @file init_alloc2.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Feb 2026
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <xo/subsys/Subsystem.hpp>
|
||||
|
||||
namespace xo {
|
||||
/* tag to represent the xo-alloc2/ subsystem within ordered initialization */
|
||||
enum S_alloc2_tag {};
|
||||
|
||||
template <>
|
||||
struct InitSubsys<S_alloc2_tag> {
|
||||
static void init();
|
||||
static InitEvidence require();
|
||||
};
|
||||
|
||||
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end init_alloc2.hpp */
|
||||
|
|
@ -3,26 +3,22 @@
|
|||
set(SELF_LIB xo_alloc2)
|
||||
set(SELF_SRCS
|
||||
|
||||
# AllocError.cpp
|
||||
# AllocInfo.cpp
|
||||
# cmpresult.cpp
|
||||
init_alloc2.cpp
|
||||
alloc2_register_facets.cpp
|
||||
|
||||
AAllocator.cpp
|
||||
# ArenaConfig.cpp
|
||||
# DArena.cpp
|
||||
IAllocator_Any.cpp
|
||||
IAllocator_DArena.cpp
|
||||
|
||||
IAllocIterator_Any.cpp
|
||||
# DArenaIterator.cpp
|
||||
IAllocIterator_DArenaIterator.cpp
|
||||
|
||||
IResourceVisitor_Any.cpp
|
||||
|
||||
)
|
||||
|
||||
xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS})
|
||||
# note: deps here must also appear in cmake/xo_alloc2Config.cmake.in
|
||||
xo_dependency(${SELF_LIB} xo_arena)
|
||||
xo_dependency(${SELF_LIB} xo_facet)
|
||||
xo_dependency(${SELF_LIB} subsys)
|
||||
xo_dependency(${SELF_LIB} indentlog)
|
||||
|
|
|
|||
33
src/alloc2/alloc2_register_facets.cpp
Normal file
33
src/alloc2/alloc2_register_facets.cpp
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/** @file alloc2_register_facets.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Feb 2026
|
||||
**/
|
||||
|
||||
#include "alloc2_register_facets.hpp"
|
||||
#include <xo/alloc2/Arena.hpp>
|
||||
#include <xo/facet/FacetRegistry.hpp>
|
||||
#include <xo/indentlog/scope.hpp>
|
||||
|
||||
namespace xo {
|
||||
using xo::facet::FacetRegistry;
|
||||
//using xo::facet::TypeRegistry;
|
||||
using xo::reflect::typeseq;
|
||||
|
||||
namespace mm {
|
||||
|
||||
bool
|
||||
alloc2_register_facets()
|
||||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
FacetRegistry::register_impl<AAllocator, DArena>();
|
||||
|
||||
log && log(xtag("DArena.tseq", typeseq::id<DArena>()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end alloc2_register_facets.cpp */
|
||||
36
src/alloc2/init_alloc2.cpp
Normal file
36
src/alloc2/init_alloc2.cpp
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/** @file init_alloc2.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Feb 2026
|
||||
**/
|
||||
|
||||
#include "init_alloc2.hpp"
|
||||
#include "alloc2_register_facets.hpp"
|
||||
|
||||
namespace xo {
|
||||
using xo::mm::alloc2_register_facets;
|
||||
// using xo::mm::alloc2_register_types;
|
||||
// using xo::mm::CollectorTypeRegistry;
|
||||
|
||||
void
|
||||
InitSubsys<S_alloc2_tag>::init()
|
||||
{
|
||||
alloc2_register_facets();
|
||||
}
|
||||
|
||||
InitEvidence
|
||||
InitSubsys<S_alloc2_tag>::require()
|
||||
{
|
||||
InitEvidence retval;
|
||||
|
||||
/* direct subsystem deps for xo-alloc2/ (if/when) */
|
||||
//retval ^= InitSubsys<S_foo_tag>>::require();
|
||||
|
||||
/* xo-alloc2/'s own initialization code */
|
||||
retval ^= Subsystem::provide<S_alloc2_tag>("alloc2", &init);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end init_alloc2.cpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue