8#ifndef HPP_ALIB_BOXING_DETAIL_VTABLE
9#define HPP_ALIB_BOXING_DETAIL_VTABLE 1
11#if !defined(HPP_ALIB_BOXING_BOXING)
12# error "ALib sources with ending '.inl' must not be included from outside."
15namespace alib {
namespace boxing {
66 template<
typename TFDecl>
67 typename TFDecl::Signature
68 Get(
bool isInvocation )
const;
90 return reinterpret_cast<typename TFDecl::Signature
>(
getCustom(
typeid(TFDecl)
ALIB_DBG(, isInvocation ) ) );
104 template<
typename TFDecl>
105 void Set(
typename TFDecl::Signature implementation );
126 Set(
typename TFDecl::Signature impl )
128 return setCustom(
typeid(TFDecl),
reinterpret_cast<void*
>( impl ) );
135#if (ALIB_MONOMEM && ALIB_DEBUG) || DOXYGEN
157 ALIB_DBG( ,
bool isInvocation ))
const;
250 const std::type_info& elementType,
252 unsigned int placeholderUsage )
347template<
typename TPlainOrArray,
typename TMapped>
349 ,
public Singleton< VTableTT<TPlainOrArray, TMapped> >
363 : typeid(TMapped[1]),
380 #if ALIB_DEBUG_BOXING
387#if ALIB_DEBUG_BOXING || DOXYGEN
434template<
typename TMapping>
460#define ALIB_BOXING_VTABLE_DECLARE( TMapped, Identifier ) \
461namespace alib::boxing::detail { \
462extern ALIB_API VTable SNGLTN_ ## Identifier; \
463template<> struct T_VTableFactory< TMappedTo<TMapped> > \
464{ static constexpr VTable* Get() { return &SNGLTN_ ## Identifier; } }; } \
466#define ALIB_BOXING_VTABLE_DECLARE_ARRAYTYPE( TMapped, Identifier ) \
467namespace alib::boxing::detail { \
468extern ALIB_API VTable SNGLTN_ ## Identifier; \
469template<> struct T_VTableFactory< TMappedToArrayOf<TMapped> > \
470{ static constexpr VTable* Get() { return &SNGLTN_ ## Identifier; } }; } \
473#define ALIB_BOXING_VTABLE_DEFINE( TMapped, Identifier ) \
474alib::boxing::detail::VTable alib::boxing::detail::SNGLTN_ ## Identifier \
475( typeid(TMapped), typeid(void) , \
476 std::is_pointer<TMapped>::value \
477 ? VTable::MappingType::Pointer \
478 : std::is_enum<TMapped>::value \
479 ? VTable::MappingType::Enum \
480 : VTable::MappingType::Value , \
481 alib::boxing::T_SizeInPlaceholder<TMapped>::value); \
483#define ALIB_BOXING_VTABLE_DEFINE_ARRAYTYPE( TMapped, Identifier ) \
484alib::boxing::detail::VTable alib::boxing::detail::SNGLTN_ ## Identifier \
485(typeid(TMapped[1]) , typeid(TMapped), VTable::MappingType(sizeof(TMapped)), sizeof(Placeholder)); \
489# define ALIB_BOXING_BOOTSTRAP_VTABLE_DBG_REGISTER( Identifier ) \
490DbgRegisterVTable( &alib::boxing::detail::SNGLTN_ ## Identifier, \
491 alib::boxing::detail::VTable::DbgFactoryType::Static );
493# define ALIB_BOXING_BOOTSTRAP_VTABLE_DBG_REGISTER( Identifier )
static TDerivedClass & GetSingleton()
#define ATMP_VOID_IF(Cond)
#define ATMP_EQ( T, TEqual)
#define IF_ALIB_STRINGS(...)
#define IF_ALIB_MONOMEM(...)
#define ATMP_T_IF(T, Cond)
ALIB_API void DbgCheckRegistration(detail::VTable *vtable, bool increaseUsageCounter)
ALIB_API void DbgCheckIsInitialized()
void DbgRegisterVTable(detail::VTable *vtable, detail::VTable::DbgFactoryType productionType)
FunctionTable DEFAULT_FUNCTIONS
The default box-functions set.
boxing::FIsLess FIsLess
Type alias in namespace alib.
boxing::FAppend< TChar, TAllocator > FAppend
Type alias in namespace alib.
lang::uinteger uinteger
Type alias in namespace alib.
boxing::FClone FClone
Type alias in namespace alib.
boxing::FIsNotNull FIsNotNull
Type alias in namespace alib.
boxing::FEquals FEquals
Type alias in namespace alib.
boxing::FIsTrue FIsTrue
Type alias in namespace alib.
boxing::FHashcode FHashcode
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
void(*)(const Box &self, strings::TAString< TChar, TAllocator > &target) Signature
uinteger DbgCntInvocationsFHashcode
Debug-compilation counter for the number of invocations.
uinteger DbgCntInvocationsFIsNotNull
Debug-compilation counter for the number of invocations.
FAppend< character, lang::HeapAllocator >::Signature fAppend
Entry for built-in function FAppend<character>.
FIsLess::Signature fIsLess
Entry for built-in function FIsLess.
TFDecl::Signature Get(bool isInvocation) const
ALIB_API void * getCustom(const std::type_info &rtti, bool isInvocation) const
uinteger DbgCntInvocationsFIsLess
Debug-compilation counter for the number of invocations.
uinteger DbgCntInvocationsFClone
Debug-compilation counter for the number of invocations.
void Set(typename TFDecl::Signature implementation)
uinteger DbgCntInvocationsFAppend
Debug-compilation counter for the number of invocations.
uinteger DbgCntInvocationsFIsTrue
Debug-compilation counter for the number of invocations.
ALIB_API void setCustom(const std::type_info &rtti, void *implementation)
uinteger DbgCntInvocationsFEquals
Debug-compilation counter for the number of invocations.
FClone::Signature fClone
Entry for built-in function FClone.
FHashcode::Signature fHashcode
Entry for built-in function FHashcode.
FIsTrue::Signature fIsTrue
Entry for built-in function FIsTrue.
static ALIB_API void Shutdown()
Needs to be called only in debug versions to shut down internal hashtables cleanly.
FEquals::Signature fEquals
Entry for built-in function FEquals.
FIsNotNull::Signature fIsNotNull
Entry for built-in function FIsNotNull.
static constexpr VTable * Get()
VTable(const std::type_info &type, const std::type_info &elementType, MappingType mapping, unsigned int placeholderUsage)
FunctionTable Functions
Box-functions attached with BootstrapRegister.
DbgFactoryType DbgProduction
Debug information.
const std::type_info & Type
@ Static
A static VTable is in place.
@ Unregistered
Not registered, yet.
@ Dynamic
The VTable is created dynamically from templated type VTableTT.
const unsigned int PlaceholderUsage
const MappingType Mapping
const std::type_info & ElementType