/** ****************************************************************************************
         * Writes the contents of the ScopeStore used for <em>Prefix Logables</em>
         * @param store         The store to use
         * @param indentSpaces  The number of spaces to add at the beginning of each line.
         * @return The total number of <em>Prefix Logables</em> written.
         ******************************************************************************************/
        public int writeScopePrefixes(ScopeStore <Object> store, int indentSpaces)
        {
            int cntScopeDomains = 0;

            if (store.globalStore != null)
            {
                cntScopeDomains++;
                target.InsertChars(' ', indentSpaces);
                target._('\"')._NC(store.globalStore.ToString())._('\"');
                target.Tab(25, -1)._NC("Scope.Global ").NewLine();
            }

            foreach (KeyValuePair <Thread, List <Object> > thread in store.threadOuterStore)
            {
                foreach (Object it in thread.Value)
                {
                    cntScopeDomains++;
                    target.InsertChars(' ', indentSpaces);
                    target._('\"')._NC(it.ToString())._('\"');
                    target.Tab(25, -1)
                    ._NC("Scope.ThreadOuter ");
                    storeThreadToScope(thread.Key).NewLine();
                }
            }

            foreach (PathMap <Object> it in store.languageStore)
            {
                cntScopeDomains++;

                target.InsertChars(' ', indentSpaces);
                target._('\"')._NC(it.Value.ToString())._('\"');
                target.Tab(25, -1);

                storeKeyToScope(it).NewLine();
            }

            foreach (KeyValuePair <Thread, List <Object> > thread in store.threadInnerStore)
            {
                foreach (Object it in thread.Value)
                {
                    cntScopeDomains++;
                    target.InsertChars(' ', indentSpaces);
                    target._('\"')._NC(it.ToString())._('\"');
                    target.Tab(25, -1)
                    ._NC("Scope.ThreadInner ");
                    storeThreadToScope(thread.Key).NewLine();
                }
            }

            return(cntScopeDomains);
        }
        /** ****************************************************************************************
         * Writes hash tables stored in a ScopeStore. Keys are AStrings.
         * Value types currently supported are LogData and int (in C# different method).
         * @param store The store to use.
         * @return The total number of hash table entries written.
         ******************************************************************************************/
        public int writeStoreMap <T>(ScopeStore <Dictionary <AString, T> > store)
        {
            bool firstEntry = true;
            int  cnt        = 0;

            if (store.globalStore != null && store.globalStore.Count > 0)
            {
                cnt += store.globalStore.Count;
                if (firstEntry)
                {
                    firstEntry = false;
                }
                else
                {
                    target.NewLine();
                }
                target._NC("  Scope.Global:").NewLine();
                maxKeyLength = writeStoreMapHelper(store.globalStore, "    ");
            }

            foreach (KeyValuePair <Thread, List <Dictionary <AString, T> > > thread in store.threadOuterStore)
            {
                if (thread.Value.Count == 0)
                {
                    continue;
                }
                ALIB.ASSERT(thread.Value.Count == 1);
                if (firstEntry)
                {
                    firstEntry = false;
                }
                else
                {
                    target.NewLine();
                }
                target._NC("  Scope.ThreadOuter ");  storeThreadToScope(thread.Key)._(':').NewLine();
                cnt         += thread.Value[0].Count;
                maxKeyLength = writeStoreMapHelper(thread.Value[0], "    ");
            }

            foreach (PathMap <Dictionary <AString, T> > map in store.languageStore)
            {
                if (firstEntry)
                {
                    firstEntry = false;
                }
                else
                {
                    target.NewLine();
                }
                target._NC("  ");
                storeKeyToScope(map)._(':').NewLine();
                cnt         += map.Value.Count;
                maxKeyLength = writeStoreMapHelper(map.Value, "    ");
            }

            foreach (KeyValuePair <Thread, List <Dictionary <AString, T> > > thread in store.threadInnerStore)
            {
                if (thread.Value.Count == 0)
                {
                    continue;
                }
                ALIB.ASSERT(thread.Value.Count == 1);
                if (firstEntry)
                {
                    firstEntry = false;
                }
                else
                {
                    target.NewLine();
                }
                target._NC("  Scope.ThreadInner ");  storeThreadToScope(thread.Key)._(':').NewLine();
                cnt         += thread.Value[0].Count;
                maxKeyLength = writeStoreMapHelper(thread.Value[0], "    ");
            }

            return(cnt);
        }