8#if !defined(ALIB_C20_MODULES) || ((ALIB_C20_MODULES != 0) && (ALIB_C20_MODULES != 1))
9# error "Symbol ALIB_C20_MODULES has to be given to the compiler as either 0 or 1"
27# if ALIB_DEBUG_CONTAINERS
35# if ALIB_DEBUG_CONTAINERS
52 bool srcIsUnboxableStringType,
53 bool isValueTypeCustomized,
54 bool isPointerTypeCustomized,
55 bool fitsToPlaceholder,
56 bool copyConstructible,
57 bool triviallyDestructible,
70 target << indent <<
"Mapped Type: ";
typeName(vtable, target ); target <<
" (Enumeration)" <<
NEW_LINE;
71 target << indent <<
"Customized: Not customizable (always boxed as enum value type)" <<
NEW_LINE;
77 bool arrayBoxing = vtable->
IsArray();
78 bool srcIsValue = !srcIsPointer;
80 target << indent <<
"Mapped Type: ";
typeName(vtable, target ); target <<
NEW_LINE;
82 target <<indent <<
"Customized T: " << isValueTypeCustomized <<
NEW_LINE;
83 target <<indent <<
"Customized T*: " << isPointerTypeCustomized <<
NEW_LINE;
84 target <<indent <<
"Is Unboxable: "
86 ? ( srcIsValue && valueBoxing && isValueTypeCustomized
87 ?
"Yes (By customization)"
89 : srcIsValue && valueBoxing && !isValueTypeCustomized
90 ?
"Yes (Value fits in placeholder and is copy-constructible)"
92 : srcIsPointer && pointerBoxing && isPointerTypeCustomized
93 ?
"Yes (By customization)"
95 : srcIsPointer && pointerBoxing && !isPointerTypeCustomized && (!copyConstructible || !triviallyDestructible)
96 ?
"Yes (Value would not be copy-constructible or trivially destructible)"
98 : srcIsPointer && pointerBoxing && !isPointerTypeCustomized && !fitsToPlaceholder
99 ?
"Yes (Value would not fit to placeholder)"
101 : srcIsValue && arrayBoxing && isValueTypeCustomized
102 ?
"Yes (Custom unboxing from array type)"
104 : srcIsValue && arrayBoxing && isPointerTypeCustomized
105 ?
"Yes (Unboxing from array type, customized with pointer type)"
107 : srcIsPointer && arrayBoxing && isPointerTypeCustomized
108 ?
"Yes (Custom unboxing from array type)"
110 : srcIsPointer && arrayBoxing && isValueTypeCustomized
111 ?
"Yes (Unboxing from array type, customized with value type)"
113 : srcIsUnboxableStringType
114 ?
"Yes (Unboxing from character array type)"
116 :
"INTERNAL ERROR IN DBG METHDO: CASE NOT MATCHED (E1)"
119 srcIsValue && isValueTypeCustomized
120 ?
"Forbidden (By customization)"
122 : srcIsValue && pointerBoxing && isPointerTypeCustomized
123 ?
"Not as value (Pointer type is customized)"
125 : srcIsValue && pointerBoxing && !isPointerTypeCustomized && (!copyConstructible || !triviallyDestructible)
126 ?
"Not as value (Not copy-constructible or trivially destructible)"
128 : srcIsValue && pointerBoxing && !isPointerTypeCustomized && !fitsToPlaceholder
129 ?
"Not as value (Does not fit to placeholder)"
131 : srcIsPointer && isPointerTypeCustomized
132 ?
"Forbidden (By customization)"
134 : srcIsPointer && valueBoxing && isValueTypeCustomized
135 ?
"Not as pointer (Value type is customized)"
137 : srcIsPointer && valueBoxing && !isValueTypeCustomized
138 ?
"Not as pointer (Value fits in placeholder and is copy-constructible and trivially destructible)"
141 ?
"Arrays cannot be unboxed"
144 ?
"No (String type is not marked for implicit construction from character array type)"
146 :
"INTERNAL ERROR IN DBG METHOd: CASE NOT MATCHED (E2)"
152 ?
"STATIC VTABLE NOT REGISTERED"
154 ?
"Dynamic Singleton"
155 :
"Static Singleton (Specialized VTableOptimizationTraits)"
162 "An internal error occurred while describing type. Description follows:\n"
166 "An warning occurred while describing type. Description follows:\n"
171 String256 headline; headline <<
'\n' << indent <<
"Associated Specialized Functions:";
172 String256 indent2; indent2 << indent << indent;
173 dumpFunctions( functions, target, headline, indent2, tmpStrings );
192 for(
int theSakeOfAutoTabs= 0 ; theSakeOfAutoTabs < 2 ; ++theSakeOfAutoTabs )
195 dumpFunctions( input, result, headline, indent, tmpStrings );
201void dumpFunctions(
const std::vector<std::pair<const std::type_info*,uinteger>>& input,
209 for(
auto& type : input )
212 std::sort( tmpStrings.begin(), tmpStrings.end(),
213 [] (std::tuple<String, uinteger>& a,
214 std::tuple<String, uinteger>& b )
216 return std::get<0>(a).template CompareTo<CHK, lang::Case::Ignore>( std::get<0>(b) ) < 0;
224 auto& args= formatter.Reset();
225 args.Add( indent,
"{} {!ATab5}{:>2})\n",
nullptr,
'(',
nullptr );
226 for(
auto& nameAndUse : tmpStrings )
228 args[2]= std::get<0>(nameAndUse);
229 args[4]= std::get<1>(nameAndUse) != (std::numeric_limits<uinteger>::max)()
230 ?
Box( std::get<1>(nameAndUse) )
231 :
Box(
"No default implementation" );
232 formatter.FormatArgs( output, args );
247 for(
int theSakeOfAutoTabs= 0 ; theSakeOfAutoTabs < 2 ; ++theSakeOfAutoTabs )
252 dumpVTables( result, vtableNames, staticVtables , includeFunctions );
262 bool includeFunctions )
265 result << ( staticVtables ?
A_CHAR(
"Mapped types with static VTables")
266 :
A_CHAR(
"Mapped types with dynamic VTables") );
267 if( includeFunctions )
268 result <<
A_CHAR(
" and their associated specialized functions");
276 for(
int i= 0 ; i < 2; ++i )
277 for(
auto& it : ( i == 0 ? DbgKnownVTables : DbgKnownVTablesArray) )
289 temp <<
" ATTENTION: Unregistered customized VTable!!! This is an Error";
291 vtableNames.
Add( temp, it.second );
296 std::sort( vtableNames.begin(), vtableNames.end(),
301 Substring lhs= std::get<0>(a); lhs.TrimStart().ConsumeToken(
' '); lhs.TrimStart();
302 Substring rhs= std::get<0>(b); rhs.TrimStart().ConsumeToken(
' '); rhs.TrimStart();
303 return lhs.CompareTo<CHK, lang::Case::Ignore>( rhs ) < 0;
309 std::vector<std::pair<const std::type_info*,uinteger>> tempFunctions;
310 for(
auto& vtable: vtableNames )
312 result << std::get<0>(vtable) <<
NEW_LINE;
313 if( includeFunctions )
332 for(
int theSakeOfAutoTabs= 0 ; theSakeOfAutoTabs < 2 ; ++theSakeOfAutoTabs )
343 (result <<
"Known Function Declarators And Usage Of Default Implementation:"
347 #if ALIB_DEBUG_CONTAINERS
348 (result <<
NEW_LINE <<
"Metrics Of Custom Function Implementation HashMap: "
358#if ALIB_DEBUG_CONTAINERS
ALIB_DLL void Reset(Snapshot snapshot=Snapshot())
integer IndexOf(TChar needle, integer startIdx=0) const
constexpr bool IsNotEmpty() const
#define ALIB_ASSERT_WARNING(cond, domain,...)
#define ALIB_LOCK_RECURSIVE_WITH(lock)
#define ALIB_ASSERT_ERROR(cond, domain,...)
void dumpVTables(AString &result, DbgStringTable< const detail::VTable * > &vtableNames, bool staticVtables, bool includeFunctions)
ALIB_DLL std::vector< std::pair< const std::type_info *, uinteger > > GetKnownFunctionTypes()
AString & removeNamespaces(AString &string, integer startIndex)
void typeName(const detail::VTable *vtable, AString &result)
AString DumpFunctions(const std::vector< std::pair< const std::type_info *, uinteger > > &input, const String &headline, const String &indent)
void typeInfo(AString &target, const detail::VTable *vtable, const String &indent, bool srcIsPointer, bool srcIsStringType, bool srcIsUnboxableStringType, bool isValueTypeCustomized, bool isPointerTypeCustomized, bool fitsToPlaceholder, bool copyConstructible, bool triviallyDestructible, bool isUnboxable)
AString DumpVTables(bool staticVtables, bool includeFunctions)
void dumpFunctions(const std::vector< std::pair< const std::type_info *, uinteger > > &input, AString &output, const String &headline, const String &indent, DbgStringTable< uinteger > &tmpStrings)
ALIB_DLL void getFunctionTypes(const detail::FunctionTable &input, std::vector< std::pair< const std::type_info *, uinteger > > &output)
std::vector< std::pair< const std::type_info *, uinteger > > GetSpecificFunctionTypes(const detail::VTable *vtable)
void DumpCustomFunctionHashMapMetrics(AString &target, bool detailedBucketList)
AString DbgDumpDistribution(const THashtable &hashtable, bool detailedBucketList)
@ Left
Chooses left alignment.
monomem::TLocalAllocator< 8 > LocalAllocator8K
Type alias in namespace alib. Allocates 8kB of stack memory.
LocalString< 512 > String512
Type alias name for TLocalString<character,512>.
constexpr String NULL_STRING
A nulled string of the default character type.
LocalString< 256 > String256
Type alias name for TLocalString<character,256>.
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace alib.
LocalString< 64 > String64
Type alias name for TLocalString<character,64>.
constexpr CString NEW_LINE
A zero-terminated string containing the new-line character sequence.
strings::TField< character > Field
Type alias in namespace alib.
format::Formatter Formatter
Type alias in namespace alib.
boxing::Box Box
Type alias in namespace alib.
LocalString< 1024 > String1K
Type alias name for TLocalString<character,1024>.
strings::TString< character > String
Type alias in namespace alib.
std::tuple< String, TAssociatedTypes... > ElementType
Shortcut to the std::tuple-type that instantiations of this template class store.
String & Add(const String &src, TArgs &&... args)
The custom function hash.
DbgFactoryType DbgProduction
Debug information.
const MappingType Mapping
@ Static
A static VTable is in place.
@ Unregistered
Not registered, yet.