• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Kernel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Kernel的典型用法代码示例。如果您正苦于以下问题:C# Kernel类的具体用法?C# Kernel怎么用?C# Kernel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Kernel类属于命名空间,在下文中一共展示了Kernel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Compile

        public override void Compile(Kernel k)
        {
            Symbol returnSymbol = k.Lookup("+return");

            if (this.Value != null)
                this.Value.Compile(k);
            else
                k.Emit(Opcode.PUSHNIL);

            var rvn = new RetrieveVariableNode(-1, -1) {VariableName = "+return"};
            rvn.PrePass(k);
            rvn.PreCompile(k);
            rvn.Compile(k);

            uint mem = 0;
            Scope current = k.CurrentScope;
            while(current != returnSymbol.SScope)
            {
                mem += current.MemorySpace;
                current.PopMemory(k, false);

                current = current.Parent;
            }

            mem += current.MemorySpace;

            current.PopMemory(k, false);

            k.EmitPush(mem + "u").Comment = "deallocate function memory";
            k.Emit(Opcode.DEALLOC);

            k.Emit(Opcode.JUMP).SetDebug(File, Line, Column, DebugType.Return, "");
        }
开发者ID:redxdev,项目名称:shogun-old,代码行数:33,代码来源:ReturnNode.cs


示例2: Compile

        public override void Compile(Kernel k)
        {
            Symbol symbol = k.Lookup(this.VariableName);

            if(this.Value == null)
            {
                k.Emit(Opcode.PUSHNIL).Comment = "set variable to nil";
            }
            else
            {
                this.Value.Compile(k);
            }

            if (symbol.SScope == k.CurrentScope)
            {
                k.EmitPush(symbol.Id.ToString() + "u").Comment = "store into variable " + this.VariableName;
                k.Emit(Opcode.STLO).SetDebug(File, Line, Column, DebugType.Set, this.VariableName);
            }
            else
            {
                uint mem = k.CurrentScope.WalkMemoryBack(symbol.SScope);
                mem -= symbol.Id;

                k.EmitPush(mem.ToString() + "u").Comment = "store into variable " + this.VariableName;
                k.Emit(Opcode.STNLO).SetDebug(File, Line, Column, DebugType.Set, this.VariableName);
            }
        }
开发者ID:redxdev,项目名称:shogun-old,代码行数:27,代码来源:SetVariableNode.cs


示例3: FinishedLaunching

 public override void FinishedLaunching(UIApplication app)
 {
     Instance = this;
     Application application = new Application ();
     kernel = new Kernel (application);
     kernel.Run ();
 }
开发者ID:Syderis,项目名称:CellSDK-Tutorials,代码行数:7,代码来源:Program.cs


示例4: PreCompile

 public override void PreCompile(Kernel k)
 {
     foreach (ICompileNode node in this.Children)
     {
         node.PreCompile(k);
     }
 }
开发者ID:redxdev,项目名称:shogun-old,代码行数:7,代码来源:TreeNode.cs


示例5: Compile

        public override void Compile(Kernel k)
        {
            k.EmitPush("1u");
            k.Emit(Opcode.ALLOC).SetDebug(File, Line, Column, DebugType.Define, this.VariableName);
            k.CurrentScope.MemorySpace += 1;

            Symbol symbol = new Symbol()
                {
                    Name = this.VariableName,
                    SMode = Symbol.Mode.Intern,
                    SType = Symbol.Type.Variable,
                    Id = k.CurrentScope.RequestId()
                };

            k.RegisterSymbol(symbol);

            if (this.Value == null)
            {
                k.Emit(Opcode.PUSHNIL).Comment = "clear memory for variable";
            }
            else
            {
                this.Value.Compile(k);
            }

            k.EmitPush(symbol.Id.ToString() + "u");
            k.Emit(Opcode.STLO).SetDebug(File, Line, Column, DebugType.Set, this.VariableName);
        }
