274 --self.walkNextThreadIdx;
275 return (*self.walkThreadValues)[size_t(self.walkNextThreadIdx)];
279 self.actScope= Scope::Method;
282 if ( self.walkLocalObject !=
nullptr )
283 return self.walkLocalObject;
288 case Scope::Filename:
291 if( self.lazyLanguageNode )
292 self.initCursor(
false );
294 while( self.actStringTreeNode.IsValid() )
296 T actValue= *self.actStringTreeNode;
297 self.actStringTreeNode.GoToParent();
298 if( actValue !=
nullptr )
302 self.actScope= Scope::ThreadOuter;
303 self.walkNextThreadIdx= -2;
307 case Scope::ThreadOuter:
310 if ( self.walkNextThreadIdx == -2 )
313 if ( self.threadStore.Size() != 0 )
316 if ( it != self.threadStore.end() )
318 self.walkThreadValues= &it.Mapped();
319 self.walkNextThreadIdx=
static_cast<int>( self.walkThreadValues->size() );
326 if ( self.walkNextThreadIdx > 0 )
328 --self.walkNextThreadIdx;
329 return (*self.walkThreadValues)[size_t(self.walkNextThreadIdx)];
333 self.actScope= Scope::Global;
340 return self.globalStore;
344 default:
ALIB_ERROR(
"Illegal switch state.") break;
351template<typename T> T ScopeStoreHelper<T, true>::doAccess( ScopeStore<T, true>& self,
int cmd, T value )
356 if( self.actScope == Scope::Global )
358 oldValue= self.globalStore;
359 if ( cmd == CMD_INSERT ) self.globalStore= value;
360 else if ( cmd == CMD_REMOVE ) self.globalStore= nullptr;
367 if( self.actScope == Scope::ThreadOuter
368 || self.actScope == Scope::ThreadInner )
371 bool isInner= self.actScope == Scope::ThreadInner;
374 if ( cmd != CMD_INSERT && self.threadStore.Size() == 0 )
378 if ( self.actThreadID == threads::UNDEFINED )
379 self.actThreadID= self.scopeInfo.GetThreadID();
383 StdVectorMono<T>* values;
385 values= &self.threadStore.EmplaceIfNotExistent(
386 typename ScopeStore<T, true>::ThreadMapKey(isInner, self.actThreadID),
387 self.threadStore.GetAllocator() ).first.Mapped();
391 if ( cmd == CMD_GET )
392 return ( values->size() > 0) ? (*values)[ values->size() -1 ] :
nullptr;
395 if ( cmd == CMD_INSERT )
397 values->emplace_back( value );
402 if ( cmd == CMD_REMOVE && values->size() > 0)
405 if ( value == nullptr )
407 oldValue= values->back();
413 for (
auto rem= values->begin() ; rem != values->end(); ++rem )
414 if ( (*rem) == value )
418 values->erase( rem );
429 if ( cmd == CMD_INSERT && value ==
nullptr )
432 if ( self.lazyLanguageNode
433 || ( self.actStringTreeNode.IsInvalid() && cmd == CMD_INSERT ) )
434 self.initCursor(
true );
436 oldValue= *self.actStringTreeNode;
437 if ( cmd == CMD_INSERT ) *self.actStringTreeNode= value;
438 else if ( cmd == CMD_REMOVE ) *self.actStringTreeNode=
nullptr;
449template<
typename T,
bool TStackedThreadValues>
452 lazyLanguageNode=
false;
453 actStringTreeNode= languageStore.Root();
457 scopeInfo.GetTrimmedPath( path );
458 #if defined( _WIN32 )
469 auto remainingPath= actStringTreeNode.GoTo( path );
470 if ( remainingPath.IsNotEmpty() )
474 if ( !actStringTreeNode.GoToChild( path.
Reset<
NC>( scopeInfo.GetFileNameWithoutExtension() )._(
'#' ) ) )
478 actStringTreeNode.GoToChild( path.
Reset<
NC>(
'#' )._<
NC>( scopeInfo.GetMethod() ) );
484 actStringTreeNode.GoToCreatedPathIfNotExistent( path );
485 if ( actScope == Scope::Path )
488 int pathLevel= actPathLevel;
489 while ( --pathLevel >= 0 && !actStringTreeNode.IsRoot() )
490 actStringTreeNode.GoToParent();
495 path.
Reset( scopeInfo.GetFileNameWithoutExtension() ).
_(
'#' );
498 if ( actScope == Scope::Method )
499 path.
_(
"/#" ).
_( scopeInfo.GetMethod() );
501 actStringTreeNode.GoToCreatedPathIfNotExistent( path );