oevislib_net  0.14.3.0
Loading...
Searching...
No Matches
oevislib_net.Memory.ByteBuffer Class Reference

Class to handle binary data with ownership semantics. More...

Inheritance diagram for oevislib_net.Memory.ByteBuffer:

Public Member Functions

 ByteBuffer ()
 Constructs an empty ByteBuffer object.
 ByteBuffer (int inSize=0)
 Constructs a new ByteBuffer object.
 ByteBuffer (int inSize, IntPtr inData)
 Constructs a new ByteBuffer object.
 ByteBuffer (int inSize, IntPtr inData, bool inOwn)
 Constructs a new ByteBuffer object.
 ByteBuffer (byte[] inBuffer)
bool IsDataOwn ()
 Checks if the buffer owns its data.
bool IsEmpty ()
 Checks if the buffer is empty.
IntPtr GetData ()
 Returns a pointer to the buffer data.
int GetSize ()
 Returns the size of the buffer.
void Dispose ()
byte[] ToByteArray ()

Detailed Description

Class to handle binary data with ownership semantics.

After a release operation, the memory is expected to be deleted with delete[] keyword.

Constructor & Destructor Documentation

◆ ByteBuffer() [1/4]

oevislib_net.Memory.ByteBuffer.ByteBuffer ( )
inline

Constructs an empty ByteBuffer object.

◆ ByteBuffer() [2/4]

oevislib_net.Memory.ByteBuffer.ByteBuffer ( int inSize = 0)
inline

Constructs a new ByteBuffer object.

Parameters
inSizeSize of the buffer (in bytes) to be allocated.

◆ ByteBuffer() [3/4]

oevislib_net.Memory.ByteBuffer.ByteBuffer ( int inSize,
IntPtr inData )
inline

Constructs a new ByteBuffer object.

Parameters
inSizeSize of the buffer (in bytes).
inDataPointer to initial data.

◆ ByteBuffer() [4/4]

oevislib_net.Memory.ByteBuffer.ByteBuffer ( int inSize,
IntPtr inData,
bool inOwn )
inline

Constructs a new ByteBuffer object.

Parameters
inSizeSize of the buffer (in bytes).
inDataPointer to initial data (if null new memory will be allocated based on input size).
inOwnWhether the buffer should own the data. If true the input data will be copied and managed internally, otherwise the buffer will point directly to the input data.

Member Function Documentation

◆ GetData()

IntPtr oevislib_net.Memory.ByteBuffer.GetData ( )
inline

Returns a pointer to the buffer data.

Returns
Buffer's data.

◆ GetSize()

int oevislib_net.Memory.ByteBuffer.GetSize ( )
inline

Returns the size of the buffer.

Returns
Buffer's size.

◆ IsDataOwn()

bool oevislib_net.Memory.ByteBuffer.IsDataOwn ( )
inline

Checks if the buffer owns its data.

Returns
True if the buffer owns its data.

◆ IsEmpty()

bool oevislib_net.Memory.ByteBuffer.IsEmpty ( )
inline

Checks if the buffer is empty.

Returns
True if the buffer is empty.