/// <summary>
        /// Closes the map resources
        /// </summary>
        /// <remarks>Eg, tag manager, string id manager, IO streams, etc</remarks>
        public virtual void Close()
        {
            if (!CacheId.IsNull)
            {
                CloseTagIndexManager();

                refManager = null;

                StringIdManagerDispose();

                if (!IsSharedReference && InputStream != null)
                {
                    InputStream.Close();
                }
                InputStream = null;

                if (!IsSharedReference && OutputStream != null)
                {
                    OutputStream.Close();
                }
                OutputStream = null;

                CacheId = DatumIndex.Null;
            }
        }
        /// <summary>
        /// Create a new builder tag index
        /// </summary>
        /// <param name="version">Engine version for the tags</param>
        /// <param name="source_index"></param>
        /// <remarks>
        /// Must call <see cref="DataArraySet"/> in inheriting object's ctor
        /// </remarks>
        protected BuilderTagIndexBase(BlamVersion version, Managers.ITagIndex source_index)
        {
            Debug.Assert.If(source_index, "Couldn't create a builder tag index! Require a valid source index.");
            Debug.Assert.If(source_index.Engine == version, "Couldn't create a builder tag index! Engine mismatch: {0:X} != {1:X}.", source_index.Engine, version);
            engine      = version;
            sourceIndex = source_index;

            refManager = new Managers.ReferenceManager(version, string.Format("[BuilderTagIndex {0}]", version.ToString("X")), false);

            if (engine.UsesStringIds())
            {
                StringTableInitialize();
            }
        }
 /// <summary>
 /// Initialize the <see cref="References"/> object for use
 /// </summary>
 /// <param name="name">Name to use for the reference manager</param>
 /// <remarks>Recommended this is called just before the index is read from the stream</remarks>
 protected internal void InitializeReferenceManager(string name)
 {
     refManager = new BlamLib.Managers.ReferenceManager(engineVersion, name, true);
 }