public IPositionedMessagesParser CreateParser(CreateParserParams parserParams)
        {
            parserParams.EnsureRangeIsSet(this);

            var strategiesCache = new StreamParser.StrategiesCache()
            {
                MultiThreadedStrategy  = multiThreadedStrategy,
                SingleThreadedStrategy = singleThreadedStrategy
            };

            DejitteringParams?dejitteringParams = GetDejitteringParams();

            if (dejitteringParams != null && (parserParams.Flags & MessagesParserFlag.DisableDejitter) == 0)
            {
                return(new DejitteringMessagesParser(
                           underlyingParserParams => new StreamParser(
                               this,
                               EnsureParserRangeDoesNotExceedReadersBoundaries(underlyingParserParams),
                               textStreamPositioningParams,
                               settingsAccessor,
                               strategiesCache
                               ),
                           parserParams,
                           dejitteringParams.Value
                           ));
            }
            return(new StreamParser(
                       this,
                       parserParams,
                       textStreamPositioningParams,
                       settingsAccessor,
                       strategiesCache
                       ));
        }
예제 #2
0
        private StreamParser(
            IPositionedMessagesReader owner,
            CreateParserParams p,
            TextStreamPositioningParams textStreamPositioningParams,
            IGlobalSettingsAccessor globalSettings,
            StrategiesCache strategiesCache
            )
        {
            p.EnsureRangeIsSet(owner);

            this.InitialParams = p;

            this.isSequentialReadingParser = (p.Flags & MessagesParserFlag.HintParserWillBeUsedForMassiveSequentialReading) != 0;
            this.multithreadingDisabled    = (p.Flags & MessagesParserFlag.DisableMultithreading) != 0 ||
                                             globalSettings.MultithreadedParsingDisabled;

            CreateParsingStrategy(p, textStreamPositioningParams, strategiesCache, out this.Strategy);
        }