Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Dispatcher / QueryMath.cs / 1 / QueryMath.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Dispatcher { using System.Collections; using System.Diagnostics; internal enum MathOperator { None, Plus, Minus, Div, Multiply, Mod, Negate } internal class MathOpcode : Opcode { MathOperator mathOp; internal MathOpcode(OpcodeID id, MathOperator op) : base(id) { this.mathOp = op; } internal override bool Equals(Opcode op) { if (base.Equals(op)) { return (this.mathOp == ((MathOpcode) op).mathOp); } return false; } #if DEBUG_FILTER public override string ToString() { return string.Format("{0} {1}", base.ToString(), this.mathOp.ToString()); } #endif } internal class PlusOpcode : MathOpcode { internal PlusOpcode() : base(OpcodeID.Plus, MathOperator.Plus) { } internal override Opcode Eval(ProcessingContext context) { StackFrame argX = context.TopArg; StackFrame argY = context.SecondArg; DiagnosticUtility.DebugAssert(argX.Count == argY.Count, ""); Value[] values = context.Values; for (int x = argX.basePtr, y = argY.basePtr; x <= argX.endPtr; ++x, ++y) { DiagnosticUtility.DebugAssert(values[x].IsType(ValueDataType.Double), ""); DiagnosticUtility.DebugAssert(values[y].IsType(ValueDataType.Double), ""); values[y].Add(values[x].Double); } context.PopFrame(); return this.next; } } internal class MinusOpcode : MathOpcode { internal MinusOpcode() : base(OpcodeID.Minus, MathOperator.Minus) { } internal override Opcode Eval(ProcessingContext context) { StackFrame argX = context.TopArg; StackFrame argY = context.SecondArg; DiagnosticUtility.DebugAssert(argX.Count == argY.Count, ""); Value[] values = context.Values; for (int x = argX.basePtr, y = argY.basePtr; x <= argX.endPtr; ++x, ++y) { DiagnosticUtility.DebugAssert(values[x].IsType(ValueDataType.Double), ""); DiagnosticUtility.DebugAssert(values[y].IsType(ValueDataType.Double), ""); values[y].Double = values[x].Double - values[y].Double; } context.PopFrame(); return this.next; } } internal class MultiplyOpcode : MathOpcode { internal MultiplyOpcode() : base(OpcodeID.Multiply, MathOperator.Multiply) { } internal override Opcode Eval(ProcessingContext context) { StackFrame argX = context.TopArg; StackFrame argY = context.SecondArg; DiagnosticUtility.DebugAssert(argX.Count == argY.Count, ""); Value[] values = context.Values; for (int x = argX.basePtr, y = argY.basePtr; x <= argX.endPtr; ++x, ++y) { DiagnosticUtility.DebugAssert(values[x].IsType(ValueDataType.Double), ""); DiagnosticUtility.DebugAssert(values[y].IsType(ValueDataType.Double), ""); values[y].Multiply(values[x].Double); } context.PopFrame(); return this.next; } } internal class DivideOpcode : MathOpcode { internal DivideOpcode() : base(OpcodeID.Divide, MathOperator.Div) { } internal override Opcode Eval(ProcessingContext context) { StackFrame argX = context.TopArg; StackFrame argY = context.SecondArg; DiagnosticUtility.DebugAssert(argX.Count == argY.Count, ""); Value[] values = context.Values; for (int x = argX.basePtr, y = argY.basePtr; x <= argX.endPtr; ++x, ++y) { DiagnosticUtility.DebugAssert(values[x].IsType(ValueDataType.Double), ""); DiagnosticUtility.DebugAssert(values[y].IsType(ValueDataType.Double), ""); values[y].Double = values[x].Double / values[y].Double; } context.PopFrame(); return this.next; } } internal class ModulusOpcode : MathOpcode { internal ModulusOpcode() : base(OpcodeID.Mod, MathOperator.Mod) { } internal override Opcode Eval(ProcessingContext context) { StackFrame argX = context.TopArg; StackFrame argY = context.SecondArg; Value[] values = context.Values; DiagnosticUtility.DebugAssert(argX.Count == argY.Count, ""); for (int x = argX.basePtr, y = argY.basePtr; x <= argX.endPtr; ++x, ++y) { DiagnosticUtility.DebugAssert(values[x].IsType(ValueDataType.Double), ""); DiagnosticUtility.DebugAssert(values[y].IsType(ValueDataType.Double), ""); values[y].Double = values[x].Double % values[y].Double; } context.PopFrame(); return this.next; } } internal class NegateOpcode : MathOpcode { internal NegateOpcode() : base(OpcodeID.Negate, MathOperator.Negate) { } internal override Opcode Eval(ProcessingContext context) { StackFrame frame = context.TopArg; Value[] values = context.Values; for (int i = frame.basePtr; i <= frame.endPtr; ++i) { values[i].Negate(); } return this.next; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DeclaredTypeElement.cs
- DataGridHyperlinkColumn.cs
- MenuItemBinding.cs
- XappLauncher.cs
- Label.cs
- DeploymentSection.cs
- ToolStripRenderEventArgs.cs
- XsltInput.cs
- DBSqlParser.cs
- EntitySqlQueryCacheKey.cs
- DataControlFieldsEditor.cs
- MenuItemBinding.cs
- WebServiceErrorEvent.cs
- ProviderMetadataCachedInformation.cs
- DrawingAttributeSerializer.cs
- ConfigurationSettings.cs
- SecurityCriticalDataForSet.cs
- Page.cs
- OleDbException.cs
- DictionarySectionHandler.cs
- ApplicationSecurityInfo.cs
- ContainerSelectorGlyph.cs
- DataGridClipboardCellContent.cs
- RealizationContext.cs
- MultiPageTextView.cs
- UIElement3DAutomationPeer.cs
- ValueConversionAttribute.cs
- MeshGeometry3D.cs
- Unit.cs
- WebServiceReceiveDesigner.cs
- WebPartConnectionCollection.cs
- _HeaderInfo.cs
- FastEncoder.cs
- GlyphInfoList.cs
- RegexTree.cs
- HttpPostedFile.cs
- OAVariantLib.cs
- FederatedMessageSecurityOverHttpElement.cs
- PeerObject.cs
- QuotaExceededException.cs
- DivideByZeroException.cs
- ConfigurationException.cs
- CodeEventReferenceExpression.cs
- BamlTreeUpdater.cs
- CompareValidator.cs
- IxmlLineInfo.cs
- SystemUnicastIPAddressInformation.cs
- basenumberconverter.cs
- PrintingPermission.cs
- FontFamily.cs
- Vector3DCollection.cs
- AnnotationDocumentPaginator.cs
- WindowsFormsHostPropertyMap.cs
- OleDbParameter.cs
- WorkflowLayouts.cs
- XmlHelper.cs
- JsonFormatReaderGenerator.cs
- HelpInfo.cs
- InkCanvasSelection.cs
- SchemaNamespaceManager.cs
- AttributeSetAction.cs
- EncryptedKey.cs
- ScriptingProfileServiceSection.cs
- StylusOverProperty.cs
- _ChunkParse.cs
- ToolboxItemCollection.cs
- PageThemeParser.cs
- GridViewCellAutomationPeer.cs
- CreateDataSourceDialog.cs
- TimeEnumHelper.cs
- webbrowsersite.cs
- QuaternionValueSerializer.cs
- CommittableTransaction.cs
- AutomationTextAttribute.cs
- AccessViolationException.cs
- EventWaitHandleSecurity.cs
- ListViewInsertEventArgs.cs
- PlainXmlSerializer.cs
- ContextMenu.cs
- TerminateDesigner.cs
- DebuggerAttributes.cs
- PrintControllerWithStatusDialog.cs
- ExternalDataExchangeService.cs
- OSFeature.cs
- ItemContainerPattern.cs
- remotingproxy.cs
- KerberosSecurityTokenProvider.cs
- PropertyChangedEventManager.cs
- EmptyEnumerable.cs
- LicenseException.cs
- HttpClientCertificate.cs
- SQLDateTime.cs
- SkewTransform.cs
- OdbcParameter.cs
- SqlConnectionManager.cs
- ErrorFormatter.cs
- ThrowHelper.cs
- EventMappingSettings.cs
- Encoder.cs
- DbConnectionFactory.cs