开发者ID:redxdev,项目名称:shogun-old,代码行数:28,代码来源:DefineVariableNode.cs


示例6: KNN_SVM

        public KNN_SVM(string path, double sigma, double gamma, Kernel kernel, int k, ImageVector[] goodImages, ImageVector[] badImages)
        {
            type = "KNN & SVM";
            svm = new SVM_Matlab(path, sigma, gamma, (SVM_Matlab.Kernel)kernel, goodImages, badImages);
            knn = new KNN_Matlab(path, k, goodImages, badImages);

            totalImages = 0;

            this.goodImages = goodImages;
            this.badImages = badImages;

            learnedTrue = new bool[goodImages.Length];
            learnedFalse = new bool[badImages.Length];
            restartTest();

            userPath = path + "\\KNN_SVM";
            resultPath = userPath + "\\sigma_" + sigma + "_gamma_" + gamma;

            learn = GetLearnCommand(userPath, sigma, gamma, kernel);
            decideSVM = GetDecideCommandSVM(userPath, kernel);
            decideKNN = GetDecideCommandKNN(userPath, k);

            matlab = new MLApp.MLApp();
            cd = "cd " + smartAlbum.getMatlabDirectory();
            matlab.Execute(cd);
        }
开发者ID:ravitle,项目名称:Smart-Album,代码行数:26,代码来源:KNN_SVM.cs


示例7: TraceDlg

        public TraceDlg(Kernel kernel)
        {
            InitializeComponent();

            _kernel = kernel;

            _colJp.Add("送受");
            _colJp.Add("スレッドID");
            _colJp.Add("アドレス");
            _colJp.Add("データ");
            _colEn.Add("Direction");
            _colEn.Add("ThreadID");
            _colEn.Add("Address");
            _colEn.Add("Data");

            //オーナー描画
            foreach (var t in _colJp){
                listViewTrace.Columns.Add(t);
            }
            listViewTrace.Columns[2].Width = 100;
            listViewTrace.Columns[3].Width = 500;

            _timer = new Timer{Enabled = true, Interval = 100};
            _timer.Tick += TimerTick;

            kernel.WindowSize.Read(this);//ウインドサイズの復元
            kernel.WindowSize.Read(listViewTrace);//カラム幅の復元
        }
开发者ID:jsakamoto,项目名称:bjd5,代码行数:28,代码来源:TraceDlg.cs


示例8: RunKernel

        public static void RunKernel(
            Context context,
            Device device,
            Kernel kernel,
            int size,
            IEnumerable<int> indicesOfPinnedArraysToReadBack,
            params IPinnedArrayOfStruct[] pinnedArrays)
        {
            ErrorCode errorCode;

            var commandQueue = Cl.CreateCommandQueue(context, device, CommandQueueProperties.ProfilingEnable, out errorCode);
            errorCode.Check("CreateCommandQueue");

            var setKernelArgErrorCodes = pinnedArrays.Select((pinnedArray, index) =>
            {
                var ec = Cl.SetKernelArg(kernel, (uint) index, pinnedArray.Buffer);
                ec.Check($"SetKernelArg({index})");
                return ec;
            });
            Debug.Assert(setKernelArgErrorCodes.All(e => e == ErrorCode.Success));

            var globalWorkSize = new[] {(IntPtr) size};

            Event e1;
            errorCode = Cl.EnqueueNDRangeKernel(
                commandQueue,
                kernel,
                (uint)globalWorkSize.Length, // workDim
                null, // globalWorkOffset
                globalWorkSize,
                null, // localWorkSize
                0, // numEventsInWaitList
                null, // eventWaitList
                out e1);
            errorCode.Check("EnqueueNDRangeKernel");

            var eventsToWaitFor = new List<Event>();

            foreach (var index in indicesOfPinnedArraysToReadBack)
            {
                Event e2;
                errorCode = Cl.EnqueueReadBuffer(
                    commandQueue,
                    pinnedArrays[index].Buffer,
                    Bool.False, // blockingRead
                    IntPtr.Zero, // offsetInBytes
                    (IntPtr)pinnedArrays[index].Size,
                    pinnedArrays[index].Handle,
                    0, // numEventsInWaitList
                    null, // eventWaitList
                    out e2);
                errorCode.Check("EnqueueReadBuffer");

                eventsToWaitFor.Add(e2);
            }

            var evs = eventsToWaitFor.ToArray();
            errorCode = Cl.WaitForEvents((uint)evs.Length, evs);
            errorCode.Check("WaitForEvents");
        }
