59 template<
typename TFDecl>
60 typename TFDecl::Signature
61 Get(
bool isInvocation )
const;
72 template<
typename TFDecl>
requires std::same_as<TFDecl, FAppend<character,lang::HeapAllocator>>
76 template<
typename TFDecl>
requires ( !std::same_as<TFDecl, FHashcode >
77 && !std::same_as<TFDecl, FIsNotNull>
78 && !std::same_as<TFDecl, FEquals >
79 && !std::same_as<TFDecl, FIsLess >
80 && !std::same_as<TFDecl, FIsTrue >
82 && !std::same_as<TFDecl, FClone >
85 && !std::same_as<TFDecl, FAppend<character,lang::HeapAllocator>>
87 )
typename TFDecl::Signature
Get(
ALIB_DBG(
bool isInvocation ))
const {
88return reinterpret_cast<typename TFDecl::Signature
>(
getCustom(
typeid(TFDecl)
ALIB_DBG(, isInvocation ) ) );
102 template<
typename TFDecl>
103 void Set(
typename TFDecl::Signature implementation );
105 template<
typename TFDecl>
requires std::same_as<TFDecl, FHashcode >
void Set( FHashcode ::Signature impl) {
fHashcode = impl; }
107 template<
typename TFDecl>
requires std::same_as<TFDecl, FEquals >
void Set( FEquals ::Signature impl) {
fEquals = impl; }
108 template<
typename TFDecl>
requires std::same_as<TFDecl, FIsLess >
void Set( FIsLess ::Signature impl) {
fIsLess = impl; }
109 template<
typename TFDecl>
requires std::same_as<TFDecl, FIsTrue >
void Set( FIsTrue ::Signature impl) {
fIsTrue = impl; }
111 template<
typename TFDecl>
requires std::same_as<TFDecl, FClone >
void Set( FClone ::Signature impl) {
fClone = impl; }
114 template<
typename TFDecl>
requires std::same_as<TFDecl,
116 ::Signature impl) {
fAppend = impl; }
119 template<
typename TFDecl>
requires ( !std::same_as<TFDecl, FHashcode >
120 && !std::same_as<TFDecl, FIsNotNull>
121 && !std::same_as<TFDecl, FEquals >
122 && !std::same_as<TFDecl, FIsLess >
123 && !std::same_as<TFDecl, FIsTrue >
125 && !std::same_as<TFDecl, FClone >
128 && !std::same_as<TFDecl, FAppend<character,lang::HeapAllocator> >
131 void Set(
typename TFDecl::Signature impl )
132 {
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)
191ALIB_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;
292 const std::type_info& elementType,
294 unsigned int placeholderUsage )
367template<
typename TMapped,
bool TIsArray>
369 ,
public Singleton< VTableUnoptimized<TMapped, TIsArray> >
382 :
VTable( !TIsArray ? typeid(TMapped)
383 : typeid(TMapped[1]),
385 !TIsArray ? typeid(void)
389 : std::is_pointer_v<TMapped>
391 : std::is_enum_v<TMapped>
397 #if ALIB_DEBUG_BOXING
404#if ALIB_DEBUG_BOXING || DOXYGEN
458template<
typename TMapped,
bool TIsArray>
472#if ALIB_DEBUG && !DOXYGEN
474# if ALIB_MONOMEM && ALIB_CONTAINERS
479 extern std::unordered_set< lang::TypeFunctors::Key, lang::TypeFunctors::Hash, lang::TypeFunctors::EqualTo> DbgKnownCustomFunctions;
480 extern std::unordered_map< lang::TypeFunctors::Key, detail::VTable*, lang::TypeFunctors::Hash, lang::TypeFunctors::EqualTo> DbgKnownVTables;
481 extern std::unordered_map< lang::TypeFunctors::Key, detail::VTable*, lang::TypeFunctors::Hash, lang::TypeFunctors::EqualTo> DbgKnownVTablesArray;
483extern ALIB_DLL void DbgLockMaps(
bool doLock );
491DOX_MARKER([DOX_BOXING_OPTIMIZE_DECLARE_2])
493DOX_MARKER([DOX_BOXING_OPTIMIZE_DECLARE_2])
#define ALIB_BOXING_VTABLE_DECLARE_ARRAYTYPE(TMapped, Identifier)
constexpr VTableUnoptimized()
static T & GetSingleton()
void DbgCheckIsInitialized()
void DbgRegisterVTable(detail::VTable *vtable, detail::VTable::DbgFactoryType productionType)
void DbgCheckRegistration(detail::VTable *vtable, bool increaseUsageCounter)
This namespace implements internals of namespace #"alib::boxing;2".
FunctionTable DEFAULT_FUNCTIONS
The default box-functions set.
constexpr unsigned 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
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator
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".
lang::uinteger uinteger
Type alias in namespace #"%alib".
boxing::FAppend< TChar, TAllocator > FAppend
Type alias in namespace #"%alib".
bool(*)(const Box &self) Signature
static constexpr detail::VTable * Get()
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".
FAppend< character, lang::HeapAllocator > ::Signature fAppend
< Entry for built-in function #"FAppend".
uinteger DbgCntInvocationsFIsLess
Debug-compilation counter for the number of invocations.
FIsTrue::Signature fIsTrue
Entry for built-in function #"FIsTrue".
FIsLess::Signature fIsLess
Entry for built-in function #"FIsLess".
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 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