ALox  V. 2402 R. 0
Home ALox for C++ ALox for C# ALox for Java Download
Public Fields | Public Methods | Protected Fields | Protected Methods | List of all members
ScopeStore< T > Class Template Reference
Collaboration diagram for ScopeStore< T >:
[legend]

Class Description


This class is responsible for scope-related functionality of class Lox.

Note
This is a pure internal helper class. Documentation may be limited.

Public Fields

globalStore
 
StringTree< T > languageStore = new StringTree<T>()
 
Dictionary< Thread, List< T > > threadInnerStore =new Dictionary<Thread, List<T>>()
 
Dictionary< Thread, List< T > > threadOuterStore =new Dictionary<Thread, List<T>>()
 

Public Methods

 ScopeStore (ScopeInfo scopeInfo, bool cfgSingleThreadValue)
 
void Clear ()
 
Get ()
 
void InitAccess (Scope scope, int pathLevel, Thread thread)
 
void InitWalk (Scope startScope, T localObject)
 
Remove (T value)
 
Store (T value)
 
Walk ()
 

Protected Fields

int actPathLevel
 
Scope actScope
 
StringTree< T >.Cursor actStringTreeNode
 
Thread actThread
 
bool cfgSingleThreadValue
 
AString languageKey = new AString(128)
 
Substring languageKeySubs = new Substring()
 
bool lazyLanguageNode
 
ScopeInfo scopeInfo
 
bool walking
 
walkLocalObject
 
int walkNextThreadIdx
 
List< T > walkThreadValues
 

Protected Methods

access (int cmd, T value)
 
void initCursor (bool create)
 

Constructor & Destructor Documentation

◆ ScopeStore()

ScopeStore ( ScopeInfo  scopeInfo,
bool  cfgSingleThreadValue 
)
inline

Constructor

Parameters
scopeInfoThe ScopeInfo singleton of 'our' Lox.
cfgSingleThreadValueDetermines if for thread-related scopes, a list of values is stored, or just one.

Member Function Documentation

◆ access()

T access ( int  cmd,
value 
)
inlineprotected

Receives, inserts or removes a value.

Parameters
cmd0= insert, 1= remove, 2= get.
valueThe new value or the one to be removed.
Returns
Returns the previous value stored.

◆ Clear()

void Clear ( )
inline

Clears all data stored, resets all values.

◆ Get()

T Get ( )
inline

Retrieves the value for the given scope.

Returns
Returns the current value stored.

◆ InitAccess()

void InitAccess ( Scope  scope,
int  pathLevel,
Thread  thread 
)
inline

Initializes access methods Store, Get and Remove and has to be invoked prior to using them

Parameters
scopeScope to use.
pathLevelUsed with Scope.FilePath to determine outer level.
threadThe associated thread (for thread-related scopes only). If 0 is given, the ID from scopeInfo is used.

◆ initCursor()

void initCursor ( bool  create)
inlineprotected

Retrieves and optionally creates an entry in the map that stores language-related scope information. The result is stored in field actStringTreeNode.

Parameters
createIf true, a non-existing entry is created.

◆ InitWalk()

void InitWalk ( Scope  startScope,
localObject 
)
inline

Initializes a scope 'walk' by storing the given scope information and setting fields of our walk 'state-machine' to proper start values.

Parameters
startScopeThe Scope to start searching for.
localObjectThe 'local object' returned by a walk after Scope.ThreadInner and before Scope.Method

◆ Remove()

T Remove ( value)
inline

Removes a value for the given scope.

Parameters
valueThe value to remove (only used for thread-related Scopes).
Returns
Returns the previous value stored.

◆ Store()

T Store ( value)
inline

Stores a new value for the given scope.

Parameters
valueThe new value to set.
Returns
Returns the previous value stored.

◆ Walk()

T Walk ( )
inline

Searches value in the actual scope. While not found, moves walk state to next outer and continues there.

Returns
The next object found in the current or any next outer scope.

Member Data Documentation

◆ actPathLevel

int actPathLevel
protected

The next path level of a walk during scope 'Path'

◆ actScope

Scope actScope
protected

The actual scope of a walk

◆ actStringTreeNode

StringTree<T>.Cursor actStringTreeNode
protected

The actual language related scopes' map node

◆ actThread

Thread actThread
protected

The actual thread

◆ cfgSingleThreadValue

bool cfgSingleThreadValue
protected

If true, values stored for thread scopes will be always replaced instead of appended. This is for example true for Log Data and false for Scope Domains

◆ globalStore

T globalStore

The value to the global scope

◆ languageKey

AString languageKey = new AString(128)
protected

Temporary string for assembling source key

◆ languageKeySubs

Substring languageKeySubs = new Substring()
protected

Temporary substring for consuming the source key

◆ languageStore

StringTree<T> languageStore = new StringTree<T>()

StringTree store for language-related scopes (path,source,method)

◆ lazyLanguageNode

bool lazyLanguageNode
protected

Flag used to lazily create the key to language-related scope values

◆ scopeInfo

ScopeInfo scopeInfo
protected

The ScopeInfo singleton of our Lox

◆ threadInnerStore

Dictionary<Thread, List<T> > threadInnerStore =new Dictionary<Thread, List<T>>()

A list of domain paths of Scope.ThreadInner

◆ threadOuterStore

Dictionary<Thread, List<T> > threadOuterStore =new Dictionary<Thread, List<T>>()

A list of domain paths of Scope.ThreadOuter

◆ walking

bool walking
protected

Indicates if currently a scope walk is active

◆ walkLocalObject

T walkLocalObject
protected

The 'local object' returned by a walk after Scope.ThreadInner and before Scope.Method

◆ walkNextThreadIdx

int walkNextThreadIdx
protected

The next value of a walk during Scope.ThreadOuter/Inner

◆ walkThreadValues

List<T> walkThreadValues
protected

The list of values of Scope.ThreadOuter/Inner during a walk


The documentation for this class was generated from the following file: