当前位置: 首页>>代码示例>>C#>>正文


C# IStream.GetAll方法代码示例

本文整理汇总了C#中IStream.GetAll方法的典型用法代码示例。如果您正苦于以下问题:C# IStream.GetAll方法的具体用法?C# IStream.GetAll怎么用?C# IStream.GetAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IStream的用法示例。


在下文中一共展示了IStream.GetAll方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Read

        private static void Read(IStream stream)
        {
            try
            {
                StrKey k1 = k1 = new StrKey("k1");
                while (true)
                {
                    IEnumerable<IDataItem> dataitems= stream.GetAll(k1);

                    DateTime now = DateTime.Now;
                    int count =0;
                    foreach (IDataItem item in dataitems)
                    {
                        item.GetVal();
                        count++;
                    }
                    
                    Console.WriteLine("[" + now + "]" + "GetAll "+count+" values received.");

                    if (isReading)
                        System.Threading.Thread.Sleep(ReadFrequencySeconds * 1000);
                    else
                        break;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception in read: " + e);
            }

        }
开发者ID:donnaknew,项目名称:programmingProject,代码行数:31,代码来源:Program.cs

示例2: ConstructCurrentPOV

        public List<int> ConstructCurrentPOV(IStream stream, int slotIndex)
        {
            List<int> retVal = new List<int>();

            IEnumerable<IDataItem> dataItems = stream.GetAll(this.occupancyKey, slotIndexBase + 96 * (int)(slotIndex / 96), slotIndexBase + (slotIndex % 96) + 96 * (int)(slotIndex / 96));
            if (dataItems != null)
            {
                foreach (IDataItem data in dataItems)
                {
                    retVal.Add(ConvertLittleEndian(data.GetVal().GetBytes()));
                }
            }
            return retVal;
        }
开发者ID:smosgin,项目名称:labofthings,代码行数:14,代码来源:NaivePreHeat.cs

示例3: ConstructPreviousPOV

        public List<List<int>> ConstructPreviousPOV(IStream stream, int slotIndex)
        {
            List<List<int>> retVal = new List<List<int>>();

            int numberOfPreviousDays = slotIndex / 96;

            for (int i = 0; i < numberOfPreviousDays; i++)
            {
                IEnumerable<IDataItem> dataItems = stream.GetAll(this.occupancyKey, slotIndexBase + 96 * i, slotIndexBase + (slotIndex % 96) + 96 * i);
                if (dataItems != null)
                {
                    List<int> dayPOV = new List<int>();
                    foreach (IDataItem data in dataItems)
                    {
                        dayPOV.Add(ConvertLittleEndian(data.GetVal().GetBytes()));
                    }
                    retVal.Add(dayPOV);
                }
            }
            return retVal;
        }
开发者ID:smosgin,项目名称:labofthings,代码行数:21,代码来源:NaivePreHeat.cs

示例4: SimpleConstructPreviousPOV

        public List<List<int>> SimpleConstructPreviousPOV(IStream stream, int slotIndex)
        {
            List<List<int>> retVal = new List<List<int>>();
            int count = 0;

            for(count = slotIndex % 96 ; count < slotIndex ; count = count + 96)
            {
                IEnumerable<IDataItem> dataItems = stream.GetAll(occupancyKey, slotIndexBase + count, slotIndexBase + count);
                if (dataItems != null && dataItems.Count() > 0)
                {
                    byte[] bytes = dataItems.ElementAt(0).GetVal().GetBytes();
                    var pov = Enumerable.Range(0, bytes.Length / 4).Select(i => BitConverter.ToInt32(bytes, i * 4)).ToList();
                    retVal.Add(pov);
                }
            }
            return retVal;
        }
开发者ID:donnaknew,项目名称:programmingProject,代码行数:17,代码来源:OptimalPreHeat.cs

示例5: SmartConstructPreviousPOV

        public List<List<int>> SmartConstructPreviousPOV(IStream stream, int slotIndex)
        {
            List<List<int>> retVal = new List<List<int>>();
            IEnumerable<IDataItem> dataItems = stream.GetAll(occupancyKey, slotIndexBase + slotIndex - 96, slotIndexBase + slotIndex - 96);
            slotIndex = slotIndex % 96; 
            if (dataItems != null && dataItems.Count() > 0)
            {
                byte[] bytes = dataItems.ElementAt(0).GetVal().GetBytes();
                var listofPOVs = Enumerable.Range(0, bytes.Length / 4).Select(i => BitConverter.ToInt32(bytes, i * 4)).ToList();

                for (int i = 0; i < listofPOVs.Count() / (slotIndex+1) ; i++)
                {
                    retVal.Add(listofPOVs.Skip(i * (slotIndex + 1)).Take(slotIndex + 1).ToList());
                }
            }
            return retVal;
        }
开发者ID:donnaknew,项目名称:programmingProject,代码行数:17,代码来源:SmartPreHeat.cs


注:本文中的IStream.GetAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。