ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
Public Methods | Protected Fields | Protected Methods | List of all members
ScopeDump Class Reference
Collaboration diagram for ScopeDump:
[legend]

Class Description


This class is an internal helper to export current scope values. It was extracted from class Lox to keep that class clean from this somehow 'cluttered' code.

The current purpose of this class is to write information into an AString buffer. This is used by method Lox::State. In the future, other export formats, like JSON might be implemented here.

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

Definition at line 32 of file scopedump.inl.

Public Methods

 ScopeDump (ScopeInfo::ThreadDictionary &threadDictionary, const NString noKeyHashKey, NAString &target, int maxKeyLength=10)
 
template<typename T >
ALIB_API int writeStore (ScopeStore< T, true > *store, int indentSpaces)
 
template<typename T >
ALIB_API int writeStoreMap (ScopeStore< T, false > *store)
 

Protected Fields

integer maximumKeyLength
 
const NString noKey
 
NAStringtargetBuffer
 
ScopeInfo::ThreadDictionarythreadDict
 

Protected Methods

ALIB_API NAStringstoreKeyToScope (String key)
 
ALIB_API NAStringstoreThreadToScope (ThreadID threadID)
 
template<typename T >
ALIB_API integer writeStoreMapHelper (std::map< NString, T > &map, const NString &prefix)
 

Constructor & Destructor Documentation

◆ ScopeDump()

ScopeDump ( ScopeInfo::ThreadDictionary threadDictionary,
const NString  noKeyHashKey,
NAString target,
int  maxKeyLength = 10 
)
inline

Constructor

Parameters
threadDictionaryUser-defined threads names.
targetTarget string to write to.
noKeyHashKeyString to identify global keys.
maxKeyLengthThe start value for the maximum length of a key.

Definition at line 65 of file scopedump.inl.

Member Function Documentation

◆ storeKeyToScope()

ALIB_API NAString& storeKeyToScope ( String  key)
protected

Helper method to write a StringTree's key as scope information.

Parameters
keyThe key used for the StringTree.
Returns
The target to allow concatenated calls.

◆ storeThreadToScope()

ALIB_API NAString& storeThreadToScope ( ThreadID  threadID)
protected

Helper method to write thread information.

Parameters
threadIDThe thread id.
Returns
The target to allow concatenated calls.

◆ writeStore()

ALIB_API int writeStore ( ScopeStore< T, true > *  store,
int  indentSpaces 
)

Writes the contents of the ScopeStore used for Scope Domains.

Parameters
storeThe store to use
indentSpacesThe number of spaces to add at the beginning of each line.
Returns
The total number of Scope Domains written.

◆ writeStoreMap()

ALIB_API int writeStoreMap ( ScopeStore< T, false > *  store)

Writes hash tables stored in a ScopeStore. Keys are Strings. Value types currently supported are LogData* and int.

Parameters
storeThe store to use.
Returns
The total number of hash table entries written.

◆ writeStoreMapHelper()

ALIB_API integer writeStoreMapHelper ( std::map< NString, T > &  map,
const NString prefix 
)
protected

Helper method to writeStoreMap.

Parameters
mapThe map to use
prefixA prefix string for each line
Returns
The number of objects written

Member Data Documentation

◆ maximumKeyLength

integer maximumKeyLength
protected

The maximum length of a key. Adjusts (increases) over life-cycle.

Definition at line 45 of file scopedump.inl.

◆ noKey

const NString noKey
protected

String to identify global keys.

Definition at line 42 of file scopedump.inl.

◆ targetBuffer

NAString& targetBuffer
protected

The target to write to.

Definition at line 39 of file scopedump.inl.

◆ threadDict

ScopeInfo::ThreadDictionary& threadDict
protected

User-defined threads names.

Definition at line 49 of file scopedump.inl.


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