ALib C++ Framework
by
Library Version: 2605 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
boxing_debug.cpp
1#if ALIB_DEBUG_BOXING
3
5
7 vtable->DbgProduction= productionType;
8 DbgLockMaps(true);
9 if( !vtable->IsArray() ) {
10 #if ALIB_MONOMEM
12 DbgKnownVTables.InsertUnique( std::make_pair( &vtable->Type, vtable ) );
13 #else
14 if ( DbgKnownVTables.find( &vtable->Type ) != DbgKnownVTables.end() ) {
15 ALIB_ERROR( "BOXING", "Double instantiation of VTable of Type: \"{}\"",
16 vtable->Type )
17 DbgLockMaps(false);
18 return;
19 }
20
21 DbgKnownVTables.insert(std::make_pair( &vtable->Type, vtable ) );
22 #endif
23 } else {
24 #if ALIB_MONOMEM
26 DbgKnownVTablesArray.InsertUnique(std::make_pair( &vtable->ElementType, vtable ) );
27 #else
28 if ( DbgKnownVTablesArray.find( &vtable->ElementType ) != DbgKnownVTablesArray.end() ) {
29 ALIB_ERROR( "BOXING", "Double instantiation of VTable of Type: \"{}[]\"",
30 vtable->ElementType )
31 DbgLockMaps(false);
32 return;
33 }
34
35 DbgKnownVTablesArray.insert(std::make_pair( &vtable->ElementType, vtable ) );
36 #endif
37 }
38 DbgLockMaps(false);
39}
40
41
42#if ALIB_STRINGS
43AString& RemoveNamespaces( AString& string, integer startIndex ) {
44 for( auto& search: RemovableNamespaces ) {
45 integer idx;
46 while( (idx= string.IndexOf(search, startIndex) ) >= 0 )
47 string.Delete( idx, search.Length() );
48 }
49 return string;
50}
51
52std::vector<alib::String> RemovableNamespaces
53{
54 A_CHAR( "alib::boxing::" ),
55 A_CHAR( "alib::" ),
56};
57
58void typeName( const detail::VTable* vtable, AString& result ) {
59 auto startLength= result.Length();
60 if( !vtable->IsArray() )
61 result << vtable->Type;
62 else
63 result << vtable->ElementType << "[]";
64
65 // MSC adds "class "
66 if( result.StartsWith( A_CHAR("class ") ) )
67 result.DeleteStart( 6 );
68
69 RemoveNamespaces(result, startLength);
70}
71#endif // ALIB_STRINGS
72
73
74} // namespace [alib::boxing::debug]
75
76# include "ALib.Lang.CIMethods.H"
77
78#endif // ALIB_DEBUG_BOXING
#define A_CHAR(STR)
#define ALIB_ERROR(domain,...)
#define ALIB_LOCK_RECURSIVE_WITH(lock)
TAString & DeleteStart(integer regionLength)
constexpr integer Length() const
Definition string.hpp:300
bool StartsWith(const TString &needle) const
Definition string.hpp:735
std::vector< alib::String > RemovableNamespaces
See function #".RemoveNamespaces". Pre-initialized with "alib::".
void DbgRegisterVTable(detail::VTable *vtable, detail::VTable::DbgFactoryType productionType)
AString & RemoveNamespaces(AString &string, integer startIndex)
void typeName(const detail::VTable *vtable, AString &result)
RecursiveLock GLOBAL_ALLOCATOR_LOCK
lang::integer integer
Type alias in namespace #"%alib".
Definition integers.hpp:149
strings::TAString< character, lang::HeapAllocator > AString
Type alias in namespace #"%alib".
The custom function hash.
Definition vtable.hpp:226
const std::type_info & ElementType
Definition vtable.hpp:243
DbgFactoryType DbgProduction
Debug information.
Definition vtable.hpp:271
const std::type_info & Type
Definition vtable.hpp:239