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


C# IAddressable类代码示例

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


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

示例1: RegisterCancellationTokens

        /// <summary>
        /// Adds CancellationToken to the grain extension
        /// so that it can be cancelled through remote call to the CancellationSourcesExtension.
        /// </summary>
        /// <param name="target"></param>
        /// <param name="request"></param>
        /// <param name="logger"></param>
        internal static void RegisterCancellationTokens(IAddressable target, InvokeMethodRequest request, Logger logger)
        {
            for (var i = 0; i < request.Arguments.Length; i++)
            {
                var arg = request.Arguments[i];
                if (!(arg is GrainCancellationToken)) continue;
                var grainToken = ((GrainCancellationToken) request.Arguments[i]);

                CancellationSourcesExtension cancellationExtension;
                if (!SiloProviderRuntime.Instance.TryGetExtensionHandler(out cancellationExtension))
                {
                    cancellationExtension = new CancellationSourcesExtension();
                    if (!SiloProviderRuntime.Instance.TryAddExtension(cancellationExtension))
                    {
                        logger.Error(
                            ErrorCode.CancellationExtensionCreationFailed,
                            $"Could not add cancellation token extension to: {target}");
                        return;
                    }
                }

                // Replacing the half baked GrainCancellationToken that came from the wire with locally fully created one.
                request.Arguments[i] = cancellationExtension.RecordCancellationToken(grainToken.Id, grainToken.IsCancellationRequested);
            }
        }
开发者ID:Rejendo,项目名称:orleans,代码行数:32,代码来源:CancellationSourcesExtension.cs

示例2: M6502

 public M6502(IAddressable mem)
 {
     this.mem = mem;
     InstallOpcodes();
     Clock = 0;
     RunClocks = 0;
     RunClocksMultiple = 1;
     P = 1 << 5;
 }
开发者ID:BackupTheBerlios,项目名称:maria7800-svn,代码行数:9,代码来源:M6502.cs

示例3: Invoke

        public Task<object> Invoke(IAddressable grain, InvokeMethodRequest request)
        {
            var interceptor = grain as IGrainInvokeInterceptor;
            if (interceptor != null)
            {
                var methodInfo = this.GetMethodInfo(request.MethodId);
                return interceptor.Invoke(methodInfo, request, this.invoker);
            }

            return this.invoker.Invoke(grain, request);
        }
开发者ID:PaulNorth,项目名称:orleans,代码行数:11,代码来源:InterceptedMethodInvoker.cs

示例4: DeleteObjectReference

        public void DeleteObjectReference(IAddressable obj)
        {
            if (!(obj is GrainReference))
                throw new ArgumentException("Argument reference is not a grain reference.");

            var reference = (GrainReference) obj;
            LocalObjectData ignore;
            if (!localObjects.TryRemove(reference.ObserverId, out ignore))
                throw new ArgumentException("Reference is not associated with a local object.", "reference");
        }
开发者ID:randa1,项目名称:orleans,代码行数:10,代码来源:OutsideRuntimeClient.cs

示例5: Cast

 public static IClient Cast(IAddressable grainRef)
 {
     
     return (IClient) GrainReference.CastInternal(typeof(IClient), (GrainReference gr) => { return new ClientReference(gr);}, grainRef, 523268002);
 }
开发者ID:rikace,项目名称:Orleans.PingPong,代码行数:5,代码来源:orleans.codegen.cs

示例6: Invoke

 public async System.Threading.Tasks.Task<Object> Invoke(IAddressable grain, int interfaceId, int methodId, object[] arguments)
 {
         if (grain == null) throw new System.ArgumentNullException("grain");
         switch (interfaceId)
         {
             case 1662910789:  // IDestination
                 switch (methodId)
                 {
                     case 1491328371: 
                         await ((IDestination)grain).Ping((IClient)arguments[0], (Message)arguments[1]);
                       return true;
                     default: 
                         throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId);
                 }
             default:
                 throw new System.InvalidCastException("interfaceId="+interfaceId);
         }
 }
