/// <summary>
        /// This constructor is for forking.
        /// </summary>
        protected HostEnvironmentBase(HostEnvironmentBase <TEnv> source, Random rand, bool verbose,
                                      int?conc, string shortName = null, string parentFullName = null)
            : base(shortName, parentFullName, verbose)
        {
            Contracts.CheckValue(source, nameof(source));
            Contracts.CheckValueOrNull(rand);
            _rand       = rand ?? RandomUtils.Create();
            _conc       = conc;
            _cancelLock = new object();

            // This fork shares some stuff with the master.
            Master           = source;
            Root             = source.Root;
            ListenerDict     = source.ListenerDict;
            ProgressTracker  = source.ProgressTracker;
            ComponentCatalog = source.ComponentCatalog;
        }
 protected abstract IHost RegisterCore(HostEnvironmentBase <TEnv> source, string shortName,
                                       string parentFullName, IRandom rand, bool verbose, int?conc);
 public HostBase(HostEnvironmentBase <TEnv> source, string shortName, string parentFullName, IRandom rand, bool verbose, int?conc)
     : base(source, rand, verbose, conc, shortName, parentFullName)
 {
     Depth     = source.Depth + 1;
     _children = new List <WeakReference <IHost> >();
 }
 protected override IHost RegisterCore(HostEnvironmentBase <ConsoleEnvironment> source, string shortName, string parentFullName, IRandom rand, bool verbose, int?conc)
 {
     return(new Host(source, shortName, parentFullName, rand, verbose, conc));
 }
 public Host(HostEnvironmentBase <ConsoleEnvironment> source, string shortName, string parentFullName, IRandom rand, bool verbose, int?conc)
     : base(source, shortName, parentFullName, rand, verbose, conc)
 {
     IsCancelled = source.IsCancelled;
 }