Click or drag to resize
SoCpuBufferObject Class

CPU buffer object class.

Inheritance Hierarchy

Namespace: OIV.Inventor.Devices
Assembly: OIV.Inventor.Base (in OIV.Inventor.Base.dll) Version: 2024.1.0.0 (2024.1.0)
Syntax
public class SoCpuBufferObject : SoBufferObject

The SoCpuBufferObject type exposes the following members.

Constructors
Methods
  NameDescription
Public methodClearInstance

This function clears the content of the buffer, it frees the memory if the mode was COPY.

(Overrides SoBufferObjectClearInstance.)
Public methodCreateInstance

Create a new buffer with the same properties as the current one.

(Overrides SoBufferObjectCreateInstance.)
Public methodStatic memberCreateInstanceT(T)
Factory method to create an instance of SoCpuBufferObject from an arbitrary managed array of value type.
Public methodStatic memberCreateInstanceT(SbNativeArrayT)
Factory method to create an instance of SoCpuBufferObject from an arbitrary SbNativeArrayT.
Public methodStatic memberCreateInstanceT(T, Int32)
Factory method to create an instance of SoCpuBufferObject from an arbitrary managed array of value type.
Public methodDispose
Releases all resources used by SoDisposable.
(Inherited from SoDisposable.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodFillT
Convenient method to fill an SoBufferObject with a default value.
(Inherited from SoBufferObject.)
Public methodGetContext

Returns the device context where this buffer is valid.

(Inherited from SoBufferObject.)
Public methodGetHashCode
Overrides GetHashCode().
(Inherited from SoNetBase.)
Public methodGetMappedBufferObject

Returns a pointer to the buffer object which is mapped by the actual object.

(Inherited from SoBufferObject.)
Public methodGetMappedBufferObjectAccessMode

Returns the access mode used for the buffer mapping.

(Inherited from SoBufferObject.)
Public methodGetMappedBufferObjectPosition

Returns the position in the source buffer mapped in this buffer.

(Inherited from SoBufferObject.)
Public methodGetMappedBufferObjectSize

Returns the size of the mapped area in bytes.

(Inherited from SoBufferObject.)
Public methodGetSize

Returns the size, in bytes, of the buffer object.

(Inherited from SoBufferObject.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodLockBuffer

Locks the buffer against concurrent calls from different threads.

(Inherited from SoBufferObject.)
Public methodMap(SoBufferObjectAccessModes)
Calls Map(accessMode, System.UInt64(0), System.Convert.ToUInt64(SO_BUFFER_SIZE_ALL)).
(Inherited from SoBufferObject.)
Public methodMap(SoBufferObject, SoBufferObjectAccessModes)
Calls Map(targetBufferObject, accessMode, System.UInt64(0), System.Convert.ToUInt64(SO_BUFFER_SIZE_ALL)).
(Inherited from SoBufferObject.)
Public methodMap(SoBufferObjectAccessModes, UInt64)
Calls Map(accessMode, offset, System.Convert.ToUInt64(SO_BUFFER_SIZE_ALL)).
(Inherited from SoBufferObject.)
Public methodMap(SoBufferObject, SoBufferObjectAccessModes, UInt64)
Calls Map(targetBufferObject, accessMode, startPosition, System.Convert.ToUInt64(SO_BUFFER_SIZE_ALL)).
(Inherited from SoBufferObject.)
Public methodMap(SoBufferObjectAccessModes, UInt64, UInt64)

Map the buffer to a system memory address and allows the mapping of a sub part of the buffer object into CPU memory.

(Inherited from SoBufferObject.)
Public methodMap(SoBufferObject, SoBufferObjectAccessModes, UInt64, UInt64)

Maps the current buffer object into the specified buffer object.

(Inherited from SoBufferObject.)
Public methodMemcpy(SoBufferObject)
Calls Memcpy(sourceBufferObject, System.UInt64(0), System.UInt64(0), System.Convert.ToUInt64(SO_BUFFER_SIZE_ALL)).
(Inherited from SoBufferObject.)
Public methodMemcpy(SoBufferObject, UInt64)
Calls Memcpy(sourceBufferObject, destOffset, System.UInt64(0), System.Convert.ToUInt64(SO_BUFFER_SIZE_ALL)).
(Inherited from SoBufferObject.)
Public methodMemcpy(SoBufferObject, UInt64, UInt64)
Calls Memcpy(sourceBufferObject, destOffset, sourceOffset, System.Convert.ToUInt64(SO_BUFFER_SIZE_ALL)).
(Inherited from SoBufferObject.)
Public methodMemcpy(SoBufferObject, UInt64, UInt64, UInt64)

Copies data from the specified buffer object into this buffer object.

(Inherited from SoBufferObject.)
Public methodMemset(IntPtr)
Calls Memset(value, System.Convert.ToUInt64(1), System.UInt64(0), System.Convert.ToUInt64(SO_BUFFER_SIZE_ALL)).
(Inherited from SoBufferObject.)
Public methodMemset(IntPtr, UInt64)
Calls Memset(value, valueSize, System.UInt64(0), System.Convert.ToUInt64(SO_BUFFER_SIZE_ALL)).
(Inherited from SoBufferObject.)
Public methodMemset(IntPtr, UInt64, UInt64)
Calls Memset(value, valueSize, offset, System.Convert.ToUInt64(SO_BUFFER_SIZE_ALL)).
(Inherited from SoBufferObject.)
Public methodMemset(IntPtr, UInt64, UInt64, UInt64)

This function sets the contents of (or a portion of) this buffer object to the specified value.

(Inherited from SoBufferObject.)
Public methodSetSize

Sets the size in bytes of the buffer object.

(Inherited from SoBufferObject.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodUnlockBuffer

Unlocks the buffer object.

(Inherited from SoBufferObject.)
Public methodUnmap

Unmaps the buffer from CPU address space.

(Inherited from SoBufferObject.)
Public methodUnmap(SoBufferObject)

Unmap this buffer from the specified buffer object.

(Inherited from SoBufferObject.)
Top
Properties
  NameDescription
Public propertyBuffer

Request that the buffer object manage an existing block of memory.

Public propertyIsDisposable
ISafeDisposable interface implementation.
(Inherited from SoDisposable.)
Top
Remarks

This class provides management functions for CPU memory buffers.

By default memory allocations have the maximum possible alignment to allow use with (for example) SSE instructions.

Memory is managed using the new/delete operators. On Microsoft Windows platforms it is possible to use VirtualAlloc/VirtualFree instead by setting OIV_BUFFER_USE_VIRTUAL_ALLOC (see OIV.Inventor.SoPreferences).

See OIV.Inventor.Devices.SoBufferObject for general information about buffer objects.

See OIV.Inventor.Nodes.SoBufferedShape for an example of storing vertices in a CPU buffer.

EXAMPLE

Load data into a buffer object from an array in memory:

float[] vertices = new float[9 * 3] {
    1.0f, 0.5f,0.0f, 0.0f, 1.0f,0.0f, -1.0f,0.5f,0.0f,
   -1.0f,-1.0f,0.0f, 1.0f,-1.0f,0.0f,  1.0f,0.0f,0.0f, -1.0f,0.0f,0.0f,
   -1.0f,-1.5f,0.0f, 1.0f,-1.5f,0.0f
};

SbNativeArray<float> vertArray = new SbNativeArray<float>(vertices);
SoCpuBufferObject vertBuf = new SoCpuBufferObject( (SbNativeArray<byte>)vertArray );

EXAMPLE

Access data stored in a buffer object.

SbNativeArray<byte> data = (SbNativeArray<byte>)cpuBuffer.Map( SoBufferObject.AccessModes.READ_ONLY );
byte value = data[0];
   . . .
cpuBuffer.Unmap();

See Also