开发者ID:rikace,项目名称:Orleans.PingPong,代码行数:18,代码来源:orleans.codegen.cs

示例7: EA

 private static string EA(IAddressable mem, ushort PC, int bytes)
 {
     byte lsb = mem[PC];
     byte msb = 0;
     if (bytes == 2)
         msb = mem[(ushort)(PC + 1)];
     ushort ea = (ushort)(lsb | (msb << 8));
     if (bytes == 1)
         return String.Format(CultureInfo.InvariantCulture, "${0:x2}", ea);
     else
         return String.Format(CultureInfo.InvariantCulture, "${0:x4}", ea);
 }
开发者ID:BackupTheBerlios,项目名称:maria7800-svn,代码行数:12,代码来源:M6502DASM.cs

示例8: OpCodeDecode

 public static string OpCodeDecode(IAddressable mem, ushort PC)
 {
     int num_operands = InstructionLength(mem, PC) - 1;
     ushort PC1 = (ushort)(PC + 1);
     string addrmodeStr;
     switch (addressingModeMatrix[mem[PC]]) {
         case a.REL:
             addrmodeStr = String.Format(CultureInfo.InvariantCulture,
                 "${0:x4}", (ushort)(PC + (sbyte)(mem[PC1]) + 2));
             break;
         case a.ZPG:
         case a.ABS:
             addrmodeStr = EA(mem, PC1, num_operands);
             break;
         case a.ZPX:
         case a.ABX:
             addrmodeStr = EA(mem, PC1, num_operands) + ",X";
             break;
         case a.ZPY:
         case a.ABY:
             addrmodeStr = EA(mem, PC1, num_operands) + ",Y";
             break;
         case a.IDX:
             addrmodeStr = "(" + EA(mem, PC1, num_operands) + ",X)";
             break;
         case a.IDY:
             addrmodeStr = "(" + EA(mem, PC1, num_operands) + "),Y";
             break;
         case a.IND:
             addrmodeStr = "(" + EA(mem, PC1, num_operands) + ")";
             break;
         case a.IMM:
             addrmodeStr = "#" + EA(mem, PC1, num_operands);
             break;
         default:
             // a.IMP, a.ACC
             addrmodeStr = "";
             break;
     }
     return String.Format(CultureInfo.InvariantCulture,
         "{0} {1}", mnemonicMatrix[mem[PC]], addrmodeStr);
 }
开发者ID:BackupTheBerlios,项目名称:maria7800-svn,代码行数:42,代码来源:M6502DASM.cs

示例9: MemDump

 public static string MemDump(IAddressable mem, ushort atAddr, ushort untilAddr)
 {
     StringBuilder result = new StringBuilder();
     int length = untilAddr - atAddr;
     while (length-- >= 0) {
         result.AppendFormat(CultureInfo.InvariantCulture, "{0:x4}: ", atAddr);
         for (int i = 0; i < 8; ++i) {
             result.AppendFormat(CultureInfo.InvariantCulture, "{0:x2} ", mem[atAddr++]);
             if (i == 3)
                 result.Append(" ");
         }
         result.Append(Environment.NewLine);
     }
     if (result.Length > 0)
         result.Length--; // Trim trailing newline
     return result.ToString();
 }
开发者ID:BackupTheBerlios,项目名称:maria7800-svn,代码行数:17,代码来源:M6502DASM.cs

示例10: Disassemble

 public static string Disassemble(IAddressable mem, ushort atAddr, ushort untilAddr)
 {
     StringBuilder result = new StringBuilder();
     ushort dPC = atAddr;
     while (atAddr < untilAddr) {
         result.AppendFormat(CultureInfo.InvariantCulture, "{0:x4}: ", dPC);
         int len = InstructionLength(mem, dPC);
         for (int i = 0; i < 3; i++) {
             if (i < len)
                 result.AppendFormat(CultureInfo.InvariantCulture, "{0:x2} ", mem[atAddr++]);
             else
                 result.Append("   ");
         }
         result.AppendFormat(CultureInfo.InvariantCulture, "{0,-15:s}{1}",
             OpCodeDecode(mem, dPC), Environment.NewLine);
         dPC += (ushort)len;
     }
     if (result.Length > 0)
         result.Length--;  // Trim trailing newline
     return result.ToString();
 }
