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"
19 module ALib.ALox.Impl;
23 import ALib.EnumRecords;
24 import ALib.EnumRecords.Bootstrap;
25 import ALib.Variables;
27 import ALib.Camp.Base;
60template<
typename T>
void write(
const T& val,
NAString& target ) { target._(val); }
62template<
typename T>
void write( T* val,
NAString& target ) {
64 if( std::is_same<T, Box*>::value ) {
67 integer actLen= buffer.Length();
75 target._(*
static_cast<Box*
>(val));
84 integer methodEnd= fileNameEnd >= 0 ? key.IndexOf(
'#', fileNameEnd + 1) : -1;
88 else if ( fileNameEnd >= 0 )
targetBuffer._<NC>(
"FileName [" );
94 if ( methodEnd >= 0 ) {
95 targetBuffer.ReplaceSubstring<NC>(
" @", targetStart + fileNameEnd +1, 2 );
99 if ( fileNameEnd >= 0 )
100 targetBuffer.ReplaceSubstring<NC>(
".*", targetStart + fileNameEnd, 1);
109#if !ALIB_SINGLE_THREADED
113 return targetBuffer._(
"[Thread=\"")._( it->second )._(
"\"]");
115 return targetBuffer._(
"[ThreadID=")._( threadID )._(
']');
121 for (
auto& it : map ) {
126 if ( it.first.template Equals<NC>(
noKey ) )
127 keyString._<NC>(
"<global>" );
129 keyString._<NC>(
'"' )._( it.first )._(
'"' );
148 bool firstEntry=
true;
149 if ( store->globalStore && store->globalStore->Size() > 0) {
150 cnt+= int( store->globalStore->Size() );
156#if !ALIB_SINGLE_THREADED
157 for (
auto thread= store->threadStore.begin() ; thread != store->threadStore.end() ; ++thread ) {
158 if ( thread->first.first==
false )
160 if( firstEntry ) firstEntry=
false;
else targetBuffer.NewLine();
162 cnt+= int( thread->second->Size() );
168 StringTreeIterator<typename ScopeStore<T, false>::TLanguageStore> iterator;
169 typename decltype(iterator)::NameSorter sorter;
170 iterator.SetSorting(&sorter);
176 if( *iterator.Node() ==
nullptr )
178 cnt+= int( (*iterator.Node())->Size() );
179 if( firstEntry ) firstEntry=
false;
else targetBuffer.NewLine();
185#if !ALIB_SINGLE_THREADED
186 for (
auto thread= store->threadStore.begin() ; thread != store->threadStore.end() ; ++thread ) {
187 if ( thread->first.first ==
true )
189 if( firstEntry ) firstEntry=
false;
else targetBuffer.NewLine();
191 cnt+= int( thread->second->Size() );
203 if ( store->globalStore !=
nullptr ) {
211#if !ALIB_SINGLE_THREADED
212 for (
auto thread= store->threadStore.begin() ; thread != store->threadStore.end() ; ++thread )
213 if( thread->first.first ==
false )
214 for (
auto& it : thread->second ) {
219 ._<NC>(
"Scope::ThreadOuter " );
226 StringTreeIterator<typename ScopeStore<T, true>::TLanguageStore> iterator;
227 typename decltype(iterator)::NameSorter sorter;
228 iterator.SetSorting(&sorter);
234 if( *iterator.Node() ==
nullptr )
244#if !ALIB_SINGLE_THREADED
245 for (
auto thread= store->threadStore.begin() ; thread != store->threadStore.end() ; ++thread )
246 if( thread->first.first ==
true )
247 for (
auto& it : thread->second ) {
252 ._<NC>(
"Scope::ThreadInner " );
static ALIB_DLL void ReplaceToReadable(AString &target, integer startIdx)
ALIB_DLL NAString & storeThreadToScope(ThreadID threadID)
ALIB_DLL NAString & storeKeyToScope(String key)
NAString & targetBuffer
The target to write to.
ALIB_DLL int writeStore(ScopeStore< T, true > *store, int indentSpaces)
ScopeInfo::ThreadDictionary & threadDict
User-defined threads names.
ALIB_DLL integer writeStoreMapHelper(SSMap< T > &map, const NString &prefix)
ALIB_DLL int writeStoreMap(ScopeStore< T, false > *store)
const NString noKey
String to identify global keys.
integer maximumKeyLength
The maximum length of a key. Adjusts (increases) over life-cycle.
TAString & _(const TAppendable &src)
integer IndexOf(TChar needle, integer startIdx=0) const
@ Left
Chooses left alignment.
@ On
Switch it on, switched on, etc.
@ Exclude
Chooses exclusion.
HashMap< PoolAllocator, NString, T, std::hash< NString >, std::equal_to< NString >, lang::Caching::Enabled, Recycling::None > SSMap
Shortcut to the ScopeStore's hashmap.
integer ThreadID
The ALib thread identifier type.
strings::TEscape< character > Escape
Type alias in namespace alib.
LocalString< 256 > String256
Type alias name for TLocalString<character,256>.
LocalString< 64 > String64
Type alias name for TLocalString<character,64>.
lang::integer integer
Type alias in namespace alib.
strings::TString< nchar > NString
Type alias in namespace alib.
strings::TAString< nchar, lang::HeapAllocator > NAString
Type alias in namespace alib.
strings::TTab< nchar > NTab
Type alias in namespace alib.
boxing::Box Box
Type alias in namespace alib.
strings::TField< nchar > NField
Type alias in namespace alib.
strings::TString< character > String
Type alias in namespace alib.