コード例 #1
0
            protected ImplBase(IHostEnvironment env, TOptions options, string name)
            {
                Contracts.CheckValue(env, nameof(env));

                // Note that env may be null here, which is OK since the CheckXxx methods are extension
                // methods designed to allow null.
                env.CheckValue(options, nameof(options));

                env.CheckUserArg(!(options.Parallel < 0), nameof(options.Parallel), "Degree of parallelism must be non-negative (or null)");

                // Capture the environment options from args.
                env = env.Register(name, options.RandomSeed, options.Verbose);

                env.CheckNonWhiteSpace(name, nameof(name));
                Host           = env.Register(name);
                ImplOptions    = options;
                _serverFactory = options.Server;
                Utils.CheckOptionalUserDirectory(options.OutputModelFile, nameof(options.OutputModelFile));
            }
コード例 #2
0
            /// <summary>
            /// The degree of concurrency is passed in the conc parameter. If it is null, the value
            /// of args.parralel is used. If that is null, zero is used (which means "automatic").
            /// </summary>
            protected ImplBase(IHostEnvironment env, TArgs args, string name, int?conc = null)
            {
                Contracts.CheckValue(env, nameof(env));

                // Note that env may be null here, which is OK since the CheckXxx methods are extension
                // methods designed to allow null.
                env.CheckValue(args, nameof(args));
                env.CheckParam(conc == null || conc >= 0, nameof(conc), "Degree of concurrency must be non-negative (or null)");

                conc = conc ?? args.Parallel;
                env.CheckUserArg(!(conc < 0), nameof(args.Parallel), "Degree of parallelism must be non-negative (or null)");

                // Capture the environment options from args.
                env = env.Register(name, args.RandomSeed, args.Verbose, conc);

                env.CheckNonWhiteSpace(name, nameof(name));
                Host           = env.Register(name);
                Args           = args;
                _serverFactory = args.Server;
                Utils.CheckOptionalUserDirectory(args.OutputModelFile, nameof(args.OutputModelFile));
            }