开发者ID:taylorjg,项目名称:OpenCLExperiments,代码行数:60,代码来源:KernelRunner.cs


示例9: CreateInstance

        public static Object CreateInstance(Kernel kernel, string path, string className, Object[] param)
        {
            if (File.Exists(path)){
                var dllName = Path.GetFileNameWithoutExtension(path);
                try{
                    var asm = Assembly.LoadFile(path);
                    if (asm != null){
                        return asm.CreateInstance(dllName + "." + className, true, BindingFlags.Default, null, param,
                                                  null, null);
                    }
                }
                catch (Exception ex){

                    //Ver6.1.7
                    if (ex.InnerException != null) {
                        throw new Exception(ex.InnerException.Message);
                    }

                    var logger = kernel.CreateLogger("CreateInstance", false, null);
                    logger.Set(LogKind.Error, null, 9000051,
                               string.Format("DLL={0} CLASS={1} {2}", dllName, className, ex.Message));

                    return null;
                }
            }
            return null;
        }
开发者ID:jsakamoto,项目名称:bjd5,代码行数:27,代码来源:Util.cs


示例10: SockTcp

        //ACCEPT
        //Ver5.9.2 Java fix
        //public SockTcp(Kernel kernel, Socket s) : base(kernel){
        public SockTcp(Kernel kernel, Ssl ssl, Socket s)
            : base(kernel)
        {
            //************************************************
            //selector/channel生成
            //************************************************
            _socket = s;
            _ssl = ssl;

            //既に接続を完了している
            if (_ssl != null){
                //SSL通信の場合は、SSLのネゴシエーションが行われる
                _oneSsl = _ssl.CreateServerStream(_socket);
                if (_oneSsl == null) {
                    SetError("_ssl.CreateServerStream() faild");
                    return;
                }
            }

            //************************************************
            //ここまでくると接続が完了している
            //************************************************
            //Set(SockState.Connect, (InetSocketAddress) channel.socket().getLocalSocketAddress(), (InetSocketAddress) channel.socket().getRemoteSocketAddress());

            //************************************************
            //read待機
            //************************************************
            BeginReceive(); //接続完了処理(受信待機開始)
        }
开发者ID:jsakamoto,项目名称:bjd5,代码行数:32,代码来源:SockTcp.cs


示例11: Init

        /// <summary>
        /// The Init method is called when the plug-in is loaded by MediaBrowser.  You should perform all your specific initializations
        /// here - including adding your theme to the list of available themes.
        /// </summary>
        /// <param name="kernel"></param>
        public override void Init(Kernel kernel)
        {
            try
            {
                //the AddTheme method will add your theme to the available themes in MediaBrowser.  You need to call it and send it
                //resx references to your mcml pages for the main "Page" selector and the MovieDetailPage for your theme.
                //The template should have generated some default pages and values for you here but you will need to create all the
                //specific mcml files for the individual views (or, alternatively, you can reference existing views in MB.
                kernel.AddTheme("Classic", "resx://Classic/Classic.Resources/Page#PageClassic", "resx://Classic/Classic.Resources/DetailMovieView#ClassicMovieView");

                //The AddConfigPanel method will allow you to extend the config page of MediaBrowser with your own options panel.
                //You must create this as an mcml UI that fits within the standard config panel area.  It must take Application and
                //FocusItem as parameters.  The project template should have generated an example ConfigPage.mcml that you can modify
                //or, if you don't wish to extend the config, remove it and the following call to AddConfigPanel
                //kernel.AddConfigPanel("Classic Options", "resx://Classic/Classic.Resources/ConfigPanel#ConfigPanel");

                //The AddStringData method will allow you to extend the localized strings used by MediaBrowser with your own.
                //This is useful for adding descriptive text to go along with your theme options.  If you don't have any theme-
                //specific options or other needs to extend the string data, remove the following call.
                //kernel.StringData.AddStringData(MyStrings.FromFile(MyStrings.GetFileName("Classic-")));

                //Tell the log we loaded.
                Logger.ReportInfo("Classic Theme Loaded.");
            }
            catch (Exception ex)
            {
                Logger.ReportException("Error adding theme - probably incompatable MB version", ex);
            }
        }