开发者ID:BackupTheBerlios,项目名称:maria7800-svn,代码行数:21,代码来源:M6502DASM.cs

示例11: Invoke

            /// <summary>
            /// Invokes the appropriate grain or extension method for the request interface ID and method ID.
            /// First each extension invoker is tried; if no extension handles the request, then the base
            /// invoker is used to handle the request.
            /// The base invoker will throw an appropriate exception if the request is not recognized.
            /// </summary>
            /// <param name="grain"></param>
            /// <param name="interfaceId"></param>
            /// <param name="methodId"></param>
            /// <param name="arguments"></param>
            /// <returns></returns>
            public Task<object> Invoke(IAddressable grain, int interfaceId, int methodId, object[] arguments)
            {
                if (extensionMap == null || !extensionMap.ContainsKey(interfaceId))
                    throw new InvalidOperationException(
                        String.Format("Extension invoker invoked with an unknown inteface ID:{0}.", interfaceId));

                var invoker = extensionMap[interfaceId].Item2;
                var extension = extensionMap[interfaceId].Item1;
                return invoker.Invoke(extension, interfaceId, methodId, arguments);
            }
开发者ID:kangkot,项目名称:orleans,代码行数:21,代码来源:ActivationData.cs

示例12: CreateObjectReference

 public GrainReference CreateObjectReference(IAddressable obj, IGrainMethodInvoker invoker)
 {
     throw new InvalidOperationException("Cannot create a local object reference from a grain.");
 }
开发者ID:PaulNorth,项目名称:orleans,代码行数:4,代码来源:InsideRuntimeClient.cs

示例13: DeleteObjectReference

 public void DeleteObjectReference(IAddressable obj)
 {
     throw new InvalidOperationException("Cannot delete a local object reference from a grain.");
 }
开发者ID:PaulNorth,项目名称:orleans,代码行数:4,代码来源:InsideRuntimeClient.cs

示例14: InstructionLength

 private static int InstructionLength(IAddressable mem, ushort PC)
 {
     switch (addressingModeMatrix[mem[PC]]) {
         case a.ACC:
         case a.IMP:
             return 1;
         case a.REL:
         case a.ZPG:
         case a.ZPX:
         case a.ZPY:
         case a.IDX:
         case a.IDY:
         case a.IMM:
             return 2;
         case a.ABS:
         case a.ABX:
         case a.ABY:
         case a.IND:
         default:
             return 3;
     }
 }
开发者ID:BackupTheBerlios,项目名称:maria7800-svn,代码行数:22,代码来源:M6502DASM.cs

示例15: Invoke

 public async System.Threading.Tasks.Task<Object> Invoke(IAddressable grain, int interfaceId, int methodId, object[] arguments)
 {
         if (grain == null) throw new System.ArgumentNullException("grain");
         switch (interfaceId)
         {
             case -1248350959:  // IDeviceGrain
                 switch (methodId)
                 {
                     case -1788431855: 
                         await ((IDeviceGrain)grain).SetTemperature((Double)arguments[0]);
                       return true;
                     case 98774684: 
                         return await ((IDeviceGrain)grain).GetTemperature();
                     default: 
                         throw new NotImplementedException("interfaceId="+interfaceId+",methodId="+methodId);
                 }
             default:
                 throw new System.InvalidCastException("interfaceId="+interfaceId);
         }
 }
开发者ID:richorama,项目名称:Orleans-IoT-Example,代码行数:20,代码来源:orleans.codegen.cs


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