60 template<
typename TFDecl>
61 typename TFDecl::Signature
62 Get(
bool isInvocation )
const;
73 template<
typename TFDecl>
requires std::same_as<TFDecl, FAppend<character,lang::HeapAllocator>>
77 template<
typename TFDecl>
requires ( !std::same_as<TFDecl, FHashcode >
78 && !std::same_as<TFDecl, FIsNotNull>
79 && !std::same_as<TFDecl, FEquals >
80 && !std::same_as<TFDecl, FIsLess >
81 && !std::same_as<TFDecl, FIsTrue >
83 && !std::same_as<TFDecl, FClone >
86 && !std::same_as<TFDecl, FAppend<character,lang::HeapAllocator>>
88 )
typename TFDecl::Signature
Get(
ALIB_DBG(
bool isInvocation ))
const {
89 return reinterpret_cast<typename TFDecl::Signature
>(
getCustom(
typeid(TFDecl)
ALIB_DBG(, isInvocation ) ) );
103 template<
typename TFDecl>
104 void Set(
typename TFDecl::Signature implementation );
106 template<
typename TFDecl>
requires std::same_as<TFDecl, FHashcode >
void Set( FHashcode ::Signature impl) {
fHashcode = impl; }
108 template<
typename TFDecl>
requires std::same_as<TFDecl, FEquals >
void Set( FEquals ::Signature impl) {
fEquals = impl; }
109 template<
typename TFDecl>
requires std::same_as<TFDecl, FIsLess >
void Set( FIsLess ::Signature impl) {
fIsLess = impl; }
110 template<
typename TFDecl>
requires std::same_as<TFDecl, FIsTrue >
void Set( FIsTrue ::Signature impl) {
fIsTrue = impl; }
112 template<
typename TFDecl>
requires std::same_as<TFDecl, FClone >
void Set( FClone ::Signature impl) {
fClone = impl; }
115 template<
typename TFDecl>
requires std::same_as<TFDecl,
117 ::Signature impl) {
fAppend = impl; }
120 template<
typename TFDecl>
requires ( !std::same_as<TFDecl, FHashcode >
121 && !std::same_as<TFDecl, FIsNotNull>
122 && !std::same_as<TFDecl, FEquals >
123 && !std::same_as<TFDecl, FIsLess >
124 && !std::same_as<TFDecl, FIsTrue >
126 && !std::same_as<TFDecl, FClone >
129 && !std::same_as<TFDecl, FAppend<character,lang::HeapAllocator> >
132 void Set(
typename TFDecl::Signature impl ) {
return setCustom(
typeid(TFDecl),
reinterpret_cast<void*
>( impl ) ); }
138#if (ALIB_MONOMEM && ALIB_CONTAINERS && ALIB_DEBUG) || DOXYGEN
160 ALIB_DBG( ,
bool isInvocation ))
const;
179struct CustomFunctionKey {
180 const FunctionTable* Parent;
181 const std::type_info&
Type;
182 CustomFunctionKey(
const FunctionTable* parent,
const std::type_info& type )
183 : Parent(parent),
Type (type ) {}
186struct CustomFunctionMapped {
187 void* Implementation;
188 ALIB_DBG(uinteger DbgCntInvocations; )
190 CustomFunctionMapped(
void* implementation ): Implementation (implementation)
191 ALIB_DBG(,DbgCntInvocations (0 ) ) {}
194struct CustomFunctionHash {
195 std::size_t operator()(
const CustomFunctionKey& key)
const {
196 size_t result=
reinterpret_cast<size_t>(key.Parent)
197 ^ key.Type.hash_code();
198 result^= (result << 21 );
199 result^= (result >> 11);
203struct CustomFunctionEqualTo {
204 bool operator()(
const CustomFunctionKey& lhs,
const CustomFunctionKey& rhs)
const {
205 return lhs.Parent == rhs.Parent
206 && lhs.Type == rhs.Type;
209#if ALIB_MONOMEM && ALIB_CONTAINERS
211 CustomFunctionKey, CustomFunctionMapped,
213 CustomFunctionEqualTo > customFunctionMap;
215extern std::unordered_map< CustomFunctionKey, CustomFunctionMapped,
217 CustomFunctionEqualTo > customFunctionMap;
296 const std::type_info& elementType,
298 unsigned int placeholderUsage )
382template<
typename TMapped,
bool TIsArray>
384 ,
public Singleton< VTableUnoptimized<TMapped, TIsArray> >
397 :
VTable( !TIsArray ? typeid(TMapped)
398 : typeid(TMapped[1]),
400 !TIsArray ? typeid(void)
404 : std::is_pointer_v<TMapped>
406 : std::is_enum_v<TMapped>
412 #if ALIB_DEBUG_BOXING
419#if ALIB_DEBUG_BOXING || DOXYGEN
473template<
typename TMapped,
bool TIsArray>
488#if ALIB_DEBUG && !DOXYGEN
490# if ALIB_MONOMEM && ALIB_CONTAINERS
495 extern std::unordered_set< lang::TypeFunctors::Key, lang::TypeFunctors::Hash, lang::TypeFunctors::EqualTo> DbgKnownCustomFunctions;
496 extern std::unordered_map< lang::TypeFunctors::Key, detail::VTable*, lang::TypeFunctors::Hash, lang::TypeFunctors::EqualTo> DbgKnownVTables;
497 extern std::unordered_map< lang::TypeFunctors::Key, detail::VTable*, lang::TypeFunctors::Hash, lang::TypeFunctors::EqualTo> DbgKnownVTablesArray;
499 extern ALIB_DLL void DbgLockMaps(
bool doLock );
507DOX_MARKER([DOX_BOXING_OPTIMIZE_DECLARE_2])
509DOX_MARKER([DOX_BOXING_OPTIMIZE_DECLARE_2])
constexpr VTableUnoptimized()
static T & GetSingleton()
#define ALIB_BOXING_VTABLE_DECLARE_ARRAYTYPE(TMapped, Identifier)
ALIB_DLL void DbgCheckIsInitialized()
void DbgRegisterVTable(detail::VTable *vtable, detail::VTable::DbgFactoryType productionType)
ALIB_DLL void DbgCheckRegistration(detail::VTable *vtable, bool increaseUsageCounter)
This namespace implements internals of namespace alib::boxing.
FunctionTable DEFAULT_FUNCTIONS
The default box-functions set.
constexpr unsigned int SizeTraits
std::conditional_t< ArrayTraits< T, nchar >::Access !=Policy::NONE, nchar, std::conditional_t< ArrayTraits< T, wchar >::Access !=Policy::NONE, wchar, std::conditional_t< ArrayTraits< T, xchar >::Access !=Policy::NONE, xchar, void > > > Type
containers::HashSet< TAllocator, T, THash, TEqual, THashCaching, TRecycling > HashSet
Type alias in namespace alib. See type definition alib::containers::HashSet.
singletons::Singleton< T > Singleton
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
containers::HashMap< TAllocator, TKey, TMapped, THash, TEqual, THashCaching, TRecycling > HashMap
Type alias in namespace alib.
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator
lang::uinteger uinteger
Type alias in namespace alib.
boxing::FAppend< TChar, TAllocator > FAppend
Type alias in namespace alib.
void(*)(const Box &self, strings::TAString< TChar, TAllocator > &target) Signature
bool(*)(const Box &self) Signature
static constexpr detail::VTable * Get()
ALIB_DLL void setCustom(const std::type_info &rtti, void *implementation)
uinteger DbgCntInvocationsFHashcode
Debug-compilation counter for the number of invocations.
uinteger DbgCntInvocationsFIsTrue
Debug-compilation counter for the number of invocations.
void Set(typename TFDecl::Signature implementation)
TFDecl::Signature Get(bool isInvocation) const
FIsNotNull::Signature fIsNotNull
Entry for built-in function FIsNotNull.
uinteger DbgCntInvocationsFIsLess
Debug-compilation counter for the number of invocations.
FIsTrue::Signature fIsTrue
Entry for built-in function FIsTrue.
FAppend< character, lang::HeapAllocator >::Signature fAppend
Entry for built-in function FAppend.
FIsLess::Signature fIsLess
Entry for built-in function FIsLess.
ALIB_DLL void * getCustom(const std::type_info &rtti, bool isInvocation) const
FEquals::Signature fEquals
Entry for built-in function FEquals.
uinteger DbgCntInvocationsFIsNotNull
Debug-compilation counter for the number of invocations.
uinteger DbgCntInvocationsFEquals
Debug-compilation counter for the number of invocations.
FClone::Signature fClone
Entry for built-in function FClone.
uinteger DbgCntInvocationsFClone
Debug-compilation counter for the number of invocations.
uinteger DbgCntInvocationsFAppend
Debug-compilation counter for the number of invocations.
FHashcode::Signature fHashcode
Entry for built-in function FHashcode.
static ALIB_DLL void Shutdown()
Needs to be called only in debug versions to shut down internal hashtables cleanly.
The custom function hash.
FunctionTable Functions
Box-functions attached with BootstrapRegister.
const unsigned int PlaceholderUsage
const std::type_info & ElementType
VTable(const std::type_info &type, const std::type_info &elementType, MappingType mapping, unsigned int placeholderUsage)
DbgFactoryType DbgProduction
Debug information.
const MappingType Mapping
@ Static
A static VTable is in place.
@ Unregistered
Not registered, yet.
const std::type_info & Type