Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Dispatcher / QueryResultOp.cs / 1 / QueryResultOp.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Dispatcher { using System; using System.ServiceModel.Channels; using System.Xml; using System.Xml.XPath; using System.Diagnostics; using System.Collections.Generic; ////// Base class for opcodes that produce the query's final result /// internal abstract class QueryResultOpcode : Opcode { internal QueryResultOpcode(OpcodeID id) : base(id) { this.flags |= OpcodeFlags.Result; } } internal class MatchQueryResultOpcode : QueryResultOpcode { internal MatchQueryResultOpcode() : this(OpcodeID.MatchQueryResult) { } protected MatchQueryResultOpcode(OpcodeID id) : base(id) { this.flags |= OpcodeFlags.Result; } internal override Opcode Eval(ProcessingContext context) { context.Processor.Result = this.IsSuccess(context); context.PopFrame(); return this.next; } protected bool IsSuccess(ProcessingContext context) { StackFrame topFrame = context.TopArg; #if FILTER_SELECT if (context.Processor.IsMatch) { #endif if (1 == topFrame.Count) { return context.Values[topFrame.basePtr].ToBoolean(); } else { context.Processor.Result = false; for (int i = topFrame.basePtr; i <= topFrame.endPtr; ++i) { if (context.Values[i].ToBoolean()) { return true; } } } #if FILTER_SELECT } else if (context.Processor.IsSelect) { string results = string.Empty; if (topFrame.Count > 0) { DiagnosticUtility.DebugAssert(topFrame.Count == 1, ""); results = context.Values[topFrame.basePtr].ToString(); } context.Processor.SelectResults = results; } #endif return false; } } #if NO internal class MatchFilterResultOpcode : MatchQueryResultOpcode { MessageFilter resultFilter; internal MatchFilterResultOpcode(MessageFilter resultFilter) : base(OpcodeID.MatchFilterResult) { DiagnosticUtility.DebugAssert(null != resultFilter, ""); this.resultFilter = resultFilter; } internal MessageFilter Result { get { return this.resultFilter; } } internal override void Add(Opcode op) { MatchFilterResultOpcode filterResult = op as MatchFilterResultOpcode; if (null == filterResult) { base.Add(op); return; } MatchMultipleFilterResultOpcode multipleResults = new MatchMultipleFilterResultOpcode(); DiagnosticUtility.DebugAssert(null != this.prev, ""); this.prev.Replace(this, multipleResults); if (null != this.next) { this.next.Prev = multipleResults; this.next = null; } multipleResults.Add(filterResult); multipleResults.Add(this); } // One MatchFilterResultOpcode result code is always treated equivalent to another internal override bool Equals(Opcode op) { if (base.Equals(op)) { MatchFilterResultOpcode resultOp = op as MatchFilterResultOpcode; return object.ReferenceEquals(resultOp.resultFilter, this.resultFilter); } return false; } internal override Opcode Eval(ProcessingContext context) { if (this.IsSuccess(context)) { context.Processor.ResultSet.Add(this.resultFilter); } return null; } internal override void Remove() { if (null == this.resultFilter) { base.Remove(); } } internal void Remove(MessageFilter resultFilter) { if (resultFilter == this.resultFilter) { this.resultFilter = null; DiagnosticUtility.DebugAssert(null != this.next, ""); base.Remove(); } } } #endif internal class MatchMultipleFilterResultOpcode : MatchQueryResultOpcode { internal QueryBufferresults; internal MatchMultipleFilterResultOpcode(XPathMessageFilter filter) : this() { this.results = new QueryBuffer (1); this.results.Add(filter); } internal MatchMultipleFilterResultOpcode() : base(OpcodeID.MatchMultipleFilterResult) { this.results = new QueryBuffer (0); } internal override void Add(Opcode op) { #if NO MatchFilterResultOpcode resultOp = op as MatchFilterResultOpcode; if (null != resultOp) { this.results.Add(resultOp.Result); return; } #endif MatchMultipleFilterResultOpcode results = op as MatchMultipleFilterResultOpcode; if (null != results) { this.results.Add(ref results.results); this.results.TrimToCount(); return; } base.Add(op); } internal override void CollectXPathFilters(ICollection filters) { for(int i = 0; i < this.results.Count; ++i) { filters.Add(this.results[i]); } } internal override bool Equals(Opcode op) { if (base.Equals (op)) { return object.ReferenceEquals(this, op); } return false; } internal override Opcode Eval(ProcessingContext context) { if (this.IsSuccess(context)) { ICollection matches = context.Processor.ResultSet; for (int i = 0, count = this.results.Count; i < count; ++i) { matches.Add(this.results[i]); } } context.PopFrame(); return this.next; } internal override void Remove() { if (0 == this.results.Count) { base.Remove(); } } internal void Remove(XPathMessageFilter resultFilter) { DiagnosticUtility.DebugAssert(null != resultFilter, ""); this.results.Remove(resultFilter); this.Remove(); } internal override void Trim() { this.results.TrimToCount(); } } } // 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
- PropertyEmitterBase.cs
- NopReturnReader.cs
- FixedSOMPageConstructor.cs
- BasicCellRelation.cs
- HttpRuntimeSection.cs
- StringStorage.cs
- DoubleConverter.cs
- DataRelationCollection.cs
- _BufferOffsetSize.cs
- ErrorInfoXmlDocument.cs
- FileUtil.cs
- PerformanceCounterCategory.cs
- TextBox.cs
- DetailsViewUpdateEventArgs.cs
- ApplicationServiceManager.cs
- CurrentChangedEventManager.cs
- StateManagedCollection.cs
- ThreadAbortException.cs
- BamlLocalizableResourceKey.cs
- SqlDataSourceEnumerator.cs
- SqlDataSource.cs
- TextParagraphProperties.cs
- IdleTimeoutMonitor.cs
- CacheRequest.cs
- itemelement.cs
- ProjectionPath.cs
- WSFederationHttpBindingElement.cs
- HtmlLiteralTextAdapter.cs
- GridViewDeleteEventArgs.cs
- MediaPlayerState.cs
- DataGridViewAddColumnDialog.cs
- TraceFilter.cs
- NativeMethods.cs
- TextSegment.cs
- DatePickerDateValidationErrorEventArgs.cs
- PersonalizationStateInfoCollection.cs
- RawStylusInputReport.cs
- ConfigXmlAttribute.cs
- ProvidePropertyAttribute.cs
- Soap.cs
- XmlSchemaProviderAttribute.cs
- XhtmlBasicCommandAdapter.cs
- ComponentEvent.cs
- NativeObjectSecurity.cs
- Registry.cs
- StylusEditingBehavior.cs
- RecordsAffectedEventArgs.cs
- GrammarBuilder.cs
- LinearQuaternionKeyFrame.cs
- ExpressionNode.cs
- XmlnsDefinitionAttribute.cs
- ColorConvertedBitmap.cs
- SspiWrapper.cs
- RequestCachePolicyConverter.cs
- FormsAuthenticationUserCollection.cs
- UiaCoreProviderApi.cs
- AliasExpr.cs
- ClipboardProcessor.cs
- ObjectNotFoundException.cs
- IndentedTextWriter.cs
- IntPtr.cs
- Transform3D.cs
- CryptographicAttribute.cs
- ComboBoxItem.cs
- SqlDataSourceFilteringEventArgs.cs
- DataGridViewColumnCollection.cs
- AssociationSet.cs
- PathSegment.cs
- ParameterCollectionEditor.cs
- CompositeDataBoundControl.cs
- PageParserFilter.cs
- ThicknessAnimationUsingKeyFrames.cs
- ExtendedProtectionPolicyElement.cs
- ScrollBar.cs
- XmlSchemaElement.cs
- GenericsInstances.cs
- odbcmetadatafactory.cs
- UInt64.cs
- TextCompositionManager.cs
- XslTransform.cs
- SqlRetyper.cs
- FillErrorEventArgs.cs
- WindowsListViewGroupHelper.cs
- counter.cs
- XmlUtil.cs
- CommonObjectSecurity.cs
- ModelProperty.cs
- AuthorizationRuleCollection.cs
- DateBoldEvent.cs
- Material.cs
- EFColumnProvider.cs
- SystemWebSectionGroup.cs
- BamlResourceContent.cs
- SBCSCodePageEncoding.cs
- ConfigurationValue.cs
- XsdDateTime.cs
- X509SecurityTokenProvider.cs
- ResourceContainer.cs
- TextEditorSelection.cs
- WinFormsUtils.cs