当前位置: 首页>>代码示例>>C#>>正文


C# Processor.swap方法代码示例

本文整理汇总了C#中Processor.swap方法的典型用法代码示例。如果您正苦于以下问题:C# Processor.swap方法的具体用法?C# Processor.swap怎么用?C# Processor.swap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Processor的用法示例。


在下文中一共展示了Processor.swap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

    public static void Main(string[] args)
    {
        DefaultParticipant.DomainId = 0;

        if (args.Length >= 1)
        {
          int domainId = 0;
          if (!Int32.TryParse(args[0], out domainId))
          {
        Console.WriteLine("Invalid domainId. Quitting...");
        return;
          }
          DefaultParticipant.DomainId = domainId;
        }

        DDS.DomainParticipant participant = DefaultParticipant.Instance;

        try
        {
          DefaultParticipant.RegisterType<ShapeTypeExtended, ShapeTypeExtendedTypeSupport>();

          Processor proc = new Processor();
          proc.triangle_writer =
        DefaultParticipant.CreateDataWriter<ShapeTypeExtended>("Triangle");

          IDisposable disposable = null;

          //int workerThreads, completionPortThreads;
          //System.Threading.ThreadPool.GetMaxThreads(out workerThreads, out completionPortThreads);
          //Console.WriteLine("# of workerThreads = {0}, # of completionPortThreads = {1} ",
          //                  workerThreads, completionPortThreads);

          IScheduler scheduler;
          if (args.Length >= 3)
          {
        if (args[2] == "Default")
          scheduler = Scheduler.Default;
        else if (args[2] == "ThreadPool")
          scheduler = Scheduler.Default;
        else if (args[2] == "Immediate")
          scheduler = Scheduler.Immediate;
        else if (args[2] == "CurrentThread")
          scheduler = Scheduler.CurrentThread;
        else if (args[2] == "TaskPool")
          scheduler = TaskPoolScheduler.Default;
        else if (args[2] == "EventLoop")
          scheduler = new EventLoopScheduler();
        else
          throw new ApplicationException("Unknown Scheduler!");
          }
          else
        scheduler = Scheduler.Immediate;

          if (args.Length >= 2)
          {
        if (args[1] == "demo1")
          disposable = proc.demo1(participant, scheduler);
        if (args[1] == "demo2")
          disposable = proc.demo2(participant, scheduler);
        if (args[1] == "demo3")
          disposable = proc.demo3(participant);
        if (args[1] == "demo4")
          disposable = proc.demo4(participant);
        if (args[1] == "demo5")
          disposable = proc.demo5(participant, scheduler);
        if (args[1] == "forward")
          disposable = proc.forward(participant);
        else if (args[1] == "forward_short")
          disposable = proc.forward_short(participant);
        else if (args[1] == "forward_shortest")
          disposable = proc.forward_shortest(participant);
        else if (args[1] == "swap")
          disposable = proc.swap(participant);
        else if (args[1] == "swap_shortest")
          disposable = proc.swap(participant);
        else if (args[1] == "flower")
          disposable = proc.flower(participant);
        else if (args[1] == "instance_forward")
          disposable = proc.instance_forward(participant);
        else if (args[1] == "aggregator")
          disposable = proc.aggregator(participant);
        else if (args[1] == "collisions_combinelatest")
          disposable = proc.collisions_combinelatest(participant, scheduler);
        else if (args[1] == "collisions")
          disposable = proc.collisions(participant, scheduler);
        else if (args[1] == "single_circle_correlator")
          disposable = proc.single_circle_correlator(participant);
        else if (args[1] == "selectmany_correlator")
          disposable = proc.selectmany_correlator(participant, false);
        else if (args[1] == "selectmany_correlator_linq")
          disposable = proc.selectmany_correlator(participant, true);
        else if (args[1] == "selectmany_groupby_correlator")
          disposable = proc.selectmany_groupby_correlator(participant);
        else if (args[1] == "many_circle_correlator")
          disposable = proc.many_circle_correlator(participant, scheduler);
        else if (args[1] == "circle_zip_correlator")
          disposable = proc.circle_zip_correlator(participant);
        else if (args[1] == "splitterDelayNAverageWindow")
          disposable = proc.splitterDelayNAverageWindow(participant);
        else if (args[1] == "splitterDelayNAverage")
//.........这里部分代码省略.........
开发者ID:kharesp,项目名称:rticonnextdds-reactive,代码行数:101,代码来源:rxddstest.cs


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