开发者ID:rickbassham,项目名称:videobrowser,代码行数:34,代码来源:Plugin.cs


示例12: PreCompile

        public override void PreCompile(Kernel k)
        {
            if (this.Body != null)
                this.Body.PreCompile(k);

            this.Check.PreCompile(k);
        }
开发者ID:redxdev,项目名称:shogun-old,代码行数:7,代码来源:DoWhileLoopNode.cs


示例13: Stop

 public static void Stop()
 {
     if(null != _Kernel) {
         _Kernel.Dispose();
         _Kernel = null;
     }
 }
开发者ID:Kuick,项目名称:Kuicker,代码行数:7,代码来源:Platform.cs


示例14: PreCompile

 public override void PreCompile(Kernel k)
 {
     foreach (ICompileNode node in this.Values)
     {
         node.PrePass(k);
     }
 }
开发者ID:redxdev,项目名称:shogun-old,代码行数:7,代码来源:ExpressionNode.cs


示例15: Main

        /// <summary>
        /// Represents the entry point to the sample application.
        /// </summary>
        /// <param name="args">The command line arguments, that were passed to the program. Are not used.</param>
        public static void Main(string[] args)
        {
            // Creates a new Simple IoC kernel
            Kernel kernel = new Kernel();

            // Binds the vehicles to the kernel
            kernel.Bind<IVehicle>().ToType<Car>();
            kernel.Bind<IVehicle>().ToType<Motorcycle>().WhenInjectedInto<SuperCoolPerson>(); // Obviously super cool people drive motorcycles!

            // Creates some persons
            Person person = kernel.Resolve<Person>();
            Person superCoolPerson = kernel.Resolve<SuperCoolPerson>();
            Person namedPerson = kernel.Resolve<NamedPerson>("Bob");

            // Prints out the personal information about the persons that were created
            System.Console.WriteLine(person);
            System.Console.WriteLine(superCoolPerson);
            System.Console.WriteLine(namedPerson);

            // Demonstrates singleton scope, where the resolved instance is always the same
            kernel.Bind<DateTime>().ToFactory(() => DateTime.UtcNow).InSingletonScope();
            System.Console.WriteLine(kernel.Resolve<DateTime>().Ticks);
            Thread.Sleep(1000);
            System.Console.WriteLine(kernel.Resolve<DateTime>().Ticks);

            // Waits for a key stroke, before the application is quit
            System.Console.WriteLine("Press any key to quit...");
            System.Console.ReadKey();
        }
开发者ID:lecode-official,项目名称:simple-ioc,代码行数:33,代码来源:Program.cs


示例16: ConvertLogLevel

        public static LogLevel ConvertLogLevel(Kernel.Logging.LogLevel logLevel)
        {
            switch (logLevel)
            {
                case Kernel.Logging.LogLevel.Debug:
                    return LogLevel.Debug;

                case Kernel.Logging.LogLevel.Error:
                    return LogLevel.Error;

                case Kernel.Logging.LogLevel.Fatal:
                    return LogLevel.Fatal;

                case Kernel.Logging.LogLevel.Information:
                    return LogLevel.Info;

                case Kernel.Logging.LogLevel.Trace:
                    return LogLevel.Trace;

                case Kernel.Logging.LogLevel.Warning:
                    return LogLevel.Warn;

                default:
                    return LogLevel.Off;
            }
        }
