예제 #1
0
            public ParseJob(Allocator alloc, bool enableBurst = true)
            {
                _byteReader = new AsyncByteReader(alloc);
                _worker     = new ParseLinesWorker(alloc);

                _lines = new NativeStringList(alloc);

                _data      = new GCHandle <Tdata>();
                _state_ptr = new PtrHandle <ReadStateImpl>();  // do not allocate (this will be assigned). used as reference.

                _info = new PtrHandle <ParseJobInfo>(alloc);

                _info.Target->decodeBlockSize = Define.DefaultDecodeBlock;
                _info.Target->blockNum        = 0;
                _info.Target->blockPos        = 0;

                _info.Target->allocated     = true;
                _info.Target->disposeHandle = false;
                _info.Target->enableBurst   = enableBurst;

                _info.Target->jobHandle = new JobHandle();

                _timer         = new GCHandle <System.Diagnostics.Stopwatch>();
                _timer_ms_coef = 1.0f;
            }
예제 #2
0
        public static int GetLines(ParseLinesWorker worker, NativeStringList lines)
        {
            var ref_continueBuff = worker._continueBuff.GetUnsafeRef();
            var ref_charBuff     = worker._charBuff.GetUnsafeRef();
            var ref_lines        = lines.GetUnsafeRef();

            _parseLinesDelegate(worker._info.Target,
                                ref ref_continueBuff,
                                ref ref_charBuff,
                                ref ref_lines,
                                out int line_count);
            return(line_count);
        }