Class ManagedMemoryBlock
ManagedMemoryBlock class. Used to read and write a managed memory block.
Inheritance
Inherited Members
Namespace: Cosmos.Core
Assembly: Cosmos.Core.dll
Syntax
public class ManagedMemoryBlock
Constructors
| Improve this Doc View SourceManagedMemoryBlock(UInt32)
Create a new buffer with the given size, not aligned
Declaration
public ManagedMemoryBlock(uint aByteCount)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | aByteCount |
ManagedMemoryBlock(UInt32, Int32)
Create a new buffer with the given size, aligned on the byte boundary specified
Declaration
public ManagedMemoryBlock(uint aByteCount, int alignment)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | aByteCount | |
System.Int32 | alignment | Byte Boundary alignment |
ManagedMemoryBlock(UInt32, Int32, Boolean)
Create a new buffer with the given size, and aligned on the byte boundary if align is true
Declaration
public ManagedMemoryBlock(uint aByteCount, int aAlignment, bool aAlign)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | aByteCount | Size of buffer |
System.Int32 | aAlignment | Byte Boundary alignment |
System.Boolean | aAlign | true if buffer should be aligned, false otherwise |
Fields
| Improve this Doc View Sourcememory
Declaration
public byte[] memory
Field Value
Type | Description |
---|---|
System.Byte[] |
Offset
Offset.
Declaration
public ulong Offset
Field Value
Type | Description |
---|---|
System.UInt64 |
Size
Size.
Declaration
public uint Size
Field Value
Type | Description |
---|---|
System.UInt32 |
Properties
| Improve this Doc View SourceItem[UInt32]
Get or set the byte at the given offset
Declaration
public byte this[uint offset] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | offset | Address Offset |
Property Value
Type | Description |
---|---|
System.Byte | Byte value at given offset |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown on invalid offset. |
Methods
| Improve this Doc View SourceCopy(MemoryBlock)
Copy MemoryBlock into ManagedMemoryBlock
Declaration
public void Copy(MemoryBlock block)
Parameters
Type | Name | Description |
---|---|---|
MemoryBlock | block | MemoryBlock to copy. |
Copy(Int32, Byte[], Int32, Int32)
Declaration
public void Copy(int aStart, byte[] aData, int aIndex, int aCount)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | aStart | |
System.Byte[] | aData | |
System.Int32 | aIndex | |
System.Int32 | aCount |
Copy(Int32, Int32[], Int32, Int32)
Declaration
public void Copy(int aStart, int[] aData, int aIndex, int aCount)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | aStart | |
System.Int32[] | aData | |
System.Int32 | aIndex | |
System.Int32 | aCount |
Fill(Int32, Int32, Int32)
Fill memory block with integer value
Declaration
public void Fill(int aByteOffset, int aCount, int aData)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | aByteOffset | A starting position in the memory block. This is integer indexing based |
System.Int32 | aCount | Data size. |
System.Int32 | aData | A data to fill memory block with. |
Fill(UInt32)
Fill memory block.
Declaration
public void Fill(uint aData)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | aData | A data to fill. |
Fill(UInt32, UInt32, UInt32)
Fill memory block.
Declaration
public void Fill(uint aByteOffset, uint aCount, uint aData)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | aByteOffset | A start. |
System.UInt32 | aCount | A count. |
System.UInt32 | aData | A data. |
Get(Int32, Int32[], Int32, Int32)
Copies data from the memory block to the specified array.
Declaration
public void Get(int aStart, int[] aData, int aIndex, int aCount)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | aStart | The start index in the memory block from which to begin copying. |
System.Int32[] | aData | The array into which data will be copied. |
System.Int32 | aIndex | The starting index in the array where data will be copied. |
System.Int32 | aCount | The number of elements to copy. |
Read16(UInt32)
Read 16-bit from the memory block.
Declaration
public ushort Read16(uint aByteOffset)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | aByteOffset | Data offset. |
Returns
Type | Description |
---|---|
System.UInt16 | UInt16 value. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if offset if bigger than memory block size. |
Read32(UInt32)
Read 32-bit from the memory block.
Declaration
public uint Read32(uint aByteOffset)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | aByteOffset | Data offset. |
Returns
Type | Description |
---|---|
System.UInt32 | UInt32 value. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if offset if bigger than memory block size. |
Write16(UInt32, UInt16)
Write 16-bit to the memory block.
Declaration
public void Write16(uint aByteOffset, ushort value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | aByteOffset | Data offset. |
System.UInt16 | value | Value to write. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if offset if bigger than memory block size or smaller than 0. |
Write32(UInt32, UInt32)
Write 32-bit to the memory block.
Declaration
public void Write32(uint aByteOffset, uint value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | aByteOffset | Data offset. |
System.UInt32 | value | Value to write. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if offset if bigger than memory block size or smaller than 0. |
Write8(UInt32, Byte)
Write 8-bit to the memory block.
Declaration
public void Write8(uint aByteOffset, byte value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | aByteOffset | Data offset. |
System.Byte | value | Value to write. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if offset if bigger than memory block size or smaller than 0. |
WriteString(UInt32, String)
Write string to the memory block.
Declaration
public void WriteString(uint aByteOffset, string value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | aByteOffset | Data offset. |
System.String | value | Value to write. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if offset if bigger than memory block size or smaller than 0. |