/// <summary>
        /// Returns all events by tick range [from..to] (including from and to)
        /// </summary>
        /// <param name="from"></param>
        /// <param name="to"></param>
        /// <returns></returns>
        HistoryStorage IStatesHistoryModuleBase.GetHistoryStorage(Tick from, Tick to)
        {
            var list = PoolList <HistoryEvent> .Spawn(100);

            foreach (var data in this.events)
            {
                var tick = data.Key;
                if ((from != Tick.Invalid && tick < from) ||
                    (to != Tick.Invalid && tick > to))
                {
                    continue;
                }

                var values = data.Value.Values;
                for (int i = 0, cnt = values.Count; i < cnt; ++i)
                {
                    var evt = values[i];
                    if (evt.storeInHistory == true)
                    {
                        list.Add(evt);
                    }
                }
            }

            var storage = new HistoryStorage();

            storage.events = list.ToArray();
            PoolList <HistoryEvent> .Recycle(ref list);

            return(storage);
        }
Example #2
0
        HistoryStorage IStatesHistoryModuleBase.GetHistoryStorage()
        {
            var list = PoolList <HistoryEvent> .Spawn(100);

            foreach (var data in this.events)
            {
                var values = data.Value.Values;
                for (int i = 0, cnt = values.Count; i < cnt; ++i)
                {
                    var evt = values[i];
                    if (evt.storeInHistory == true)
                    {
                        list.Add(evt);
                    }
                }
            }

            var storage = new HistoryStorage();

            storage.events = list.ToArray();
            PoolList <HistoryEvent> .Recycle(ref list);

            return(storage);
        }