开发者ID:l1183479157,项目名称:RabbitHub,代码行数:26,代码来源:LogUtilities.cs


示例17: SetupServiceDlg

        public SetupServiceDlg(Kernel kernel)
        {
            InitializeComponent();

            _setupService = new SetupService(kernel);

            _kernel = kernel;

            Text = (kernel.IsJp()) ?"サービス設定ダイアログ":"Setting Service";

            groupBoxInstall.Text = (kernel.IsJp()) ? "サービスへのインストール" : "Registration";
            buttonInstall.Text = (kernel.IsJp()) ? "登録" : "Install";
            buttonUninstall.Text = (kernel.IsJp()) ? "削除" : "Uninstall";

            groupBoxStatus.Text = (kernel.IsJp()) ? "状態" : "Service status";
            buttonStart.Text = (kernel.IsJp()) ? "開始" : "Start";
            buttonStop.Text = (kernel.IsJp()) ? "停止" : "Stop";
            buttonRestart.Text = (kernel.IsJp()) ? "再起動" : "Restart";

            groupBoxStartupType.Text = (kernel.IsJp()) ? "スタートアップの種類" : "Startup type";
            buttonAutomatic.Text = (kernel.IsJp()) ? "自動" : "Auto";
            buttonManual.Text = (kernel.IsJp()) ? "手動" : "Manual";
            buttonDisable.Text = (kernel.IsJp()) ? "無効" : "Disable";

            DispInit();
        }
开发者ID:jsakamoto,项目名称:bjd5,代码行数:26,代码来源:SetupServiceDlg.cs


示例18: SVM_Matlab

        public SVM_Matlab(string path, double sigma, double gamma, Kernel kernel, ImageVector[] goodImages, ImageVector[] badImages)
        {
            type = "SVM";

            this.goodImages = goodImages;
            this.badImages = badImages;

            learnedTrue = new bool[goodImages.Length];
            learnedFalse = new bool[badImages.Length];

            confidenceTrue = new double[goodImages.Length];
            confidenceFalse = new double[badImages.Length];

            restartTest();

            userPath = path + "\\SVM_" + getKernel(kernel) + "_" + sigma;
            resultPath = userPath + "\\" + sigma + "_" + gamma;
            learn = GetLearnCommand(userPath, sigma, gamma, kernel);
            learn_Test = GetLearnCommand_Test(userPath, sigma, gamma, kernel,goodImages[0].getNumOfParameters());
            decide = GetDecideCommand(userPath, kernel);
            decide_Test = GetDecideCommand_Test(userPath, kernel, goodImages[0].getNumOfParameters());

            matlab = new MLApp.MLApp();
            cd = "cd " + smartAlbum.getMatlabDirectory();
            matlab.Execute(cd);
        }
开发者ID:ravitle,项目名称:Smart-Album,代码行数:26,代码来源:SVM_Matlab.cs


示例19: ExperienceChecker

 public ExperienceChecker(Kernel kernel)
 {
     this.Client = kernel.Client;
     _Active = false;
     ExperienceTimer = new Timer(1000, -1);
     ExperienceTimer.Execute += ExperienceTimer_Execute;
 }
开发者ID:Cameri,项目名称:TibiaTek-Bot-Reborn,代码行数:7,代码来源:ExperienceChecker.cs


示例20: PreCompile

 public override void PreCompile(Kernel k)
 {
     foreach (ICompileNode node in this.Arguments)
     {
         node.PreCompile(k);
     }
 }
开发者ID:redxdev,项目名称:shogun-old,代码行数:7,代码来源:FunctionCallNode.cs



注:本文中的Kernel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Key类代码示例发布时间:2022-05-24
下一篇:
C# KentorAuthServicesAuthenticationMiddleware类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap