/// <summary> /// Helper method that gets a filled buffer constructed from a list of memory blocks /// </summary> /// <param name="allocatedBlocks">The memoryblocks that comprise the buffer</param> /// <param name="filledWith">If not null, the contents the memory block will be filled with</param> /// <returns>An optionally filled IBuffer object</returns> private static IBuffer GetFilledBuffer(IList <IMemoryBlock> allocatedBlocks, byte[] filledWith) { IBuffer newBuffer = new ManagedBuffer(allocatedBlocks); if (filledWith != null) { newBuffer.FillWith(filledWith); } return(newBuffer); }
public void BufferConstructorTest() { IMemoryBlock nullSlab = null; ManagedBuffer target = new ManagedBuffer(nullSlab); }
private static ManagedBuffer GetNewBuffer(IMemorySlab Slab) { IMemoryBlock allocatedMemoryBlock; Slab.TryAllocate(blockSize, out allocatedMemoryBlock); ManagedBuffer target = new ManagedBuffer(allocatedMemoryBlock); return target; }
/// <summary> /// Helper method that gets a filled buffer constructed from a list of memory blocks /// </summary> /// <param name="allocatedBlocks">The memoryblocks that comprise the buffer</param> /// <param name="filledWith">If not null, the contents the memory block will be filled with</param> /// <returns>An optionally filled IBuffer object</returns> private static IBuffer GetFilledBuffer(IList<IMemoryBlock> allocatedBlocks, byte[] filledWith) { IBuffer newBuffer = new ManagedBuffer(allocatedBlocks); if (filledWith != null) newBuffer.FillWith(filledWith); return newBuffer; }
//Gets a multi slab buffer private static ManagedBuffer GetNewBuffer(IMemorySlab[] Slabs) { List<IMemoryBlock> blockList = new List<IMemoryBlock>(); IMemoryBlock allocatedMemoryBlock; foreach (var slab in Slabs) { slab.TryAllocate(blockSize, out allocatedMemoryBlock); blockList.Add(allocatedMemoryBlock); } ManagedBuffer target = new ManagedBuffer(blockList); return target; }
public void BufferConstructorTest2() { IMemoryBlock[] emptyBlocks = new IMemoryBlock[0]; ManagedBuffer target = new ManagedBuffer(emptyBlocks); }
public void BufferConstructorTest() { IMemoryBlock[] nullBlocks = null; ManagedBuffer target = new ManagedBuffer(nullBlocks); }