Property | Type | Description | |
---|---|---|---|
BufferStartPtr | byte* | ||
Header | SharedHeader* | ||
Mmf | MemoryMappedFile | ||
View | MemoryMappedViewAccessor | ||
ViewPtr | byte* |
Method | Description | |
---|---|---|
Close ( ) : void |
Sets the ShuttingDown flag, and disposes of the MemoryMappedFile and MemoryMappedViewAccessor.
|
|
Dispose ( ) : void |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
Method | Description | |
---|---|---|
Dispose ( bool disposeManagedResources ) : void |
IDisposable pattern - dispose of managed/unmanaged resources
|
|
DoClose ( ) : void |
Any classes that inherit from SharedBuffer should implement any Close logic here, Mmf and View are still active at this point. There is no need to call base.DoClose() from these classes. It is possible for Close to be called before Open has completed successfully, in this situation DoClose should fail gracefully. |
|
DoOpen ( ) : bool |
Allows any classes that inherit from SharedBuffer to perform additional open logic. There is no need to call base.DoOpen() from these implementations. By throwing an exception or returning false, the call to Open will fail and Close will be called. |
|
InitialiseHeader ( ) : void |
Initialises the header within the shared memory. Only applicable if IsOwnerOfSharedMemory is true.
|
|
Read ( Action readFunc, long bufferPosition ) : void |
Prepares an IntPtr to the buffer position and calls readFunc to perform the reading.
|
|
Read ( IntPtr destination, int length, long bufferPosition ) : void |
Reads length bytes into the memory location destination from the buffer region of the shared memory.
|
|
Read ( &data, long bufferPosition ) : void |
Reads an instance of T from the buffer
|
|
Read ( Array destination, long bufferPosition ) : void |
Reads an array of T from the buffer.
|
|
ReadArray ( Array destination, int index, int count, long bufferPosition ) : void |
Reads a number of elements from a memory location into the provided buffer starting at the specified index.
|
|
SharedBuffer ( string name, long bufferSize, bool ownsSharedMemory ) : System |
Create a new SharedBuffer instance with the specified name and buffer size The maximum total shared memory size is dependent upon the system and current memory fragmentation. The shared memory layout on 32-bit and 64-bit is: |
|
Write ( Action writeFunc, long bufferPosition ) : void |
Prepares an IntPtr to the buffer position and calls writeFunc to perform the writing.
|
|
Write ( IntPtr source, int length, long bufferPosition ) : void |
Writes length bytes from the source into the shared memory buffer.
|
|
Write ( &source, long bufferPosition ) : void |
Writes an instance of T into the buffer
|
|
Write ( Array source, int index, long bufferPosition ) : void |
Writes an array of T into the buffer
|
|
Write ( Array source, long bufferPosition ) : void |
Writes an array of T into the buffer
|
|
WriteArray ( Array source, int index, int count, long bufferPosition ) : void |
Writes an array of T into the buffer
|
Method | Description | |
---|---|---|
Open ( ) : bool |
protected Dispose ( bool disposeManagedResources ) : void | ||
disposeManagedResources | bool | true to dispose of managed resources as well as unmanaged. |
return | void |
protected Read ( Action readFunc, long bufferPosition ) : void | ||
readFunc | Action | A function used to read from the buffer. The IntPtr parameter is a pointer to the buffer offset by |
bufferPosition | long | The offset within the buffer region of the shared memory to read from. |
return | void |
protected Read ( IntPtr destination, int length, long bufferPosition ) : void | ||
destination | IntPtr | A managed pointer to the memory location to copy data into from the buffer |
length | int | The number of bytes to be copied |
bufferPosition | long | The offset within the buffer region of the shared memory to read from. |
return | void |
protected Read ( &data, long bufferPosition ) : void | ||
data | Output parameter that will contain the value read from the buffer | |
bufferPosition | long | The offset within the buffer region of the shared memory to read from. |
return | void |
protected Read ( Array destination, long bufferPosition ) : void | ||
destination | Array | Array that will contain the values read from the buffer. The length of this array controls the number of elements to read. |
bufferPosition | long | The offset within the buffer region of the shared memory to read from. |
return | void |
protected ReadArray ( Array destination, int index, int count, long bufferPosition ) : void | ||
destination | Array | The destination buffer. |
index | int | The start index within |
count | int | The number of elements to read. |
bufferPosition | long | The source offset within the buffer region of the shared memory. |
return | void |
protected SharedBuffer ( string name, long bufferSize, bool ownsSharedMemory ) : System | ||
name | string | The name of the shared memory |
bufferSize | long | The buffer size in bytes. The total shared memory size will be Marshal.SizeOf(SharedMemory.SharedHeader) + bufferSize |
ownsSharedMemory | bool | Whether or not the current instance owns the shared memory. If true a new shared memory will be created and initialised otherwise an existing one is opened. |
return | System |
protected Write ( Action writeFunc, long bufferPosition ) : void | ||
writeFunc | Action | A function used to write to the buffer. The IntPtr parameter is a pointer to the buffer location offset by |
bufferPosition | long | The offset within the buffer region to start writing to. |
return | void |
protected Write ( IntPtr source, int length, long bufferPosition ) : void | ||
source | IntPtr | A managed pointer to the memory location to be copied into the buffer |
length | int | The number of bytes to be copied |
bufferPosition | long | The offset within the buffer region of the shared memory to write to. |
return | void |
protected Write ( &source, long bufferPosition ) : void | ||
source | A reference to an instance of |
|
bufferPosition | long | The offset within the buffer region of the shared memory to write to. |
return | void |
protected Write ( Array source, int index, long bufferPosition ) : void | ||
source | Array | An array of |
index | int | The index within the array to start writing from. |
bufferPosition | long | The offset within the buffer region of the shared memory to write to. |
return | void |
protected Write ( Array source, long bufferPosition ) : void | ||
source | Array | An array of |
bufferPosition | long | The offset within the buffer region of the shared memory to write to. |
return | void |
protected WriteArray ( Array source, int index, int count, long bufferPosition ) : void | ||
source | Array | The source data to be written to the buffer |
index | int | The start index within |
count | int | The number of elements to write. |
bufferPosition | long | The offset within the buffer region of the shared memory to write to. |
return | void |